InterruptMask library allows masking/unmasking GPIO interrupts (attached to either the rise or falling edges). It also allows clearing pending interrupts which may come handy before unmasking them.

Revision:
4:a34eddd0a2be
Parent:
3:7b8a744ac27a
--- a/InterruptMask.h	Tue Feb 18 15:44:49 2014 +0000
+++ b/InterruptMask.h	Wed Feb 19 04:35:24 2014 +0000
@@ -1,39 +1,41 @@
+//***************************************************************************//
 /* InterruptMask Library */
+/* Napoleon Leoni, February 18,2014*/
 /* This class enables masking a GPIO interrupt from a specific MBED pin*/
 // Note to get the actual pin number in the LPC of an mbed pin in P0
 // simply do pN-P0_0, for example p12-P0_0=17, that is pin 12 in the mbed
 // corresponds to Port[0].17 or bit 17 of port 0.
 //***************************************************************************//
-/* Example usage */
-/* >#include "InterruptMask.h"
-/* >InterruptIn upPressed(p15);
-/* >InterruptMask maskUpButtonInt(p15); //Interrupt mask object allows easy access to 
-/* >                                    //mask/unmask interrupts from a GPIO source
-/* >void ISRup(void){
-/*>    myled1=!myled1;
-/*>}
-/*>int main() {
-/*>    upPressed.rise(&ISRup);
-/*>    //downPressed.rise(&ISRdown);
-/*>    bool disableInterrupt=false;
-/*>    int counter=0,tdelay=10;
-/*>    
-/*>    while (1) {
-/*>        //This section of code periodically (every 10 seconds) masks the specified GPIO interrupt
-/*>        //showing how to both mask it and unmask it as well as how to clear pending interrupts
-/*>        counter++;
-/*>        if(counter>=tdelay){
-/*>            disableInterrupt=!disableInterrupt;
-/*>            if(disableInterrupt) maskUpButtonInt.maskIntR() ;   //mask interrupt
-/*>            if(!disableInterrupt){
-/*>                 maskUpButtonInt.ClrInt();       //clear any pending interrupt before unmasking
-/*>                 maskUpButtonInt.unMaskIntR();   //unmask interrupt 
-/*>            }
-/*>            counter=0;
-/*>        }
-/*>    }
-/*>}
-*/
+//* Example usage */
+//* >#include "InterruptMask.h"
+//* >InterruptIn upPressed(p15);
+//* >InterruptMask maskUpButtonInt(p15); //Interrupt mask object allows easy access to 
+//* >                                    //mask/unmask interrupts from a GPIO source
+//* >void ISRup(void){
+//*>    myled1=!myled1;
+//*>}
+//*>int main() {
+//*>    upPressed.rise(&ISRup);
+//*>    //downPressed.rise(&ISRdown);
+//*>    bool disableInterrupt=false;
+//*>    int counter=0,tdelay=10;
+//*>    
+//*>    while (1) {
+//*>        //This section of code periodically (every 10 seconds) masks the specified GPIO interrupt
+//*>        //showing how to both mask it and unmask it as well as how to clear pending interrupts
+//*>        counter++;
+//*>        if(counter>=tdelay){
+//*>            disableInterrupt=!disableInterrupt;
+//*>            if(disableInterrupt) maskUpButtonInt.maskIntR() ;   //mask interrupt
+//*>            if(!disableInterrupt){
+//*>                 maskUpButtonInt.ClrInt();       //clear any pending interrupt before unmasking
+//*>                 maskUpButtonInt.unMaskIntR();   //unmask interrupt 
+//*>            }
+//*>            counter=0;
+//*>        }
+//*>    }
+//*>}
+
 //
 //                  TESTS RUN                                               //
 // I print to the LCD three important LPC1768 registers: