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

Function OD_write_100C

301/CO_Node_Guarding.c:44–64  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

42 * For more information see file CO_ODinterface.h, OD_IO_t.
43 */
44static ODR_t
45OD_write_100C(OD_stream_t* stream, const void* buf, OD_size_t count, OD_size_t* countWritten) {
46 if ((stream == NULL) || (stream->subIndex != 0U) || (buf == NULL) || (count != sizeof(uint16_t))
47 || (countWritten == NULL)) {
48 return ODR_DEV_INCOMPAT;
49 }
50
51 CO_nodeGuardingSlave_t* ngs = (CO_nodeGuardingSlave_t*)stream->object;
52
53 /* update objects */
54 ngs->guardTime_us = (uint32_t)CO_getUint16(buf) * 1000U;
55 ngs->lifeTime_us = ngs->guardTime_us * ngs->lifeTimeFactor;
56
57 /* reset running timer */
58 if (ngs->lifeTimer > 0U) {
59 ngs->lifeTimer = ngs->lifeTime_us;
60 }
61
62 /* write value to the original location in the Object Dictionary */
63 return OD_writeOriginal(stream, buf, count, countWritten);
64}
65
66/*
67 * Custom function for writing OD object "Life time factor"

Callers

nothing calls this directly

Calls 2

CO_getUint16Function · 0.85
OD_writeOriginalFunction · 0.85

Tested by

no test coverage detected