ao_ir_can.h
CAN interrupts

Include

stdbool.h
sys/attribs.h
xc.h

Configuration

AO_IR_CAN1_*

#define AO_IR_CAN1_ATTRIBUTE __ISR(_CAN1_VECTOR, IPL4SRS)

The interrupt handler attribute.

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

The interrupt priority and subpriority.

AO_IR_CAN2_*

#define AO_IR_CAN2_ATTRIBUTE __ISR(_CAN2_VECTOR, IPL4SRS)

The interrupt handler attribute.

#define AO_IR_CAN2_PRIO    (4)
#define AO_IR_CAN2_SUBPRIO (0)

The interrupt priority and subpriority.

Functions

ao_ir_can1_*

#define ao_ir_can1_enable()  { IEC4SET = _IEC4_CAN1IE_MASK; }
#define ao_ir_can1_disable() { IEC4CLR = _IEC4_CAN1IE_MASK; }

Enables or disables the interrupt.

#define ao_ir_can1_request() { IFS4SET = _IFS4_CAN1IF_MASK; }
#define ao_ir_can1_reply()   { IFS4CLR = _IFS4_CAN1IF_MASK; }

Requests the interrupt or replies thereto.

#define ao_ir_can1_is_enabled() \
(                               \
    (IEC4 & _IEC4_CAN1IE_MASK)  \
    ? true                      \
    : false                     \
)

Checks whether the interrupt is enabled.

#define ao_ir_can1_is_pending() \
(                               \
    (IFS4 & _IFS4_CAN1IF_MASK)  \
    ? true                      \
    : false                     \
)

Checks whether the interrupt is pending.

ao_ir_can2_*

#define ao_ir_can2_enable()  { IEC4SET = _IEC4_CAN2IE_MASK; }
#define ao_ir_can2_disable() { IEC4CLR = _IEC4_CAN2IE_MASK; }

Enables or disables the interrupt.

#define ao_ir_can2_request() { IFS4SET = _IFS4_CAN2IF_MASK; }
#define ao_ir_can2_reply()   { IFS4CLR = _IFS4_CAN2IF_MASK; }

Requests the interrupt or replies thereto.

#define ao_ir_can2_is_enabled() \
(                               \
    (IEC4 & _IEC4_CAN2IE_MASK)  \
    ? true                      \
    : false                     \
)

Checks whether the interrupt is enabled.

#define ao_ir_can2_is_pending() \
(                               \
    (IFS4 & _IFS4_CAN2IF_MASK)  \
    ? true                      \
    : false                     \
)

Checks whether the interrupt is pending.