ao_ir_can.h
CAN interrupts

Include

stdbool.h
sys/attribs.h
xc.h

Configuration

AO_IR_CAN1_*

#define AO_IR_CAN1_ATTRIBUTE __ISR(_CAN_1_VECTOR, IPL4SOFT)

The interrupt handler attribute.

#define AO_IR_CAN1_PRIO    (4)
#define AO_IR_CAN1_SUBPRIO (0)

The interrupt priority and subpriority.

Functions

ao_ir_can1_*

#define ao_ir_can1_enable()  { IEC2SET = _IEC2_CAN1IE_MASK; }
#define ao_ir_can1_disable() { IEC2CLR = _IEC2_CAN1IE_MASK; }

Enables or disables the interrupt.

#define ao_ir_can1_request() { IFS2SET = _IFS2_CAN1IF_MASK; }
#define ao_ir_can1_reply()   { IFS2CLR = _IFS2_CAN1IF_MASK; }

Requests the interrupt or replies thereto.

#define ao_ir_can1_is_enabled() \
(                               \
    (IEC2 & _IEC2_CAN1IE_MASK)  \
    ? true                      \
    : false                     \
)

Checks whether the interrupt is enabled.

#define ao_ir_can1_is_pending() \
(                               \
    (IFS2 & _IFS2_CAN1IF_MASK)  \
    ? true                      \
    : false                     \
)

Checks whether the interrupt is pending.