Allow the GPIO HAL to enable corresponding port interrupt on the NVIC

This commit is contained in:
George Oikonomou 2018-03-11 23:29:57 +00:00
parent 5f190be6c9
commit 7bf6679806
2 changed files with 5 additions and 2 deletions

View File

@ -87,6 +87,7 @@ gpio_hal_arch_pin_cfg_set(gpio_hal_pin_t pin, gpio_hal_pin_cfg_t cfg)
GPIO_DISABLE_INTERRUPT(port_base, pin_mask);
} else if(tmp == GPIO_HAL_PIN_CFG_INT_ENABLE) {
GPIO_ENABLE_INTERRUPT(port_base, pin_mask);
NVIC_EnableIRQ(port);
}
GPIO_SOFTWARE_CONTROL(port_base, pin_mask);

View File

@ -55,8 +55,10 @@
#define PIN_TO_PORT(pin) (pin >> 3)
#define PIN_TO_PORT_BASE(pin) GPIO_PORT_TO_BASE(PIN_TO_PORT(pin))
/*---------------------------------------------------------------------------*/
#define gpio_hal_arch_interrupt_enable(p) \
GPIO_ENABLE_INTERRUPT(PIN_TO_PORT_BASE(p), GPIO_PIN_MASK((p) % 8))
#define gpio_hal_arch_interrupt_enable(p) do { \
GPIO_ENABLE_INTERRUPT(PIN_TO_PORT_BASE(p), GPIO_PIN_MASK((p) % 8)); \
NVIC_EnableIRQ(PIN_TO_PORT(p)); \
} while(0);
#define gpio_hal_arch_interrupt_disable(p) \
GPIO_DISABLE_INTERRUPT(PIN_TO_PORT_BASE(p), GPIO_PIN_MASK((p) % 8))