* Custom function for writing OD object "Guard time" * * For more information see file CO_ODinterface.h, OD_IO_t. */
| 42 | * For more information see file CO_ODinterface.h, OD_IO_t. |
| 43 | */ |
| 44 | static ODR_t |
| 45 | OD_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" |
nothing calls this directly
no test coverage detected