 a96f23af9b
			
		
	
	
		a96f23af9b
		
			
		
	
	
	
	
		
			
			* fix multithread logic * more buffer for dallas id string * update apps to use new logic * delay_us small speedup * add consant qualifier to gpio records and some core api * fix some apps to use simpler method of getting gpio record * fix ibutton app, stupid stack problem
		
			
				
	
	
		
			41 lines
		
	
	
		
			946 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			946 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #pragma once
 | |
| #include "flipper.h"
 | |
| #include "flipper_v2.h"
 | |
| #include "api-hal-gpio.h"
 | |
| 
 | |
| typedef struct {
 | |
|     ValueMutex* gpio_mutex;
 | |
|     GpioPin* gpio;
 | |
| } GpioDisableRecord;
 | |
| 
 | |
| // init GPIO API
 | |
| bool gpio_api_init();
 | |
| 
 | |
| // init GPIO
 | |
| void gpio_init(const GpioPin* gpio, const GpioMode mode);
 | |
| 
 | |
| // init GPIO, extended version
 | |
| void gpio_init_ex(
 | |
|     const GpioPin* gpio,
 | |
|     const GpioMode mode,
 | |
|     const GpioPull pull,
 | |
|     const GpioSpeed speed);
 | |
| 
 | |
| // write value to GPIO, false = LOW, true = HIGH
 | |
| static inline void gpio_write(const GpioPin* gpio, const bool state) {
 | |
|     hal_gpio_write(gpio, state);
 | |
| }
 | |
| 
 | |
| // read value from GPIO, false = LOW, true = HIGH
 | |
| static inline bool gpio_read(const GpioPin* gpio) {
 | |
|     return hal_gpio_read(gpio);
 | |
| }
 | |
| 
 | |
| // put GPIO to Z-state
 | |
| void gpio_disable(GpioDisableRecord* gpio_record);
 | |
| 
 | |
| // get GPIO record
 | |
| ValueMutex* gpio_open_mutex(const char* name);
 | |
| 
 | |
| // get GPIO record and acquire mutex
 | |
| GpioPin* gpio_open(const char* name); |