Proper way to handle GPIO IRQ enablement
Lincoln Simmons
Hi, I'm attempting to use the Zephyr GPIO API for the first time. It seems full featured, but I think this has caused me some confusion. I was debugging my application and found that I got stuck in an infinite loop in _gpio_fire_callbacks(). (For what it's worth, I'm using an nRF52832 chip, so this was called from gpio_nrfx.c)
I am trying to interface with an IRQ pin on a peripheral, so I wrote a couple of enable/disable functions for my driver that look similar to this: https://gist.github.com/Lncn/49174feb32c2d96dc4e82924b6163c8f This code was ported from another platform & RTOS where I simply reconfigured the pin entirely when enabling/disabling the device IRQ. In hindsight this may have been heavy handed. I was unknowingly calling my "x_enable_irq" function twice in the process of initializing my application and I think this caused my infinite loop. It appears you cannot call gpio_add_callback twice with the same callback struct, as sys_slist_prepend() will create a circular linked list if the struct gpio_callback reference is already in the list. Knowing this, I have a couple of questions:
Thanks, Lincoln Simmons lincolnsimmons@...
|
|