CANopenNode
CO_SYNC.h
Go to the documentation of this file.
1 
26 #ifndef CO_SYNC_H
27 #define CO_SYNC_H
28 
29 #include "301/CO_driver.h"
30 
31 /* default configuration, see CO_config.h */
32 #ifndef CO_CONFIG_SYNC
33 #define CO_CONFIG_SYNC (CO_CONFIG_SYNC_ENABLE | CO_CONFIG_SYNC_PRODUCER)
34 #endif
35 
36 #if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE) || defined CO_DOXYGEN
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
75 typedef struct{
97  volatile void *CANrxNew;
107 #if ((CO_CONFIG_SYNC) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
108 
109  void (*pFunctSignalPre)(void *object);
112 #endif
118 }CO_SYNC_t;
119 
120 
122 typedef enum {
127 
128 
149  CO_SYNC_t *SYNC,
150  CO_EM_t *em,
151  CO_SDO_t *SDO,
152  CO_NMT_internalState_t *operatingState,
153  uint32_t COB_ID_SYNCMessage,
154  uint32_t communicationCyclePeriod,
155  uint8_t synchronousCounterOverflowValue,
156  CO_CANmodule_t *CANdevRx,
157  uint16_t CANdevRxIdx,
158  CO_CANmodule_t *CANdevTx,
159  uint16_t CANdevTxIdx);
160 
161 
162 #if ((CO_CONFIG_SYNC) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
163 
175  CO_SYNC_t *SYNC,
176  void *object,
177  void (*pFunctSignalPre)(void *object));
178 #endif
179 
180 
194 
195 
210  CO_SYNC_t *SYNC,
211  uint32_t timeDifference_us,
212  uint32_t ObjDict_synchronousWindowLength,
213  uint32_t *timerNext_us);
214  /* CO_SYNC */
216 
217 #ifdef __cplusplus
218 }
219 #endif /*__cplusplus*/
220 
221 #endif /* (CO_CONFIG_SYNC) & CO_CONFIG_SYNC_ENABLE */
222 
223 #endif /* CO_SYNC_H */
uint32_t
unsigned long int uint32_t
UNSIGNED32 in CANopen (0007h), 32-bit unsigned integer.
Definition: CO_driver.h:155
CO_driver.h
Interface between CAN hardware and CANopenNode.
CO_SYNC_t::periodTime
uint32_t periodTime
Sync period time in [microseconds].
Definition: CO_SYNC.h:86
CO_SYNC_process
CO_SYNC_status_t CO_SYNC_process(CO_SYNC_t *SYNC, uint32_t timeDifference_us, uint32_t ObjDict_synchronousWindowLength, uint32_t *timerNext_us)
Process SYNC communication.
CO_SYNC_NONE
@ CO_SYNC_NONE
SYNC not received.
Definition: CO_SYNC.h:123
uint16_t
unsigned int uint16_t
UNSIGNED16 in CANopen (0006h), 16-bit unsigned integer.
Definition: CO_driver.h:153
CO_SYNC_t::counter
uint8_t counter
Counter of the SYNC message if counterOverflowValue is different than zero.
Definition: CO_SYNC.h:101
CO_SYNC_OUTSIDE_WINDOW
@ CO_SYNC_OUTSIDE_WINDOW
SYNC received outside SYNC window.
Definition: CO_SYNC.h:125
CO_ReturnError_t
CO_ReturnError_t
Return values of some CANopen functions.
Definition: CO_driver.h:488
CO_SYNC_t::CANdevRx
CO_CANmodule_t * CANdevRx
From CO_SYNC_init()
Definition: CO_SYNC.h:113
bool_t
unsigned char bool_t
Boolean data type for general use.
Definition: CO_driver.h:141
CO_SYNC_status_t
CO_SYNC_status_t
Return value for CO_SYNC_process.
Definition: CO_SYNC.h:122
CO_SYNC_t::periodTimeoutTime
uint32_t periodTimeoutTime
Sync period timeout time in [microseconds].
Definition: CO_SYNC.h:89
CO_SYNC_t::CANtxBuff
CO_CANtx_t * CANtxBuff
CAN transmit buffer inside CANdevTx.
Definition: CO_SYNC.h:116
CO_SYNC_initCallbackPre
void CO_SYNC_initCallbackPre(CO_SYNC_t *SYNC, void *object, void(*pFunctSignalPre)(void *object))
Initialize SYNC callback function.
CO_SYNC_RECEIVED
@ CO_SYNC_RECEIVED
SYNC received.
Definition: CO_SYNC.h:124
CO_SYNC_t::counterOverflowValue
uint8_t counterOverflowValue
Value from Synchronous counter overflow value variable from Object dictionary (index 0x1019)
Definition: CO_SYNC.h:92
CO_SYNC_t::receiveError
uint16_t receiveError
Set to nonzero value, if SYNC with wrong data length is received from CAN.
Definition: CO_SYNC.h:106
CO_SYNC_t::CANrxToggle
bool_t CANrxToggle
Variable toggles, if new SYNC message received from CAN bus.
Definition: CO_SYNC.h:99
CO_SYNCsend
CO_ReturnError_t CO_SYNCsend(CO_SYNC_t *SYNC)
Send SYNC message.
CO_SYNC_t::timer
uint32_t timer
Timer for the SYNC message in [microseconds].
Definition: CO_SYNC.h:104
CO_SYNC_t::COB_ID
uint16_t COB_ID
COB_ID of SYNC message.
Definition: CO_SYNC.h:83
CO_SYNC_t::curentSyncTimeIsInsideWindow
bool_t curentSyncTimeIsInsideWindow
True, if current time is inside synchronous window.
Definition: CO_SYNC.h:95
CO_EM_t
Emergency object.
Definition: CO_Emergency.h:369
CO_NMT_internalState_t
CO_NMT_internalState_t
Internal network state of the CANopen node.
Definition: CO_NMT_Heartbeat.h:77
CO_SYNC_t::isProducer
bool_t isProducer
True, if device is SYNC producer.
Definition: CO_SYNC.h:80
CO_SYNC_t::CANrxNew
volatile void * CANrxNew
Indicates, if new SYNC message received from CAN bus.
Definition: CO_SYNC.h:97
CO_SYNC_t::functSignalObjectPre
void * functSignalObjectPre
From CO_SYNC_initCallbackPre() or NULL.
Definition: CO_SYNC.h:111
CO_SYNC_init
CO_ReturnError_t CO_SYNC_init(CO_SYNC_t *SYNC, CO_EM_t *em, CO_SDO_t *SDO, CO_NMT_internalState_t *operatingState, uint32_t COB_ID_SYNCMessage, uint32_t communicationCyclePeriod, uint8_t synchronousCounterOverflowValue, CO_CANmodule_t *CANdevRx, uint16_t CANdevRxIdx, CO_CANmodule_t *CANdevTx, uint16_t CANdevTxIdx)
Initialize SYNC object.
CO_CANmodule_t
Complete CAN module object.
Definition: CO_driver.h:319
CO_SYNC_t::em
CO_EM_t * em
From CO_SYNC_init()
Definition: CO_SYNC.h:76
CO_SYNC_t::CANdevTx
CO_CANmodule_t * CANdevTx
From CO_SYNC_init()
Definition: CO_SYNC.h:115
CO_SYNC_t
SYNC producer and consumer object.
Definition: CO_SYNC.h:75
CO_SYNC_t::CANdevRxIdx
uint16_t CANdevRxIdx
From CO_SYNC_init()
Definition: CO_SYNC.h:114
CO_SYNC_t::operatingState
CO_NMT_internalState_t * operatingState
From CO_SYNC_init()
Definition: CO_SYNC.h:77
CO_CANtx_t
Configuration object for CAN transmit message for specific CANopenNode Object.
Definition: CO_driver.h:299
uint8_t
unsigned char uint8_t
UNSIGNED8 in CANopen (0005h), 8-bit unsigned integer.
Definition: CO_driver.h:151
CO_SYNC_t::CANdevTxIdx
uint16_t CANdevTxIdx
From CO_SYNC_init()
Definition: CO_SYNC.h:117