2021-05-18 09:23:14 +00:00
|
|
|
#include <furi.h>
|
2022-01-05 16:10:18 +00:00
|
|
|
#include <furi_hal_gpio.h>
|
|
|
|
#include <furi_hal_version.h>
|
2023-02-08 05:40:44 +00:00
|
|
|
#include <furi_hal_resources.h>
|
2022-03-23 17:59:20 +00:00
|
|
|
#include <stm32wbxx_ll_comp.h>
|
2023-12-12 14:39:14 +00:00
|
|
|
#include <stm32wbxx_ll_pwr.h>
|
2021-05-18 09:23:14 +00:00
|
|
|
|
2023-12-12 14:39:14 +00:00
|
|
|
static uint32_t furi_hal_gpio_invalid_argument_crash() {
|
|
|
|
furi_crash("Invalid argument");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define GPIO_PORT_MAP(port, prefix) \
|
|
|
|
(((port) == (GPIOA)) ? prefix##A : \
|
|
|
|
((port) == (GPIOB)) ? prefix##B : \
|
|
|
|
((port) == (GPIOC)) ? prefix##C : \
|
|
|
|
((port) == (GPIOD)) ? prefix##D : \
|
|
|
|
((port) == (GPIOE)) ? prefix##E : \
|
|
|
|
((port) == (GPIOH)) ? prefix##H : \
|
|
|
|
furi_hal_gpio_invalid_argument_crash())
|
2021-05-18 09:23:14 +00:00
|
|
|
|
|
|
|
#define GPIO_PIN_MAP(pin, prefix) \
|
|
|
|
(((pin) == (LL_GPIO_PIN_0)) ? prefix##0 : \
|
|
|
|
((pin) == (LL_GPIO_PIN_1)) ? prefix##1 : \
|
|
|
|
((pin) == (LL_GPIO_PIN_2)) ? prefix##2 : \
|
|
|
|
((pin) == (LL_GPIO_PIN_3)) ? prefix##3 : \
|
|
|
|
((pin) == (LL_GPIO_PIN_4)) ? prefix##4 : \
|
|
|
|
((pin) == (LL_GPIO_PIN_5)) ? prefix##5 : \
|
|
|
|
((pin) == (LL_GPIO_PIN_6)) ? prefix##6 : \
|
|
|
|
((pin) == (LL_GPIO_PIN_7)) ? prefix##7 : \
|
|
|
|
((pin) == (LL_GPIO_PIN_8)) ? prefix##8 : \
|
|
|
|
((pin) == (LL_GPIO_PIN_9)) ? prefix##9 : \
|
|
|
|
((pin) == (LL_GPIO_PIN_10)) ? prefix##10 : \
|
|
|
|
((pin) == (LL_GPIO_PIN_11)) ? prefix##11 : \
|
|
|
|
((pin) == (LL_GPIO_PIN_12)) ? prefix##12 : \
|
|
|
|
((pin) == (LL_GPIO_PIN_13)) ? prefix##13 : \
|
|
|
|
((pin) == (LL_GPIO_PIN_14)) ? prefix##14 : \
|
2023-12-12 14:39:14 +00:00
|
|
|
((pin) == (LL_GPIO_PIN_15)) ? prefix##15 : \
|
|
|
|
furi_hal_gpio_invalid_argument_crash())
|
2021-05-18 09:23:14 +00:00
|
|
|
|
2023-12-12 14:39:14 +00:00
|
|
|
#define GET_SYSCFG_EXTI_PORT(port) GPIO_PORT_MAP(port, LL_SYSCFG_EXTI_PORT)
|
2021-05-18 09:23:14 +00:00
|
|
|
#define GET_SYSCFG_EXTI_LINE(pin) GPIO_PIN_MAP(pin, LL_SYSCFG_EXTI_LINE)
|
|
|
|
#define GET_EXTI_LINE(pin) GPIO_PIN_MAP(pin, LL_EXTI_LINE_)
|
|
|
|
|
2023-12-12 14:39:14 +00:00
|
|
|
#define GET_PWR_PORT(port) GPIO_PORT_MAP(port, LL_PWR_GPIO_)
|
|
|
|
#define GET_PWR_PIN(pin) GPIO_PIN_MAP(pin, LL_PWR_GPIO_BIT_)
|
|
|
|
|
2021-05-18 09:23:14 +00:00
|
|
|
static volatile GpioInterrupt gpio_interrupt[GPIO_NUMBER];
|
|
|
|
|
2022-03-30 15:23:40 +00:00
|
|
|
static uint8_t furi_hal_gpio_get_pin_num(const GpioPin* gpio) {
|
2021-05-18 09:23:14 +00:00
|
|
|
uint8_t pin_num = 0;
|
|
|
|
for(pin_num = 0; pin_num < GPIO_NUMBER; pin_num++) {
|
|
|
|
if(gpio->pin & (1 << pin_num)) break;
|
|
|
|
}
|
|
|
|
return pin_num;
|
|
|
|
}
|
|
|
|
|
2022-03-30 15:23:40 +00:00
|
|
|
void furi_hal_gpio_init_simple(const GpioPin* gpio, const GpioMode mode) {
|
|
|
|
furi_hal_gpio_init(gpio, mode, GpioPullNo, GpioSpeedLow);
|
2021-05-24 09:57:14 +00:00
|
|
|
}
|
|
|
|
|
2022-03-30 15:23:40 +00:00
|
|
|
void furi_hal_gpio_init(
|
2021-05-18 09:23:14 +00:00
|
|
|
const GpioPin* gpio,
|
|
|
|
const GpioMode mode,
|
|
|
|
const GpioPull pull,
|
|
|
|
const GpioSpeed speed) {
|
2021-05-24 09:57:14 +00:00
|
|
|
// we cannot set alternate mode in this function
|
2023-04-06 02:19:39 +00:00
|
|
|
furi_check(mode != GpioModeAltFunctionPushPull);
|
|
|
|
furi_check(mode != GpioModeAltFunctionOpenDrain);
|
2021-05-24 09:57:14 +00:00
|
|
|
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_init_ex(gpio, mode, pull, speed, GpioAltFnUnused);
|
2021-05-24 09:57:14 +00:00
|
|
|
}
|
|
|
|
|
2022-03-30 15:23:40 +00:00
|
|
|
void furi_hal_gpio_init_ex(
|
2021-05-24 09:57:14 +00:00
|
|
|
const GpioPin* gpio,
|
|
|
|
const GpioMode mode,
|
|
|
|
const GpioPull pull,
|
|
|
|
const GpioSpeed speed,
|
|
|
|
const GpioAltFn alt_fn) {
|
2023-12-12 14:39:14 +00:00
|
|
|
const uint32_t sys_exti_port = GET_SYSCFG_EXTI_PORT(gpio->port);
|
|
|
|
const uint32_t sys_exti_line = GET_SYSCFG_EXTI_LINE(gpio->pin);
|
|
|
|
const uint32_t exti_line = GET_EXTI_LINE(gpio->pin);
|
|
|
|
const uint32_t pwr_port = GET_PWR_PORT(gpio->port);
|
|
|
|
const uint32_t pwr_pin = GET_PWR_PIN(gpio->pin);
|
2021-05-18 09:23:14 +00:00
|
|
|
|
|
|
|
// Configure gpio with interrupts disabled
|
2022-02-10 11:20:50 +00:00
|
|
|
FURI_CRITICAL_ENTER();
|
|
|
|
|
2021-05-18 09:23:14 +00:00
|
|
|
// Set gpio speed
|
2022-02-10 11:20:50 +00:00
|
|
|
switch(speed) {
|
|
|
|
case GpioSpeedLow:
|
2021-05-18 09:23:14 +00:00
|
|
|
LL_GPIO_SetPinSpeed(gpio->port, gpio->pin, LL_GPIO_SPEED_FREQ_LOW);
|
2022-02-10 11:20:50 +00:00
|
|
|
break;
|
|
|
|
case GpioSpeedMedium:
|
2021-05-18 09:23:14 +00:00
|
|
|
LL_GPIO_SetPinSpeed(gpio->port, gpio->pin, LL_GPIO_SPEED_FREQ_MEDIUM);
|
2022-02-10 11:20:50 +00:00
|
|
|
break;
|
|
|
|
case GpioSpeedHigh:
|
2021-05-18 09:23:14 +00:00
|
|
|
LL_GPIO_SetPinSpeed(gpio->port, gpio->pin, LL_GPIO_SPEED_FREQ_HIGH);
|
2022-02-10 11:20:50 +00:00
|
|
|
break;
|
|
|
|
case GpioSpeedVeryHigh:
|
2021-05-18 09:23:14 +00:00
|
|
|
LL_GPIO_SetPinSpeed(gpio->port, gpio->pin, LL_GPIO_SPEED_FREQ_VERY_HIGH);
|
2022-02-10 11:20:50 +00:00
|
|
|
break;
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
2022-02-10 11:20:50 +00:00
|
|
|
|
2021-05-18 09:23:14 +00:00
|
|
|
// Set gpio pull mode
|
2022-02-10 11:20:50 +00:00
|
|
|
switch(pull) {
|
|
|
|
case GpioPullNo:
|
2021-05-18 09:23:14 +00:00
|
|
|
LL_GPIO_SetPinPull(gpio->port, gpio->pin, LL_GPIO_PULL_NO);
|
2023-12-12 14:39:14 +00:00
|
|
|
LL_PWR_DisableGPIOPullUp(pwr_port, pwr_pin);
|
|
|
|
LL_PWR_DisableGPIOPullDown(pwr_port, pwr_pin);
|
2022-02-10 11:20:50 +00:00
|
|
|
break;
|
|
|
|
case GpioPullUp:
|
2021-05-18 09:23:14 +00:00
|
|
|
LL_GPIO_SetPinPull(gpio->port, gpio->pin, LL_GPIO_PULL_UP);
|
2023-12-12 14:39:14 +00:00
|
|
|
LL_PWR_DisableGPIOPullDown(pwr_port, pwr_pin);
|
|
|
|
LL_PWR_EnableGPIOPullUp(pwr_port, pwr_pin);
|
2022-02-10 11:20:50 +00:00
|
|
|
break;
|
|
|
|
case GpioPullDown:
|
2021-05-18 09:23:14 +00:00
|
|
|
LL_GPIO_SetPinPull(gpio->port, gpio->pin, LL_GPIO_PULL_DOWN);
|
2023-12-12 14:39:14 +00:00
|
|
|
LL_PWR_DisableGPIOPullUp(pwr_port, pwr_pin);
|
|
|
|
LL_PWR_EnableGPIOPullDown(pwr_port, pwr_pin);
|
2022-02-10 11:20:50 +00:00
|
|
|
break;
|
2023-12-12 14:39:14 +00:00
|
|
|
default:
|
|
|
|
furi_crash("Incorrect GpioPull");
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
2022-02-10 11:20:50 +00:00
|
|
|
|
2021-05-18 09:23:14 +00:00
|
|
|
// Set gpio mode
|
|
|
|
if(mode >= GpioModeInterruptRise) {
|
|
|
|
// Set pin in interrupt mode
|
|
|
|
LL_GPIO_SetPinMode(gpio->port, gpio->pin, LL_GPIO_MODE_INPUT);
|
|
|
|
LL_SYSCFG_SetEXTISource(sys_exti_port, sys_exti_line);
|
|
|
|
if(mode == GpioModeInterruptRise || mode == GpioModeInterruptRiseFall) {
|
|
|
|
LL_EXTI_EnableRisingTrig_0_31(exti_line);
|
|
|
|
}
|
|
|
|
if(mode == GpioModeInterruptFall || mode == GpioModeInterruptRiseFall) {
|
|
|
|
LL_EXTI_EnableFallingTrig_0_31(exti_line);
|
|
|
|
}
|
2022-02-10 11:20:50 +00:00
|
|
|
if(mode == GpioModeEventRise || mode == GpioModeEventRiseFall) {
|
2021-05-18 09:23:14 +00:00
|
|
|
LL_EXTI_EnableEvent_0_31(exti_line);
|
|
|
|
LL_EXTI_EnableRisingTrig_0_31(exti_line);
|
|
|
|
}
|
2022-02-10 11:20:50 +00:00
|
|
|
if(mode == GpioModeEventFall || mode == GpioModeEventRiseFall) {
|
2021-05-18 09:23:14 +00:00
|
|
|
LL_EXTI_EnableEvent_0_31(exti_line);
|
|
|
|
LL_EXTI_EnableFallingTrig_0_31(exti_line);
|
|
|
|
}
|
|
|
|
} else {
|
2022-02-10 11:20:50 +00:00
|
|
|
// Disable interrupts if set
|
2021-05-18 09:23:14 +00:00
|
|
|
if(LL_SYSCFG_GetEXTISource(sys_exti_line) == sys_exti_port &&
|
|
|
|
LL_EXTI_IsEnabledIT_0_31(exti_line)) {
|
|
|
|
LL_EXTI_DisableIT_0_31(exti_line);
|
2024-02-07 09:09:29 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(exti_line);
|
2021-05-18 09:23:14 +00:00
|
|
|
LL_EXTI_DisableRisingTrig_0_31(exti_line);
|
|
|
|
LL_EXTI_DisableFallingTrig_0_31(exti_line);
|
|
|
|
}
|
2022-02-10 11:20:50 +00:00
|
|
|
|
|
|
|
// Prepare alternative part if any
|
|
|
|
if(mode == GpioModeAltFunctionPushPull || mode == GpioModeAltFunctionOpenDrain) {
|
|
|
|
// set alternate function
|
2022-03-30 15:23:40 +00:00
|
|
|
if(furi_hal_gpio_get_pin_num(gpio) < 8) {
|
2022-02-10 11:20:50 +00:00
|
|
|
LL_GPIO_SetAFPin_0_7(gpio->port, gpio->pin, alt_fn);
|
|
|
|
} else {
|
|
|
|
LL_GPIO_SetAFPin_8_15(gpio->port, gpio->pin, alt_fn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-18 09:23:14 +00:00
|
|
|
// Set not interrupt pin modes
|
2022-02-10 11:20:50 +00:00
|
|
|
switch(mode) {
|
|
|
|
case GpioModeInput:
|
2021-05-18 09:23:14 +00:00
|
|
|
LL_GPIO_SetPinMode(gpio->port, gpio->pin, LL_GPIO_MODE_INPUT);
|
2022-02-10 11:20:50 +00:00
|
|
|
break;
|
|
|
|
case GpioModeOutputPushPull:
|
|
|
|
LL_GPIO_SetPinOutputType(gpio->port, gpio->pin, LL_GPIO_OUTPUT_PUSHPULL);
|
2021-05-18 09:23:14 +00:00
|
|
|
LL_GPIO_SetPinMode(gpio->port, gpio->pin, LL_GPIO_MODE_OUTPUT);
|
2022-02-10 11:20:50 +00:00
|
|
|
break;
|
|
|
|
case GpioModeAltFunctionPushPull:
|
2021-05-18 09:23:14 +00:00
|
|
|
LL_GPIO_SetPinOutputType(gpio->port, gpio->pin, LL_GPIO_OUTPUT_PUSHPULL);
|
2022-02-10 11:20:50 +00:00
|
|
|
LL_GPIO_SetPinMode(gpio->port, gpio->pin, LL_GPIO_MODE_ALTERNATE);
|
|
|
|
break;
|
|
|
|
case GpioModeOutputOpenDrain:
|
|
|
|
LL_GPIO_SetPinOutputType(gpio->port, gpio->pin, LL_GPIO_OUTPUT_OPENDRAIN);
|
2021-05-18 09:23:14 +00:00
|
|
|
LL_GPIO_SetPinMode(gpio->port, gpio->pin, LL_GPIO_MODE_OUTPUT);
|
2022-02-10 11:20:50 +00:00
|
|
|
break;
|
|
|
|
case GpioModeAltFunctionOpenDrain:
|
2021-05-18 09:23:14 +00:00
|
|
|
LL_GPIO_SetPinOutputType(gpio->port, gpio->pin, LL_GPIO_OUTPUT_OPENDRAIN);
|
2022-02-10 11:20:50 +00:00
|
|
|
LL_GPIO_SetPinMode(gpio->port, gpio->pin, LL_GPIO_MODE_ALTERNATE);
|
|
|
|
break;
|
|
|
|
case GpioModeAnalog:
|
2021-05-18 09:23:14 +00:00
|
|
|
LL_GPIO_SetPinMode(gpio->port, gpio->pin, LL_GPIO_MODE_ANALOG);
|
2022-02-10 11:20:50 +00:00
|
|
|
break;
|
|
|
|
default:
|
2023-12-12 14:39:14 +00:00
|
|
|
furi_crash("Incorrect GpioMode");
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
}
|
2022-02-10 11:20:50 +00:00
|
|
|
FURI_CRITICAL_EXIT();
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
|
2022-03-30 15:23:40 +00:00
|
|
|
void furi_hal_gpio_add_int_callback(const GpioPin* gpio, GpioExtiCallback cb, void* ctx) {
|
2021-05-18 09:23:14 +00:00
|
|
|
furi_assert(gpio);
|
|
|
|
furi_assert(cb);
|
|
|
|
|
2022-02-10 11:20:50 +00:00
|
|
|
FURI_CRITICAL_ENTER();
|
2024-02-07 09:09:29 +00:00
|
|
|
|
2022-03-30 15:23:40 +00:00
|
|
|
uint8_t pin_num = furi_hal_gpio_get_pin_num(gpio);
|
2023-04-06 02:19:39 +00:00
|
|
|
furi_check(gpio_interrupt[pin_num].callback == NULL);
|
2021-05-18 09:23:14 +00:00
|
|
|
gpio_interrupt[pin_num].callback = cb;
|
|
|
|
gpio_interrupt[pin_num].context = ctx;
|
2024-02-07 09:09:29 +00:00
|
|
|
|
|
|
|
const uint32_t exti_line = GET_EXTI_LINE(gpio->pin);
|
|
|
|
LL_EXTI_EnableIT_0_31(exti_line);
|
|
|
|
|
2022-02-10 11:20:50 +00:00
|
|
|
FURI_CRITICAL_EXIT();
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
|
2022-03-30 15:23:40 +00:00
|
|
|
void furi_hal_gpio_enable_int_callback(const GpioPin* gpio) {
|
2021-05-18 09:23:14 +00:00
|
|
|
furi_assert(gpio);
|
|
|
|
|
2022-02-10 11:20:50 +00:00
|
|
|
FURI_CRITICAL_ENTER();
|
2024-02-07 09:09:29 +00:00
|
|
|
|
2024-02-14 02:37:04 +00:00
|
|
|
const uint32_t exti_line = GET_EXTI_LINE(gpio->pin);
|
|
|
|
LL_EXTI_EnableIT_0_31(exti_line);
|
2024-02-07 09:09:29 +00:00
|
|
|
|
2022-02-10 11:20:50 +00:00
|
|
|
FURI_CRITICAL_EXIT();
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
|
2022-03-30 15:23:40 +00:00
|
|
|
void furi_hal_gpio_disable_int_callback(const GpioPin* gpio) {
|
2021-05-18 09:23:14 +00:00
|
|
|
furi_assert(gpio);
|
|
|
|
|
2022-02-10 11:20:50 +00:00
|
|
|
FURI_CRITICAL_ENTER();
|
2024-02-07 09:09:29 +00:00
|
|
|
|
|
|
|
const uint32_t exti_line = GET_EXTI_LINE(gpio->pin);
|
|
|
|
LL_EXTI_DisableIT_0_31(exti_line);
|
|
|
|
LL_EXTI_ClearFlag_0_31(exti_line);
|
|
|
|
|
2022-02-10 11:20:50 +00:00
|
|
|
FURI_CRITICAL_EXIT();
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
|
2022-03-30 15:23:40 +00:00
|
|
|
void furi_hal_gpio_remove_int_callback(const GpioPin* gpio) {
|
2021-05-18 09:23:14 +00:00
|
|
|
furi_assert(gpio);
|
|
|
|
|
2022-02-10 11:20:50 +00:00
|
|
|
FURI_CRITICAL_ENTER();
|
2024-02-07 09:09:29 +00:00
|
|
|
|
|
|
|
const uint32_t exti_line = GET_EXTI_LINE(gpio->pin);
|
|
|
|
LL_EXTI_DisableIT_0_31(exti_line);
|
|
|
|
LL_EXTI_ClearFlag_0_31(exti_line);
|
|
|
|
|
2022-03-30 15:23:40 +00:00
|
|
|
uint8_t pin_num = furi_hal_gpio_get_pin_num(gpio);
|
2021-05-18 09:23:14 +00:00
|
|
|
gpio_interrupt[pin_num].callback = NULL;
|
|
|
|
gpio_interrupt[pin_num].context = NULL;
|
2024-02-07 09:09:29 +00:00
|
|
|
|
2022-02-10 11:20:50 +00:00
|
|
|
FURI_CRITICAL_EXIT();
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
|
2024-02-07 09:09:29 +00:00
|
|
|
FURI_ALWAYS_STATIC_INLINE void furi_hal_gpio_int_call(uint16_t pin_num) {
|
|
|
|
if(gpio_interrupt[pin_num].callback) {
|
2021-05-18 09:23:14 +00:00
|
|
|
gpio_interrupt[pin_num].callback(gpio_interrupt[pin_num].context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Interrupt handlers */
|
|
|
|
void EXTI0_IRQHandler(void) {
|
|
|
|
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_0)) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_int_call(0);
|
2023-02-08 05:40:44 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_0);
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EXTI1_IRQHandler(void) {
|
|
|
|
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_1)) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_int_call(1);
|
2023-02-08 05:40:44 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_1);
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EXTI2_IRQHandler(void) {
|
|
|
|
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_2)) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_int_call(2);
|
2023-02-08 05:40:44 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_2);
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EXTI3_IRQHandler(void) {
|
|
|
|
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_3)) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_int_call(3);
|
2023-02-08 05:40:44 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_3);
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EXTI4_IRQHandler(void) {
|
|
|
|
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_4)) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_int_call(4);
|
2023-02-08 05:40:44 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_4);
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EXTI9_5_IRQHandler(void) {
|
|
|
|
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_5)) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_int_call(5);
|
2023-02-08 05:40:44 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_5);
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_6)) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_int_call(6);
|
2023-02-08 05:40:44 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_6);
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_7)) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_int_call(7);
|
2023-02-08 05:40:44 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_7);
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_8)) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_int_call(8);
|
2023-02-08 05:40:44 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_8);
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_9)) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_int_call(9);
|
2023-02-08 05:40:44 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_9);
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EXTI15_10_IRQHandler(void) {
|
|
|
|
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_10)) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_int_call(10);
|
2023-02-08 05:40:44 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_10);
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_11)) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_int_call(11);
|
2023-02-08 05:40:44 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_11);
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_12)) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_int_call(12);
|
2023-02-08 05:40:44 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_12);
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_13)) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_int_call(13);
|
2023-02-08 05:40:44 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_13);
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_14)) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_int_call(14);
|
2023-02-08 05:40:44 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_14);
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_15)) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_int_call(15);
|
2023-02-08 05:40:44 +00:00
|
|
|
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_15);
|
2021-05-18 09:23:14 +00:00
|
|
|
}
|
|
|
|
}
|