CANopenNode
CANopen protocol stack
|
Data Structures | |
struct | CO_CANrx_t |
Configuration object for CAN received message for specific CANopenNode Object. More... | |
Functions | |
void | CANrx_callback (void *object, void *rxMsg) |
CAN receive callback function which pre-processes received CAN message. | |
static uint16_t | CO_CANrxMsg_readIdent (void *rxMsg) |
CANrx_callback() can read CAN identifier from received CAN message. | |
static uint8_t | CO_CANrxMsg_readDLC (void *rxMsg) |
CANrx_callback() can read Data Length Code from received CAN message. | |
static const uint8_t * | CO_CANrxMsg_readData (void *rxMsg) |
CANrx_callback() can read pointer to data from received CAN message. | |
Target specific definitions and description of CAN message reception
CAN messages in CANopenNode are usually received by its own thread or higher priority interrupt. Received CAN messages are first filtered by hardware or by software. Thread then examines its 11-bit CAN-id and mask and determines, to which CANopenNode Object it belongs to. After that it calls predefined CANrx_callback() function, which quickly pre-processes the message and fetches the relevant data. CANrx_callback() function is defined by each CANopenNode Object separately. Pre-processed fetched data are later processed in another thread.
If CANopenNode Object reception of specific CAN message, it must first configure its own CO_CANrx_t object with the CO_CANrxBufferInit() function.
void CANrx_callback | ( | void * | object, |
void * | rxMsg ) |
CAN receive callback function which pre-processes received CAN message.
It is called by fast CAN receive thread. Each CANopenNode Object defines its own and registers it with CO_CANrxBufferInit(), by passing function pointer.
object | pointer to specific CANopenNode Object, registered with CO_CANrxBufferInit() |
rxMsg | pointer to received CAN message |
|
inlinestatic |
CANrx_callback() can read CAN identifier from received CAN message.
Must be defined in the CO_driver_target.h file.
This is target specific function and is specific for specific microcontroller. It is best to implement it by using inline function or macro. rxMsg
parameter should cast to a pointer to structure. For best efficiency structure may have the same alignment as CAN registers inside CAN module.
rxMsg | Pointer to received message |
|
inlinestatic |
CANrx_callback() can read Data Length Code from received CAN message.
See also CO_CANrxMsg_readIdent():
rxMsg | Pointer to received message |
|
inlinestatic |
CANrx_callback() can read pointer to data from received CAN message.
See also CO_CANrxMsg_readIdent():
rxMsg | Pointer to received message |