mbed library sources 只保留l0和l1系列的库,修改l0的库的晶振为12m

Dependents:   SANFAN_read_analog_value nucleo-wdg Nucleo_sleep_copy

Fork of mbed-src by mbed official

Embed: (wiki syntax)

« Back to documentation index

InterruptManager Class Reference

InterruptManager Class Reference

Use this singleton if you need to chain interrupt handlers. More...

#include <InterruptManager.h>

Public Member Functions

pFunctionPointer_t add_handler (void(*function)(void), IRQn_Type irq)
 Add a handler for an interrupt at the end of the handler list.
pFunctionPointer_t add_handler_front (void(*function)(void), IRQn_Type irq)
 Add a handler for an interrupt at the beginning of the handler list.
template<typename T >
pFunctionPointer_t add_handler (T *tptr, void(T::*mptr)(void), IRQn_Type irq)
 Add a handler for an interrupt at the end of the handler list.
template<typename T >
pFunctionPointer_t add_handler_front (T *tptr, void(T::*mptr)(void), IRQn_Type irq)
 Add a handler for an interrupt at the beginning of the handler list.
bool remove_handler (pFunctionPointer_t handler, IRQn_Type irq)
 Remove a handler from an interrupt.

Static Public Member Functions

static InterruptManagerget ()
 Return the only instance of this class.
static void destroy ()
 Destroy the current instance of the interrupt manager.

Detailed Description

Use this singleton if you need to chain interrupt handlers.

Example (for LPC1768):

 #include "InterruptManager.h"
 #include "mbed.h"

 Ticker flipper;
 DigitalOut led1(LED1);
 DigitalOut led2(LED2);

 void flip(void) {
     led1 = !led1;
 }

 void handler(void) {
     led2 = !led1;
 }

 int main() {
     led1 = led2 = 0;
     flipper.attach(&flip, 1.0);
     InterruptManager::get()->add_handler(handler, TIMER3_IRQn);
 }

Definition at line 36 of file InterruptManager.h.


Member Function Documentation

pFunctionPointer_t add_handler ( void(*)(void)  function,
IRQn_Type  irq 
)

Add a handler for an interrupt at the end of the handler list.

Parameters:
functionthe handler to add
irqinterrupt number
Returns:
The function object created for 'function'

Definition at line 54 of file InterruptManager.h.

pFunctionPointer_t add_handler ( T *  tptr,
void(T::*)(void)  mptr,
IRQn_Type  irq 
)

Add a handler for an interrupt at the end of the handler list.

Parameters:
tptrpointer to the object that has the handler function
mptrpointer to the actual handler function
irqinterrupt number
Returns:
The function object created for 'tptr' and 'mptr'

Definition at line 80 of file InterruptManager.h.

pFunctionPointer_t add_handler_front ( void(*)(void)  function,
IRQn_Type  irq 
)

Add a handler for an interrupt at the beginning of the handler list.

Parameters:
functionthe handler to add
irqinterrupt number
Returns:
The function object created for 'function'

Definition at line 66 of file InterruptManager.h.

pFunctionPointer_t add_handler_front ( T *  tptr,
void(T::*)(void)  mptr,
IRQn_Type  irq 
)

Add a handler for an interrupt at the beginning of the handler list.

Parameters:
tptrpointer to the object that has the handler function
mptrpointer to the actual handler function
irqinterrupt number
Returns:
The function object created for 'tptr' and 'mptr'

Definition at line 94 of file InterruptManager.h.

void destroy (  ) [static]

Destroy the current instance of the interrupt manager.

Definition at line 25 of file InterruptManager.cpp.

InterruptManager * get (  ) [static]

Return the only instance of this class.

Definition at line 15 of file InterruptManager.cpp.

bool remove_handler ( pFunctionPointer_t  handler,
IRQn_Type  irq 
)

Remove a handler from an interrupt.

Parameters:
handlerthe function object for the handler to remove
irqthe interrupt number
Returns:
true if the handler was found and removed, false otherwise

Definition at line 62 of file InterruptManager.cpp.