| 299 | } |
| 300 | |
| 301 | CO_ReturnError_t |
| 302 | CO_nodeGuardingMaster_initNode(CO_nodeGuardingMaster_t* ngm, uint8_t index, uint8_t nodeId, uint16_t guardTime_ms) { |
| 303 | if (ngm == NULL || index >= CO_CONFIG_NODE_GUARDING_MASTER_COUNT || nodeId < 1 || nodeId > 0x7F) { |
| 304 | return CO_ERROR_ILLEGAL_ARGUMENT; |
| 305 | } |
| 306 | |
| 307 | CO_nodeGuardingMasterNode_t* node = &ngm->nodes[index]; |
| 308 | |
| 309 | node->guardTime_us = (uint32_t)guardTime_ms * 1000; |
| 310 | node->guardTimer = 0; |
| 311 | node->ident = CO_CAN_ID_HEARTBEAT + nodeId; |
| 312 | node->NMTstate = CO_NMT_UNKNOWN; /* for the first time */ |
| 313 | node->toggle = false; |
| 314 | node->responseRecived = true; /* for the first time */ |
| 315 | node->CANtxWasBusy = false; |
| 316 | node->monitoringActive = false; |
| 317 | |
| 318 | #if CO_CONFIG_NODE_GUARDING_MASTER_COUNT == 1 |
| 319 | ngm->CANtxBuff = CO_CANtxBufferInit(ngm->CANdevTx, ngm->CANdevTxIdx, node->ident, true, 1, 0); |
| 320 | #endif |
| 321 | |
| 322 | return CO_ERROR_NO; |
| 323 | } |
| 324 | |
| 325 | void |
| 326 | CO_nodeGuardingMaster_process(CO_nodeGuardingMaster_t* ngm, uint32_t timeDifference_us, uint32_t* timerNext_us) { |
nothing calls this directly
no test coverage detected