MCPcopy Create free account
hub / github.com/CANopenNode/CANopenNode / CO_CANrxBufferInit

Function CO_CANrxBufferInit

example/CO_driver_blank.c:99–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99CO_ReturnError_t
100CO_CANrxBufferInit(CO_CANmodule_t* CANmodule, uint16_t index, uint16_t ident, uint16_t mask, bool_t rtr, void* object,
101 void (*CANrx_callback)(void* object, void* message)) {
102 CO_ReturnError_t ret = CO_ERROR_NO;
103
104 if ((CANmodule != NULL) && (object != NULL) && (CANrx_callback != NULL) && (index < CANmodule->rxSize)) {
105 /* buffer, which will be configured */
106 CO_CANrx_t* buffer = &CANmodule->rxArray[index];
107
108 /* Configure object variables */
109 buffer->object = object;
110 buffer->CANrx_callback = CANrx_callback;
111
112 /* CAN identifier and CAN mask, bit aligned with CAN module. Different on different microcontrollers. */
113 buffer->ident = ident & 0x07FFU;
114 if (rtr) {
115 buffer->ident |= 0x0800U;
116 }
117 buffer->mask = (mask & 0x07FFU) | 0x0800U;
118
119 /* Set CAN hardware module filter and mask. */
120 if (CANmodule->useCANrxFilters) {}
121 } else {
122 ret = CO_ERROR_ILLEGAL_ARGUMENT;
123 }
124
125 return ret;
126}
127
128CO_CANtx_t*
129CO_CANtxBufferInit(CO_CANmodule_t* CANmodule, uint16_t index, uint16_t ident, bool_t rtr, uint8_t noOfBytes,

Callers 15

CO_SRDO_configFunction · 0.85
CO_GFC_initFunction · 0.85
CO_LSSslave_initFunction · 0.85
CO_LSSmaster_initFunction · 0.85
CO_NMT_Heartbeat.cFile · 0.85
CO_Emergency.cFile · 0.85
OD_write_14xxFunction · 0.85
CO_PDO.cFile · 0.85
CO_TIME.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected