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

Function OD_read_1014

301/CO_Emergency.c:52–69  ·  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

50 * For more information see file CO_ODinterface.h, OD_IO_t.
51 */
52static ODR_t
53OD_read_1014(OD_stream_t* stream, void* buf, OD_size_t count, OD_size_t* countRead) {
54 if ((stream == NULL) || (stream->subIndex != 0U) || (buf == NULL) || (count < sizeof(uint32_t))
55 || (countRead == NULL)) {
56 return ODR_DEV_INCOMPAT;
57 }
58
59 CO_EM_t* em = (CO_EM_t*)stream->object;
60
61 uint16_t canId = (em->producerCanId == CO_CAN_ID_EMERGENCY) ? (CO_CAN_ID_EMERGENCY + em->nodeId)
62 : em->producerCanId;
63 uint32_t COB_IDEmergency32 = em->producerEnabled ? 0U : 0x80000000U;
64 COB_IDEmergency32 |= canId;
65 (void)CO_setUint32(buf, COB_IDEmergency32);
66
67 *countRead = sizeof(uint32_t);
68 return ODR_OK;
69}
70
71static ODR_t
72OD_write_1014(OD_stream_t* stream, const void* buf, OD_size_t count, OD_size_t* countWritten) {

Callers

nothing calls this directly

Calls 1

CO_setUint32Function · 0.85

Tested by

no test coverage detected