2020-10-26 07:16:54 +00:00
|
|
|
#pragma once
|
[FL-140] Core api dynamic records (#296)
* SYSTEM: tickless mode with deep sleep.
* Move FreeRTOS ticks to lptim2
* API: move all sumbodules init routines to one place. Timebase: working lptim2 at tick source.
* API Timebase: lp-timer routines, timer access safe zones prediction and synchronization. FreeRTOS: adjust configuration for tickless mode.
* NFC: support for tickless mode.
* API Timebase: improve tick error handling in IRQ. Apploader: use insomnia mode to run applications.
* BLE: prevent sleep while core2 starting
* HAL: nap while in insomnia mode
* init records work
* try to implement record delete
* tests and flapp
* flapp subsystem
* new core functions to get app stat, simplify core code
* fix thread termination
* add strdup to core
* fix tests
* Refactoring: remove all unusued parts, update API usage, aggreagate API sources and headers, new record storage
* Refactoring: update furi record api usage, cleanup code
* Fix broken merge for freertos apps
* Core, Target: fix compilation warnings
* Drop firmware target local
* HAL Timebase, Power, Clock: semaphore guarded access to clock and power modes, better sleep mode.
* SD-Filesystem: wait for all deps to arrive before adding widget. Core, BLE: disable debug dump to serial.
* delete old app example-ipc
* delete old app fatfs list
* fix strobe app, add input header
* delete old display driver
* comment old app qr-code
* fix sd-card test, add forced widget update
* remove unused new core test
* increase heap to 128k
* comment and assert old core tests
* fix syntax
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-01-20 16:09:26 +00:00
|
|
|
|
2020-10-26 07:16:54 +00:00
|
|
|
#include "api-hal-gpio.h"
|
[FL-140] Core api dynamic records (#296)
* SYSTEM: tickless mode with deep sleep.
* Move FreeRTOS ticks to lptim2
* API: move all sumbodules init routines to one place. Timebase: working lptim2 at tick source.
* API Timebase: lp-timer routines, timer access safe zones prediction and synchronization. FreeRTOS: adjust configuration for tickless mode.
* NFC: support for tickless mode.
* API Timebase: improve tick error handling in IRQ. Apploader: use insomnia mode to run applications.
* BLE: prevent sleep while core2 starting
* HAL: nap while in insomnia mode
* init records work
* try to implement record delete
* tests and flapp
* flapp subsystem
* new core functions to get app stat, simplify core code
* fix thread termination
* add strdup to core
* fix tests
* Refactoring: remove all unusued parts, update API usage, aggreagate API sources and headers, new record storage
* Refactoring: update furi record api usage, cleanup code
* Fix broken merge for freertos apps
* Core, Target: fix compilation warnings
* Drop firmware target local
* HAL Timebase, Power, Clock: semaphore guarded access to clock and power modes, better sleep mode.
* SD-Filesystem: wait for all deps to arrive before adding widget. Core, BLE: disable debug dump to serial.
* delete old app example-ipc
* delete old app fatfs list
* fix strobe app, add input header
* delete old display driver
* comment old app qr-code
* fix sd-card test, add forced widget update
* remove unused new core test
* increase heap to 128k
* comment and assert old core tests
* fix syntax
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-01-20 16:09:26 +00:00
|
|
|
#include <furi/valuemutex.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2020-10-26 07:16:54 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
ValueMutex* gpio_mutex;
|
|
|
|
GpioPin* gpio;
|
|
|
|
} GpioDisableRecord;
|
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/**
|
|
|
|
* Init GPIO API
|
|
|
|
* @return true on successful gpio initialization, false otherwize
|
|
|
|
*/
|
2020-10-26 07:16:54 +00:00
|
|
|
bool gpio_api_init();
|
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/**
|
|
|
|
* Init GPIO
|
|
|
|
* @param gpio GpioPin instance
|
|
|
|
* @param mode GpioMode gpio mode
|
|
|
|
*/
|
2020-11-19 12:25:32 +00:00
|
|
|
void gpio_init(const GpioPin* gpio, const GpioMode mode);
|
2020-10-26 07:16:54 +00:00
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/**
|
|
|
|
* Init GPIO, extended version
|
|
|
|
* @param gpio GpioPin instance
|
|
|
|
* @param mode GpioMode gpio mode
|
|
|
|
* @param pull GpioPull gpio pull mode
|
|
|
|
* @param speed GpioSpeed gpio speed
|
|
|
|
*/
|
2020-11-19 12:25:32 +00:00
|
|
|
void gpio_init_ex(
|
|
|
|
const GpioPin* gpio,
|
|
|
|
const GpioMode mode,
|
|
|
|
const GpioPull pull,
|
|
|
|
const GpioSpeed speed);
|
2020-10-26 07:16:54 +00:00
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/**
|
|
|
|
* Write value to GPIO
|
|
|
|
* @param gpio GpioPin instance
|
|
|
|
* @param state false = LOW, true = HIGH
|
|
|
|
*/
|
2020-11-19 12:25:32 +00:00
|
|
|
static inline void gpio_write(const GpioPin* gpio, const bool state) {
|
2020-10-26 07:16:54 +00:00
|
|
|
hal_gpio_write(gpio, state);
|
|
|
|
}
|
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/**
|
|
|
|
* Read value from GPIO
|
|
|
|
* @param gpio GpioPin instance
|
|
|
|
* @return false = LOW, true = HIGH
|
|
|
|
*/
|
2020-10-29 07:58:19 +00:00
|
|
|
static inline bool gpio_read(const GpioPin* gpio) {
|
2020-10-26 07:16:54 +00:00
|
|
|
return hal_gpio_read(gpio);
|
|
|
|
}
|
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/**
|
|
|
|
* Put GPIO to Z-state
|
|
|
|
* @param gpio_record GpioDisableRecord instance
|
|
|
|
*/
|
2020-10-26 07:16:54 +00:00
|
|
|
void gpio_disable(GpioDisableRecord* gpio_record);
|
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/**
|
|
|
|
* Get GPIO record
|
|
|
|
* @param name name of record
|
|
|
|
* @return ValueMutex instance
|
|
|
|
*/
|
2020-10-26 07:16:54 +00:00
|
|
|
ValueMutex* gpio_open_mutex(const char* name);
|
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/**
|
|
|
|
* Get GPIO record and acquire mutex
|
|
|
|
* @param name name of record
|
|
|
|
* @return GpioPin instance
|
|
|
|
*/
|
[FL-140] Core api dynamic records (#296)
* SYSTEM: tickless mode with deep sleep.
* Move FreeRTOS ticks to lptim2
* API: move all sumbodules init routines to one place. Timebase: working lptim2 at tick source.
* API Timebase: lp-timer routines, timer access safe zones prediction and synchronization. FreeRTOS: adjust configuration for tickless mode.
* NFC: support for tickless mode.
* API Timebase: improve tick error handling in IRQ. Apploader: use insomnia mode to run applications.
* BLE: prevent sleep while core2 starting
* HAL: nap while in insomnia mode
* init records work
* try to implement record delete
* tests and flapp
* flapp subsystem
* new core functions to get app stat, simplify core code
* fix thread termination
* add strdup to core
* fix tests
* Refactoring: remove all unusued parts, update API usage, aggreagate API sources and headers, new record storage
* Refactoring: update furi record api usage, cleanup code
* Fix broken merge for freertos apps
* Core, Target: fix compilation warnings
* Drop firmware target local
* HAL Timebase, Power, Clock: semaphore guarded access to clock and power modes, better sleep mode.
* SD-Filesystem: wait for all deps to arrive before adding widget. Core, BLE: disable debug dump to serial.
* delete old app example-ipc
* delete old app fatfs list
* fix strobe app, add input header
* delete old display driver
* comment old app qr-code
* fix sd-card test, add forced widget update
* remove unused new core test
* increase heap to 128k
* comment and assert old core tests
* fix syntax
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-01-20 16:09:26 +00:00
|
|
|
GpioPin* gpio_open(const char* name);
|
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/**
|
|
|
|
* Get RFID IN level
|
|
|
|
* @return false = LOW, true = HIGH
|
|
|
|
*/
|
2021-03-02 10:17:27 +00:00
|
|
|
bool get_rfid_in_level();
|
|
|
|
|
[FL-140] Core api dynamic records (#296)
* SYSTEM: tickless mode with deep sleep.
* Move FreeRTOS ticks to lptim2
* API: move all sumbodules init routines to one place. Timebase: working lptim2 at tick source.
* API Timebase: lp-timer routines, timer access safe zones prediction and synchronization. FreeRTOS: adjust configuration for tickless mode.
* NFC: support for tickless mode.
* API Timebase: improve tick error handling in IRQ. Apploader: use insomnia mode to run applications.
* BLE: prevent sleep while core2 starting
* HAL: nap while in insomnia mode
* init records work
* try to implement record delete
* tests and flapp
* flapp subsystem
* new core functions to get app stat, simplify core code
* fix thread termination
* add strdup to core
* fix tests
* Refactoring: remove all unusued parts, update API usage, aggreagate API sources and headers, new record storage
* Refactoring: update furi record api usage, cleanup code
* Fix broken merge for freertos apps
* Core, Target: fix compilation warnings
* Drop firmware target local
* HAL Timebase, Power, Clock: semaphore guarded access to clock and power modes, better sleep mode.
* SD-Filesystem: wait for all deps to arrive before adding widget. Core, BLE: disable debug dump to serial.
* delete old app example-ipc
* delete old app fatfs list
* fix strobe app, add input header
* delete old display driver
* comment old app qr-code
* fix sd-card test, add forced widget update
* remove unused new core test
* increase heap to 128k
* comment and assert old core tests
* fix syntax
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-01-20 16:09:26 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|