* Custom function for writing OD object "Life time factor" * * For more information see file CO_ODinterface.h, OD_IO_t. */
| 69 | * For more information see file CO_ODinterface.h, OD_IO_t. |
| 70 | */ |
| 71 | static ODR_t |
| 72 | OD_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 | |
| 93 | CO_ReturnError_t |
| 94 | CO_nodeGuardingSlave_init(CO_nodeGuardingSlave_t* ngs, OD_entry_t* OD_100C_GuardTime, |
nothing calls this directly
no test coverage detected