diff options
Diffstat (limited to 'src/stm/ao_exti_stm.c')
-rw-r--r-- | src/stm/ao_exti_stm.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/stm/ao_exti_stm.c b/src/stm/ao_exti_stm.c index d54e6ee6..11099b02 100644 --- a/src/stm/ao_exti_stm.c +++ b/src/stm/ao_exti_stm.c @@ -116,6 +116,20 @@ ao_exti_setup (struct stm_gpio *gpio, uint8_t pin, uint8_t mode, void (*callback } void +ao_exti_set_mode(struct stm_gpio *gpio, uint8_t pin, uint8_t mode) { + uint32_t mask = 1 << pin; + + if (mode & AO_EXTI_MODE_RISING) + stm_exti.rtsr |= mask; + else + stm_exti.rtsr &= ~mask; + if (mode & AO_EXTI_MODE_FALLING) + stm_exti.ftsr |= mask; + else + stm_exti.ftsr &= ~mask; +} + +void ao_exti_set_callback(struct stm_gpio *gpio, uint8_t pin, void (*callback)()) { ao_exti_callback[pin] = callback; } |