#include #include #ifndef EXTI_H #define EXTI_H typedef struct { EXTI_TypeDef* exti; SYSCFG_TypeDef* syscfg; } exti_t; exti_t* exti_init(EXTI_TypeDef* exti, SYSCFG_TypeDef* syscfg); void exti_external_interrupt(exti_t* exti, uint8_t line, uint8_t gpio); // Only 21 positions are now supported. This is too hard for other ones. /** * @brief Set the exti line to send an interrupt on rising edge. * @details Valid for external EXTI interrupts. The interrupt will be triggered on rising interrupt * @param[in,out] exti The exti line descriptor */ void exti_rising_interrupt(exti_t* exti, uint8_t line); /** * @brief Set the exti line to send an interrupt on falling edge. * @details Valid for external EXTI interrupts. The interrupt will be triggered on falling interrupt * @param[in,out] exti The exti line descriptor */ void exti_falling_interrupt(exti_t* exti, uint8_t line); /** * @brief Mask the interrupt for given exti line. * @details Description * @param[in,out] exti The exti line descriptor */ void exti_disable_interrupt(exti_t* exti, uint8_t line); /** * @brief Enable the nvic interrupt * @param[in,out] exti The exti line descriptor */ void exti_nvic_setup(exti_t* exti, uint8_t line); #endif // EXTI_H