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

Function OD_read_1014_default

301/CO_Emergency.c:109–124  ·  view source on GitHub ↗

* Custom functions for read/write OD object "COB-ID EMCY" * * For more information see file CO_ODinterface.h, OD_IO_t. */

Source from the content-addressed store, hash-verified

107 * For more information see file CO_ODinterface.h, OD_IO_t.
108 */
109static ODR_t
110OD_read_1014_default(OD_stream_t* stream, void* buf, OD_size_t count, OD_size_t* countRead) {
111 if ((stream == NULL) || (stream->subIndex != 0U) || (buf == NULL) || (count < sizeof(uint32_t))
112 || (countRead == NULL)) {
113 return ODR_DEV_INCOMPAT;
114 }
115
116 CO_EM_t* em = (CO_EM_t*)stream->object;
117
118 uint32_t COB_IDEmergency32 = em->producerEnabled ? 0U : 0x80000000U;
119 COB_IDEmergency32 |= CO_CAN_ID_EMERGENCY + (uint32_t)em->nodeId;
120 (void)CO_setUint32(buf, COB_IDEmergency32);
121
122 *countRead = sizeof(uint32_t);
123 return ODR_OK;
124}
125#endif /* (CO_CONFIG_EM) & CO_CONFIG_EM_PROD_CONFIGURABLE */
126
127#if ((CO_CONFIG_EM)&CO_CONFIG_EM_PROD_INHIBIT) != 0

Callers

nothing calls this directly

Calls 1

CO_setUint32Function · 0.85

Tested by

no test coverage detected