Community
cancel
Showing results for 
Search instead for 
Did you mean: 
RBulh
New Contributor I
2,146 Views

Intel Edison MCU API - How to unregister a interrupt handler?

How to unregister a interrupt handler?

I need to catch the first pulse and then, I must disable the interrupt to happens.

How could I do that? On MCU API documentation there is only:

int gpio_register_interrupt(int gpio, int mode, irq_handler_t isr);

...where:

gpio: GPIO port number

mode: 0 = falling edge interrupt, 1 = rising edge interrupt

isr: interrupt handler function

Return value: 0 if successful

I've already try to point the irq_handler_t to 0, but doesn't work.

0 Kudos
7 Replies
idata
Community Manager
134 Views

Hi rbulha,

 

I'm not aware of any command to disable or unregister an interrupt. It would be necessary to see if the processor has an interrupt flag and try to set that flag to 0 once the interrupt has been triggered. Another option would be to set a Boolean variable, so you can set initialize this variable as False and once the interrupt has been triggered you should set this variable to True, so the next time it would skip it.

 

Something similar to this:

If (x=FALSE)

 

Proceed with interrupt handler;

 

x = TRUE;

 

Else

 

Skip Interrupt and continue;

Regards,

 

-Pablo
RBulh
New Contributor I
134 Views

Hi Pablo,

Thanks for the answer. The flag approach I'm already using, but if I could set the interrupt flag would be better! How could I configure the processor registers? Is there a documentation and an API to do so? Or, at least, an address mapping for those registers that we could use to write on they?

Regards,

Rogerio Bulha

idata
Community Manager
134 Views

Hi rbulha,

 

 

The documentation for the API is all in here https://software.intel.com/en-us/node/557355 https://software.intel.com/en-us/node/557355. However, we'll investigate to see if we can found a way to unregister this interrupt in a cleaner way. We'll get back to you as soon as we have some updates.

 

 

Regards,

 

-Pablo
idata
Community Manager
134 Views

Hi rbulha,

 

 

I was thinking that it would be a good idea to check the library and see how the interrupt is being set, so in theory, to disable it you should just "go in reverse", by this I mean to undo what's being done to set this interrupt. Have you considered doing this?

 

 

Regards,

 

-Pablo
RBulh
New Contributor I
134 Views

Hi Pablo,

I don't know how to "go in reverse". Do you mean calling the interface again? I've tried to call passing null as the handler, but the interruption still happens:

gpio_register_interrupt(int gpio, int mode, irq_handler_t isr);

gpio_register_interrupt(165, 0, sensor_irq); /* define the ISR on GPIO 165 on falling edge = 0 */

To disable I've tried to:

gpio_register_interrupt(165, 0, NULL);

Regards,

Rogerio

idata
Community Manager
134 Views

Hi rbulha,

 

 

Sorry for not explaining myself clearly. I mean to check how the interrupt in being called and defined, and then undo that by entering similar commands. Let me try to replicate it and I'll let you know if I get different results.

 

 

Regards,

 

-Pablo
idata
Community Manager
134 Views

Hi rbulha,

 

 

I haven't been able to unregister the interrupt. Right now, my only suggestion would be to upload an empty program to overwrite the old program that enable interrupts. I know it might not be the best way but I haven't been able to get different results.

 

 

Regards,

 

-Pablo
Reply