Releasing an engaged Interrupt, How?

13 Jun 2013

Hi folks, I know we use this>>flowmtr.rise(&rpm); to declare an interrupt but once its declared the interrupt is ON and if I want to disable it at anytime in th program how I should go about this?

FOR EXAMPLE: on AvR I just used to do >> sei(); to enable and cli(); to disable the interrupts,

13 Jun 2013

The mbed equivalents of those are:

__disable_irq(); 

and 

__enable_irq(); 

Then we have the peripheral level enabling/disabling, for example:

NVIC_EnableIRQ(UART1_IRQn);
NVIC_DisableIRQ(UART1_IRQn);

Finally there is the library level. This is for all official mbed functions, although most user libraries with interrupts use the same system. Some of them have a .detach function to remove interrupts, most however don't. In that case use NULL. In the case of your rising edge interrupt:

flowmtr.rise(NULL);