Skip to content
Snippets Groups Projects
Commit 47224cbc authored by Florian Kargl's avatar Florian Kargl
Browse files

Unmask portexpander button interrupts by default + prevent redundant interrupts between polling

parent eb8bc199
No related branches found
No related tags found
No related merge requests found
......@@ -123,6 +123,12 @@ int portexpander_init(void)
GPIO_IntEnable(&pe_int_pin);
NVIC_EnableIRQ((IRQn_Type)MXC_GPIO_GET_IRQ(pe_int_pin.port));
// Unmask portexpander interrupts
portexpander_int_enable(PE_INPUT_MASK);
// Clear existing interrupts
portexpander_in_get(0);
return E_SUCCESS;
}
......@@ -304,6 +310,8 @@ int portexpander_register_callback(
/* ************************************************************************** */
__attribute__((weak)) void portexpander_interrupt_callback(void *_)
{
GPIO_IntDisable(&pe_int_pin);
GPIO_IntClr(&pe_int_pin);
interrupt_pending = true;
}
......@@ -317,6 +325,8 @@ void portexpander_poll()
// Port read resets interrupts
uint8_t port_levels = portexpander_in_get(0xFF);
GPIO_IntEnable(&pe_int_pin);
for (uint8_t pin = 0; pin < 8; ++pin) {
if ((caused_by & (1 << pin)) && callbacks[pin]) {
gpio_int_pol_t edge_type =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment