Hi,
In my application during the application’s initialization, I want to configure a specific gpio as an input signal and keep it that way.
Then later when my application is in a certain state(starts performing a specific operation) I then am interested in receiving an interrupt whenever this gpio is asserted (logic level high). At this time I want to retain all the configuration that I had done before and just enable a level high interrupt for this gpio.
Then when the application exits this state I want to disable the interrupts on this gpio.
Is the following flow of code a valid flow?
/// When the application is initializing, I just want to configure the gpio as an input
uIo ioDataRequest = COLIBRI_PIN(79);
if(!Imx7Gpio_SetConfigString( hGPIO, ioDataRequest, NULL, L"AltFn=5,dir=in,pull=down100k", StoreVolatile)) {
LOG_ERROR("\nERROR, [%s, %d], Failed to initialize the interrupt gpio", __FUNCTION__, __LINE__ );
return ERROR_INIT_FAILED;
}
/// Later when I want the pin to raise and interrupt request, update the pin configuration, by just setting in the interrupt trigger. Is below a valid way of enabling the interrupts on this gpio, since all other configuration was already in place.
if(!Imx7Gpio_SetConfigString( hGPIO, ioDataRequest, NULL, L"irqtrig=high", StoreVolatile)) {
LOG_ERROR("\nERROR, [%s, %d], Failed to initialize the interrupt gpio", __FUNCTION__, __LINE__ );
return ERROR_INTERRUPT_CONFIG;
}
//// Once the job with the interrupts is done .. how to disable the interrupt trigger .. the config string parameter irqtrig has no value to disable the interrupts on a gpio
Further, I understand that since I am configuring the gpio for level triggered interrupt, so even after I process the interrupt and call InterruptDone(), the event mapped with this sysIntr would again be set by the underlying system. Is my understanding correct? Is there a way to tell the OS that I want an interrupt again when this pin toggles twice and the pin attains high level again? I want to avoid changing the interrupt level to low and be interrupted when the signal is de-asserted and again change the interrupt trigger level to high to achieve this.
If I configure the gpio to raise an interrupt on the rising edge, I would achieve this. But a level triggered interrupt might help in filtering out any short spikes, which in case of an edge interrupt would set the IST running.
Thanks