modm API documentation
Interrupt Service Routines
#define MODM_ISR_NAME(vector)
 
#define MODM_ISR_DECL(vector)
 
#define MODM_ISR_CALL(vector)
 
#define MODM_ISR(vector, ...)
 

Detailed Description

lbuild module: modm:architecture:interrupt

Macro Definition Documentation

#define MODM_ISR

Declare an interrupt handler.

This macro allows the declaration of interrupt handlers using the name declared in the datasheet in C or C++ code on any platform.

On AVRs this maps to ISR(MODM_ISR_NAME({vector}), args). On Cortex-M and Hosted this maps to void MODM_ISR_NAME({vector})(void) args. extern "C" is automatically added in a C++ environment.

On Cortex-M the vector name is validated at compile time against the device's vector table, so that misspelled vector names get caught during compilation. You can disable the validation by defining MODM_ISR_DISABLE_VALIDATION.

Parameters
vectorThe name of the interrupt without any suffix (neither _vect, nor _IRQHandler).
...Multiple compiler attributes can be added to an interrupt. For example modm_fastcode.
#define MODM_ISR_CALL

Directly calls an interrupt function.

This maps to MODM_ISR_NAME({vector})().

Note
You may have to forward declare the interrupt using MODM_ISR_DECL({vector}).

On Cortex-M the vector name is validated at compile time against the device's vector table, so that misspelled vector names get caught during compilation. If this is undesirable you can manually call the vector using MODM_ISR_NAME(vector)() or disable the validation by defining MODM_ISR_DISABLE_VALIDATION.

Parameters
vectorThe name of the interrupt without any suffix (neither _vect, nor _IRQHandler).
#define MODM_ISR_DECL

Forward declare in interrupt function.

This maps to extern void MODM_ISR_NAME({vector})(void). extern "C" is used automatically in a C++ environment.

Parameters
vectorThe name of the interrupt without any suffix (neither _vect, nor _IRQHandler).
#define MODM_ISR_NAME

Get the expanded interrupt name.

On AVRs this maps to {vector}_vect. On Cortex-M this maps to {vector}_IRQHandler. On Hosted this maps to {vector}_isr.

Warning
These mappings are internal and can change without notice!
The CMSIS header files may define a macro with an identical name as an interrupt vector, such as MODM_ISR_NAME(ADC) vs. the ADC peripheral. When defining interrupt vectors for compatibility, you MUST use this macro instead of manually defining it!
#define ADC ADC_CAN_TX // will not compile!
#define MODM_ISR_NAME(ADC) MODM_ISR_NAME(ADC_CAN_TX) // will compile
MODM_ISR(ADC) {...}
Parameters
vectorThe name of the interrupt without any suffix (neither _vect, nor _IRQHandler).