Go to the documentation of this file.
26 #ifndef CO_NMT_HEARTBEAT_H
27 #define CO_NMT_HEARTBEAT_H
35 #define CO_CONFIG_NMT (0)
180 #if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER) || defined CO_DOXYGEN
190 #if ((CO_CONFIG_NMT) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
192 void (*pFunctSignalPre)(
void *object);
196 #if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_CALLBACK_CHANGE) || defined CO_DOXYGEN
240 #
if ((
CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER) || defined CO_DOXYGEN
250 #if ((CO_CONFIG_NMT) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
265 void (*pFunctSignal)(
void *
object));
269 #if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_CALLBACK_CHANGE) || defined CO_DOXYGEN
333 #if ((CO_CONFIG_NMT) & CO_CONFIG_NMT_MASTER) || defined CO_DOXYGEN
@ CO_RESET_APP
2, Application must provide complete device reset
Definition: CO_NMT_Heartbeat.h:118
@ CO_NMT_PRE_OPERATIONAL
127, Device is in pre-operational state
Definition: CO_NMT_Heartbeat.h:83
unsigned long int uint32_t
UNSIGNED32 in CANopen (0007h), 32-bit unsigned integer.
Definition: CO_driver.h:155
Interface between CAN hardware and CANopenNode.
void * functSignalObjectPre
From CO_NMT_initCallbackPre() or NULL.
Definition: CO_NMT_Heartbeat.h:194
uint32_t HBproducerTime_us
Producer heartbeat time, calculated from OD 0x1017.
Definition: CO_NMT_Heartbeat.h:175
CO_ReturnError_t CO_NMT_init(CO_NMT_t *NMT, const OD_entry_t *OD_1017_ProducerHbTime, CO_EM_t *em, uint8_t nodeId, CO_NMT_control_t NMTcontrol, uint16_t firstHBTime_ms, CO_CANmodule_t *NMT_CANdevRx, uint16_t NMT_rxIdx, uint16_t CANidRxNMT, CO_CANmodule_t *NMT_CANdevTx, uint16_t NMT_txIdx, uint16_t CANidTxNMT, CO_CANmodule_t *HB_CANdevTx, uint16_t HB_txIdx, uint16_t CANidTxHB)
Initialize NMT and Heartbeat producer object.
#define CO_CONFIG_NMT
Configuration of NMT and Heartbeat.
Definition: CO_config.h:123
static void CO_NMT_setInternalState(CO_NMT_t *NMT, CO_NMT_internalState_t state)
Set internal NMT state.
Definition: CO_NMT_Heartbeat.h:326
@ CO_RESET_QUIT
3, Application must quit, no reset of microcontroller (command is not requested by the stack....
Definition: CO_NMT_Heartbeat.h:121
@ CO_NMT_INITIALIZING
0, Device is initializing
Definition: CO_NMT_Heartbeat.h:81
CO_ReturnError_t CO_NMT_sendCommand(CO_NMT_t *NMT, CO_NMT_command_t command, uint8_t nodeID)
Send NMT master command.
unsigned int uint16_t
UNSIGNED16 in CANopen (0006h), 16-bit unsigned integer.
Definition: CO_driver.h:153
@ CO_NMT_RESET_NODE
129, Reset device
Definition: CO_NMT_Heartbeat.h:102
CO_ReturnError_t
Return values of some CANopen functions.
Definition: CO_driver.h:488
static CO_NMT_internalState_t CO_NMT_getInternalState(CO_NMT_t *NMT)
Query current NMT state.
Definition: CO_NMT_Heartbeat.h:312
CO_NMT_reset_cmd_t CO_NMT_process(CO_NMT_t *NMT, CO_NMT_internalState_t *NMTstate, uint32_t timeDifference_us, uint32_t *timerNext_us)
Process received NMT and produce Heartbeat messages.
Definition: CO_NMT_Heartbeat.c:222
uint32_t HBproducerTimer
Internal timer for HB producer.
Definition: CO_NMT_Heartbeat.h:177
CO_NMT_reset_cmd_t
Return code from CO_NMT_process() that tells application code what to reset.
Definition: CO_NMT_Heartbeat.h:112
uint8_t internalCommand
NMT internal command from CO_NMT_receive() or CO_NMT_sendCommand(), processed in CO_NMT_process().
Definition: CO_NMT_Heartbeat.h:169
@ CO_NMT_STARTUP_TO_OPERATIONAL
If bit is set, then device enters NMT operational state after the initialization phase,...
Definition: CO_NMT_Heartbeat.h:141
void CO_NMT_initCallbackPre(CO_NMT_t *NMT, void *object, void(*pFunctSignal)(void *object))
Initialize NMT callback function after message preprocessed.
@ CO_NMT_ERR_TO_STOPPED
If bit is set and CO_NMT_ERR_ON_xx condition is met, then device will enter NMT stopped state,...
Definition: CO_NMT_Heartbeat.h:152
NMT consumer and Heartbeat producer object.
Definition: CO_NMT_Heartbeat.h:162
CO_CANtx_t * HB_TXbuff
CAN transmit buffer for heartbeat message.
Definition: CO_NMT_Heartbeat.h:189
@ CO_NMT_ERR_FREE_TO_OPERATIONAL
If bit is set and device is pre-operational, it enters NMT operational state automatically,...
Definition: CO_NMT_Heartbeat.h:155
CO_CANtx_t * NMT_TXbuff
CAN transmit buffer for NMT master message.
Definition: CO_NMT_Heartbeat.h:184
@ CO_RESET_COMM
1, Application must provide communication reset.
Definition: CO_NMT_Heartbeat.h:116
@ CO_NMT_ERR_REG_MASK
First 8 bits can be used to specify bitmask for the CO_errorRegister_t, to get relevant bits for the ...
Definition: CO_NMT_Heartbeat.h:138
CO_CANmodule_t * HB_CANdevTx
From CO_NMT_init()
Definition: CO_NMT_Heartbeat.h:187
@ CO_NMT_ENTER_STOPPED
2, Stop device
Definition: CO_NMT_Heartbeat.h:98
CO_EM_t * em
From CO_NMT_init()
Definition: CO_NMT_Heartbeat.h:179
@ CO_NMT_OPERATIONAL
5, Device is in operational state
Definition: CO_NMT_Heartbeat.h:85
uint8_t operatingStatePrev
Previous NMT operating state.
Definition: CO_NMT_Heartbeat.h:166
CO_NMT_command_t
Commands from NMT master.
Definition: CO_NMT_Heartbeat.h:94
@ CO_NMT_UNKNOWN
-1, Device state is unknown (for heartbeat consumer)
Definition: CO_NMT_Heartbeat.h:79
@ CO_NMT_ERR_ON_ERR_REG
If bit is set and device is operational, it enters NMT pre-operational or stopped state,...
Definition: CO_NMT_Heartbeat.h:149
@ CO_RESET_NOT
0, Normal return, no action
Definition: CO_NMT_Heartbeat.h:114
CO_CANmodule_t * NMT_CANdevTx
From CO_NMT_init()
Definition: CO_NMT_Heartbeat.h:182
Emergency object.
Definition: CO_Emergency.h:369
CO_NMT_internalState_t
Internal network state of the CANopen node.
Definition: CO_NMT_Heartbeat.h:77
CANopen Object Dictionary interface.
void CO_NMT_initCallbackChanged(CO_NMT_t *NMT, void(*pFunctNMT)(CO_NMT_internalState_t state))
Initialize NMT callback function.
@ CO_NMT_STOPPED
4, Device is stopped
Definition: CO_NMT_Heartbeat.h:87
CANopen Emergency protocol.
uint8_t operatingState
Current NMT operating state.
Definition: CO_NMT_Heartbeat.h:164
#define NULL
NULL, for general usage.
Definition: CO_driver.h:135
Complete CAN module object.
Definition: CO_driver.h:319
@ CO_NMT_ENTER_PRE_OPERATIONAL
128, Put device into pre-operational
Definition: CO_NMT_Heartbeat.h:100
CO_NMT_control_t NMTcontrol
From CO_NMT_init()
Definition: CO_NMT_Heartbeat.h:173
@ CO_NMT_ENTER_OPERATIONAL
1, Start device
Definition: CO_NMT_Heartbeat.h:96
Object Dictionary entry for one OD object.
Definition: CO_ODinterface.h:336
CO_NMT_control_t
NMT control bitfield for NMT internal state.
Definition: CO_NMT_Heartbeat.h:135
uint8_t nodeId
From CO_NMT_init()
Definition: CO_NMT_Heartbeat.h:171
@ CO_NMT_ERR_ON_BUSOFF_HB
If bit is set and device is operational, it enters NMT pre-operational or stopped state,...
Definition: CO_NMT_Heartbeat.h:145
@ CO_NMT_RESET_COMMUNICATION
130, Reset CANopen communication on device
Definition: CO_NMT_Heartbeat.h:104
Configuration object for CAN transmit message for specific CANopenNode Object.
Definition: CO_driver.h:299
unsigned char uint8_t
UNSIGNED8 in CANopen (0005h), 8-bit unsigned integer.
Definition: CO_driver.h:151