1 #pragma once 2 3 #include <stdbool.h> 4 #include <stm32f0xx.h> 5 6 typedef enum { 7 #ifdef SYSCFG_EXTICR1_EXTI0_PA 8 EXT_INTERRUPT_PORT_A = SYSCFG_EXTICR1_EXTI0_PA, 9 #endif 10 #ifdef SYSCFG_EXTICR1_EXTI0_PB 11 EXT_INTERRUPT_PORT_B = SYSCFG_EXTICR1_EXTI0_PB, 12 #endif 13 #ifdef SYSCFG_EXTICR1_EXTI0_PC 14 EXT_INTERRUPT_PORT_C = SYSCFG_EXTICR1_EXTI0_PC, 15 #endif 16 #ifdef SYSCFG_EXTICR1_EXTI0_PD 17 EXT_INTERRUPT_PORT_D = SYSCFG_EXTICR1_EXTI0_PD, 18 #endif 19 #ifdef SYSCFG_EXTICR1_EXTI0_PE 20 EXT_INTERRUPT_PORT_E = SYSCFG_EXTICR1_EXTI0_PE, 21 #endif 22 #ifdef SYSCFG_EXTICR1_EXTI0_PF 23 EXT_INTERRUPT_PORT_F = SYSCFG_EXTICR1_EXTI0_PF, 24 #endif 25 } stm32_ext_interrupt_port_t; 26 27 void stm32_setup_ext_interrupt(int interrupt, stm32_ext_interrupt_port_t port, 28 bool rising_edge, bool falling_edge); 29 30 // Define these in your target code to override the weak, no-op default 31 // handlers. These should return true if lk should reschedule after handling. 32 bool stm32_exti0_irq(void); 33 bool stm32_exti1_irq(void); 34 bool stm32_exti2_irq(void); 35 bool stm32_exti3_irq(void); 36 bool stm32_exti4_irq(void); 37 bool stm32_exti5_irq(void); 38 bool stm32_exti6_irq(void); 39 bool stm32_exti7_irq(void); 40 bool stm32_exti8_irq(void); 41 bool stm32_exti9_irq(void); 42 bool stm32_exti10_irq(void); 43 bool stm32_exti11_irq(void); 44 bool stm32_exti12_irq(void); 45 bool stm32_exti13_irq(void); 46 bool stm32_exti14_irq(void); 47 bool stm32_exti15_irq(void); 48 49