* initial gpio layer * move temlplate.c to template.c.example in preparing to applications.mk rework * separate arduino layer * separate flipper_hal.x * prepare to switch applications on v2 core gpio api * swithch applications to v2 gpio api * gpio api for local target * better gpio_disable handling * remove pwm functions from local target * inline gpio funcs * common function to init all api's * fix local example blink * move delay us to hal api folder * move pwm_set/pwm_stop to hal api folder * update applications to use hal pwm api * remove gpio mode case warning * add speaker demo to build Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
		
			
				
	
	
		
			37 lines
		
	
	
		
			875 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			875 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(GpioPin* gpio, GpioMode mode);
 | 
						|
 | 
						|
// init GPIO, extended version
 | 
						|
void gpio_init_ex(GpioPin* gpio, GpioMode mode, GpioPull pull, GpioSpeed speed);
 | 
						|
 | 
						|
// write value to GPIO, false = LOW, true = HIGH
 | 
						|
static inline void gpio_write(GpioPin* gpio, bool state) {
 | 
						|
    hal_gpio_write(gpio, state);
 | 
						|
}
 | 
						|
 | 
						|
// read value from GPIO, false = LOW, true = HIGH
 | 
						|
static inline bool gpio_read(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); |