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

Function CO_nodeGuardingMaster_initNode

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

Source from the content-addressed store, hash-verified

299}
300
301CO_ReturnError_t
302CO_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
325void
326CO_nodeGuardingMaster_process(CO_nodeGuardingMaster_t* ngm, uint32_t timeDifference_us, uint32_t* timerNext_us) {

Callers

nothing calls this directly

Calls 1

CO_CANtxBufferInitFunction · 0.85

Tested by

no test coverage detected