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

Function CO_LSSmaster_receive

305/CO_LSSmaster.c:72–95  ·  view source on GitHub ↗

* Read received message from CAN module. * * Function will be called (by CAN receive interrupt) every time, when CAN message with correct identifier * will be received. For more information and description of parameters see file CO_driver.h. */

Source from the content-addressed store, hash-verified

70 * will be received. For more information and description of parameters see file CO_driver.h.
71 */
72static void
73CO_LSSmaster_receive(void* object, void* msg) {
74 CO_LSSmaster_t* LSSmaster;
75 uint8_t DLC = CO_CANrxMsg_readDLC(msg);
76 const uint8_t* data = CO_CANrxMsg_readData(msg);
77
78 LSSmaster = (CO_LSSmaster_t*)object; /* this is the correct pointer type of the first argument */
79
80 /* verify message length and message overflow (previous message was not processed yet). */
81 if ((DLC == 8U) && !CO_FLAG_READ(LSSmaster->CANrxNew) && (LSSmaster->command != CO_LSSmaster_COMMAND_WAITING)) {
82
83 /* copy data and set 'new message' flag */
84 (void)memcpy(LSSmaster->CANrxData, data, sizeof(LSSmaster->CANrxData));
85
86 CO_FLAG_SET(LSSmaster->CANrxNew);
87
88#if ((CO_CONFIG_LSS)&CO_CONFIG_FLAG_CALLBACK_PRE) != 0
89 /* Optional signal to RTOS, which can resume task, which handles further processing. */
90 if (LSSmaster->pFunctSignal != NULL) {
91 LSSmaster->pFunctSignal(LSSmaster->functSignalObject);
92 }
93#endif
94 }
95}
96
97/*
98 * Check LSS timeout.

Callers

nothing calls this directly

Calls 2

CO_CANrxMsg_readDLCFunction · 0.85
CO_CANrxMsg_readDataFunction · 0.85

Tested by

no test coverage detected