30#ifndef CO_CONFIG_HB_CONS
31#define CO_CONFIG_HB_CONS \
32 (CO_CONFIG_HB_CONS_ENABLE | CO_CONFIG_GLOBAL_FLAG_CALLBACK_PRE | CO_CONFIG_GLOBAL_FLAG_TIMERNEXT \
33 | CO_CONFIG_GLOBAL_FLAG_OD_DYNAMIC)
36#if (((CO_CONFIG_HB_CONS)&CO_CONFIG_HB_CONS_ENABLE) != 0) || defined CO_DOXYGEN
79#if (((CO_CONFIG_HB_CONS)&CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
80 void (*pFunctSignalPre)(
void* object);
83#if (((CO_CONFIG_HB_CONS)&CO_CONFIG_HB_CONS_CALLBACK_CHANGE) != 0) \
84 || (((CO_CONFIG_HB_CONS)&CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0) || defined CO_DOXYGEN
87#if (((CO_CONFIG_HB_CONS)&CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0) || defined CO_DOXYGEN
121#if (((CO_CONFIG_HB_CONS)&CO_CONFIG_FLAG_OD_DYNAMIC) != 0) || defined CO_DOXYGEN
124#if (((CO_CONFIG_HB_CONS)&CO_CONFIG_HB_CONS_CALLBACK_CHANGE) != 0) || defined CO_DOXYGEN
154#if (((CO_CONFIG_HB_CONS)&CO_CONFIG_FLAG_CALLBACK_PRE) != 0) || defined CO_DOXYGEN
168#if (((CO_CONFIG_HB_CONS)&CO_CONFIG_HB_CONS_CALLBACK_CHANGE) != 0) \
169 || (((CO_CONFIG_HB_CONS)&CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0) || defined CO_DOXYGEN
185#if (((CO_CONFIG_HB_CONS)&CO_CONFIG_HB_CONS_CALLBACK_MULTI) != 0) || defined CO_DOXYGEN
242#if (((CO_CONFIG_HB_CONS)&CO_CONFIG_HB_CONS_QUERY_FUNCT) != 0) || defined CO_DOXYGEN
CANopen Emergency protocol.
CANopen Network management and Heartbeat producer protocol.
CANopen Object Dictionary interface.
Interface between CAN hardware and CANopenNode.
int8_t CO_HBconsumer_getIdxByNodeId(CO_HBconsumer_t *HBcons, uint8_t nodeId)
Get the heartbeat producer object index by node ID.
int8_t CO_HBconsumer_getNmtState(CO_HBconsumer_t *HBcons, uint8_t idx, CO_NMT_internalState_t *nmtState)
Get the current NMT state of a heartbeat producer by the index in OD 0x1016.
void CO_HBconsumer_process(CO_HBconsumer_t *HBcons, bool_t NMTisPreOrOperational, uint32_t timeDifference_us, uint32_t *timerNext_us)
Process Heartbeat consumer object.
void CO_HBconsumer_initCallbackPre(CO_HBconsumer_t *HBcons, void *object, void(*pFunctSignal)(void *object))
Initialize Heartbeat consumer callback function.
void CO_HBconsumer_initCallbackHeartbeatStarted(CO_HBconsumer_t *HBcons, uint8_t idx, void *object, void(*pFunctSignal)(uint8_t nodeId, uint8_t idx, void *object))
Initialize Heartbeat consumer started callback function.
CO_HBconsumer_state_t
Heartbeat state of a node.
Definition CO_HBconsumer.h:62
CO_HBconsumer_state_t CO_HBconsumer_getState(CO_HBconsumer_t *HBcons, uint8_t idx)
Get the current state of a heartbeat producer by the index in OD 0x1016.
void CO_HBconsumer_initCallbackRemoteReset(CO_HBconsumer_t *HBcons, uint8_t idx, void *object, void(*pFunctSignal)(uint8_t nodeId, uint8_t idx, void *object))
Initialize Heartbeat consumer remote reset detected callback function.
void CO_HBconsumer_initCallbackNmtChanged(CO_HBconsumer_t *HBcons, uint8_t idx, void *object, void(*pFunctSignal)(uint8_t nodeId, uint8_t idx, CO_NMT_internalState_t NMTstate, void *object))
Initialize Heartbeat consumer NMT changed callback function.
CO_ReturnError_t CO_HBconsumer_init(CO_HBconsumer_t *HBcons, CO_EM_t *em, CO_HBconsNode_t *monitoredNodes, uint8_t monitoredNodesCount, OD_entry_t *OD_1016_HBcons, CO_CANmodule_t *CANdevRx, uint16_t CANdevRxIdxStart, uint32_t *errInfo)
Initialize Heartbeat consumer object.
void CO_HBconsumer_initCallbackTimeout(CO_HBconsumer_t *HBcons, uint8_t idx, void *object, void(*pFunctSignal)(uint8_t nodeId, uint8_t idx, void *object))
Initialize Heartbeat consumer timeout callback function.
@ CO_HBconsumer_UNCONFIGURED
Consumer entry inactive.
Definition CO_HBconsumer.h:63
@ CO_HBconsumer_TIMEOUT
No heatbeat received for set time.
Definition CO_HBconsumer.h:66
@ CO_HBconsumer_ACTIVE
Heartbeat received within set time.
Definition CO_HBconsumer.h:65
@ CO_HBconsumer_UNKNOWN
Consumer enabled, but no heartbeat received yet.
Definition CO_HBconsumer.h:64
CO_NMT_internalState_t
Internal network state of the CANopen node.
Definition CO_NMT_Heartbeat.h:70
unsigned int uint16_t
UNSIGNED16 in CANopen (0006h), 16-bit unsigned integer.
Definition CO_driver.h:132
unsigned long int uint32_t
UNSIGNED32 in CANopen (0007h), 32-bit unsigned integer.
Definition CO_driver.h:133
uint_fast8_t bool_t
Boolean data type for general use.
Definition CO_driver.h:126
unsigned char uint8_t
UNSIGNED8 in CANopen (0005h), 8-bit unsigned integer.
Definition CO_driver.h:131
signed char int8_t
INTEGER8 in CANopen (0002h), 8-bit signed integer.
Definition CO_driver.h:127
CO_ReturnError_t
Return values of some CANopen functions.
Definition CO_driver.h:449
Complete CAN module object.
Definition CO_driver.h:268
Emergency object.
Definition CO_Emergency.h:259
One monitored node inside CO_HBconsumer_t.
Definition CO_HBconsumer.h:72
uint8_t nodeId
Node Id of the monitored node.
Definition CO_HBconsumer.h:73
void * pFunctSignalObjectNmtChanged
Pointer to object.
Definition CO_HBconsumer.h:90
volatile void * CANrxNew
Indication if new Heartbeat message received from the CAN bus.
Definition CO_HBconsumer.h:78
uint32_t time_us
Consumer heartbeat time from OD.
Definition CO_HBconsumer.h:77
void * functSignalObjectHbStarted
Pointer to object.
Definition CO_HBconsumer.h:94
CO_HBconsumer_state_t HBstate
Current heartbeat monitoring state of the remote node.
Definition CO_HBconsumer.h:75
CO_NMT_internalState_t NMTstatePrev
Previous value of the remote node (Heartbeat payload)
Definition CO_HBconsumer.h:85
void * functSignalObjectRemoteReset
Pointer to object.
Definition CO_HBconsumer.h:100
void * functSignalObjectTimeout
Pointer to object.
Definition CO_HBconsumer.h:97
uint32_t timeoutTimer
Time since last heartbeat received.
Definition CO_HBconsumer.h:76
CO_NMT_internalState_t NMTstate
NMT state of the remote node (Heartbeat payload)
Definition CO_HBconsumer.h:74
void * functSignalObjectPre
From CO_HBconsumer_initCallbackPre() or NULL.
Definition CO_HBconsumer.h:81
Heartbeat consumer object.
Definition CO_HBconsumer.h:109
uint16_t CANdevRxIdxStart
From CO_HBconsumer_init()
Definition CO_HBconsumer.h:120
bool_t NMTisPreOrOperationalPrev
previous state of the variable
Definition CO_HBconsumer.h:118
uint8_t numberOfMonitoredNodes
Actual number of monitored nodes, size-of-the-above-array or number-of-array-elements-in-OD-0x1016,...
Definition CO_HBconsumer.h:112
CO_HBconsNode_t * monitoredNodes
Array of monitored nodes, from CO_HBconsumer_init()
Definition CO_HBconsumer.h:111
bool_t allMonitoredOperational
True, if all monitored nodes are NMT operational or no node is monitored.
Definition CO_HBconsumer.h:116
CO_EM_t * em
From CO_HBconsumer_init()
Definition CO_HBconsumer.h:110
bool_t allMonitoredActive
True, if all monitored nodes are active or no node is monitored.
Definition CO_HBconsumer.h:114
OD_extension_t OD_1016_extension
Extension for OD object.
Definition CO_HBconsumer.h:122
void * pFunctSignalObjectNmtChanged
Pointer to object.
Definition CO_HBconsumer.h:127
CO_CANmodule_t * CANdevRx
From CO_HBconsumer_init()
Definition CO_HBconsumer.h:119
Object Dictionary entry for one OD object.
Definition CO_ODinterface.h:272
Extension of OD object, which can optionally be specified by application in initialization phase with...
Definition CO_ODinterface.h:245