* Custom functions for read/write OD object "COB-ID EMCY" * * For more information see file CO_ODinterface.h, OD_IO_t. */
| 50 | * For more information see file CO_ODinterface.h, OD_IO_t. |
| 51 | */ |
| 52 | static ODR_t |
| 53 | OD_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 | |
| 71 | static ODR_t |
| 72 | OD_write_1014(OD_stream_t* stream, const void* buf, OD_size_t count, OD_size_t* countWritten) { |
nothing calls this directly
no test coverage detected