flipperzero-firmware/core/api-hal/api-gpio.h
DrZlo13 979af6c165
Core code cleanup (#206)
* add delay function
* todo about delay_isr
* remove arduino defines and fix all apps to use core-api/hal-api
* delay for local target
* remove warnings of task_equal
* fix BSP_SD_Init
* fix USBD_static
* grio read constant pointer to gpio
* add TODO about ISR context
* const void* arg for pubsub api
* mark unused functions
* app pointers now pointed to constant apps
* fix printf format
* fix "unused" warnings in local target
* fix const pin read in local target
* fix int to pointer warnings in local target
* power read mutex error fix
* delete old makefile
* add -werror

Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
Co-authored-by: aanper <mail@s3f.ru>
2020-10-29 10:58:19 +03:00

37 lines
881 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(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);