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

Function OD_write_100D

301/CO_Node_Guarding.c:71–91  ·  view source on GitHub ↗

* Custom function for writing OD object "Life time factor" * * For more information see file CO_ODinterface.h, OD_IO_t. */

Source from the content-addressed store, hash-verified

69 * For more information see file CO_ODinterface.h, OD_IO_t.
70 */
71static ODR_t
72OD_write_100D(OD_stream_t* stream, const void* buf, OD_size_t count, OD_size_t* countWritten) {
73 if ((stream == NULL) || (stream->subIndex != 0U) || (buf == NULL) || (count != sizeof(uint8_t))
74 || (countWritten == NULL)) {
75 return ODR_DEV_INCOMPAT;
76 }
77
78 CO_nodeGuardingSlave_t* ngs = (CO_nodeGuardingSlave_t*)stream->object;
79
80 /* update objects */
81 ngs->lifeTimeFactor = (uint8_t)CO_getUint8(buf);
82 ngs->lifeTime_us = ngs->guardTime_us * ngs->lifeTimeFactor;
83
84 /* reset running timer */
85 if (ngs->lifeTimer > 0U) {
86 ngs->lifeTimer = ngs->lifeTime_us;
87 }
88
89 /* write value to the original location in the Object Dictionary */
90 return OD_writeOriginal(stream, buf, count, countWritten);
91}
92
93CO_ReturnError_t
94CO_nodeGuardingSlave_init(CO_nodeGuardingSlave_t* ngs, OD_entry_t* OD_100C_GuardTime,

Callers

nothing calls this directly

Calls 2

CO_getUint8Function · 0.85
OD_writeOriginalFunction · 0.85

Tested by

no test coverage detected