While working on a current project i’ve faced an issue with code reuse. Espressif sdk allows only one interrupt handler for all GPIOs. That’s fine for monolithic code but since we like modular code a dispatcher comes handy.
The little inconvenience i’ve had was like this. I wanted to use the drivers/key.c code but it does use the data argument , so i’ve had to modify it to use a global variable. So i can call it from my own interrupt handler. And that is ugly.
So the lab have a brand new GitHub Account – where i’ll share code.
And the remedy for the issue – new project: esp8266_easyintr .
May need a tweek or two. I’ve extracted it from a wip project.
ei_init(); // init easy interrupts
ei_attach(GPIO_NUM, GPIO_MUX, GPIO_FUNC, module_isr, module_data); // setup handler
You can attach only one per GPIO . You will get your data at the isr and you can have a proper code separation.