3a6fbff8c3
* Core, API: add externs for c++ * Makefile: improve debug speed, flash with openocd, cleanup f2 config * Power: add cli diagnostic. * Local: fix api hal externs * Local: fix externs in main and flipper_hal * F2: power state dump stabs * Bootloader flashing with openocd * F3: move bq drivers to libs * temporary do not build drivers on local * temporary do not build drivers on f2 Co-authored-by: aanper <mail@s3f.ru>
64 lines
1.1 KiB
C
64 lines
1.1 KiB
C
#pragma once
|
|
#include "main.h"
|
|
#include "stdbool.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
// hw-api
|
|
|
|
typedef char GPIO_TypeDef;
|
|
|
|
typedef enum {
|
|
GpioModeInput,
|
|
GpioModeOutputPushPull,
|
|
GpioModeOutputOpenDrain,
|
|
GpioModeAltFunctionPushPull,
|
|
GpioModeAltFunctionOpenDrain,
|
|
GpioModeAnalog,
|
|
GpioModeInterruptRise,
|
|
GpioModeInterruptFall,
|
|
GpioModeInterruptRiseFall,
|
|
GpioModeEventRise,
|
|
GpioModeEventFall,
|
|
GpioModeEventRiseFall,
|
|
} GpioMode;
|
|
|
|
typedef enum {
|
|
GpioSpeedLow,
|
|
GpioSpeedMedium,
|
|
GpioSpeedHigh,
|
|
GpioSpeedVeryHigh,
|
|
} GpioSpeed;
|
|
|
|
typedef enum {
|
|
GpioPullNo,
|
|
GpioPullUp,
|
|
GpioPullDown,
|
|
} GpioPull;
|
|
|
|
typedef struct {
|
|
GPIO_TypeDef* port;
|
|
uint16_t pin;
|
|
} GpioPin;
|
|
|
|
// init GPIO
|
|
void hal_gpio_init(
|
|
const GpioPin* gpio,
|
|
const GpioMode mode,
|
|
const GpioPull pull,
|
|
const GpioSpeed speed);
|
|
|
|
// write value to GPIO, false = LOW, true = HIGH
|
|
void hal_gpio_write(const GpioPin* gpio, const bool state);
|
|
|
|
// read value from GPIO, false = LOW, true = HIGH
|
|
bool hal_gpio_read(const GpioPin* gpio);
|
|
|
|
void enable_cc1101_irq();
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|