CANopenNode
CO_TIME.h
Go to the documentation of this file.
1 
26 #ifndef CO_TIME_H
27 #define CO_TIME_H
28 
29 #include "301/CO_driver.h"
30 
31 /* default configuration, see CO_config.h */
32 #ifndef CO_CONFIG_TIME
33 #define CO_CONFIG_TIME (0)
34 #endif
35 
36 #if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE) || defined CO_DOXYGEN
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
79 #define TIME_MSG_LENGTH 6U
80 
81 #ifndef timeOfDay_t
82 typedef union {
83  unsigned long long ullValue;
84  struct {
85  unsigned long ms:28;
86  unsigned reserved:4;
87  unsigned days:16;
88  unsigned reserved2:16;
89  };
90 } timeOfDay_t;
91 #endif
92 
93 typedef timeOfDay_t TIME_OF_DAY;
94 typedef timeOfDay_t TIME_DIFFERENCE;
95 
99 typedef struct{
116  volatile void *CANrxNew;
122 #if ((CO_CONFIG_TIME) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
123 
124  void (*pFunctSignalPre)(void *object);
127 #endif
133  TIME_OF_DAY Time;
134 }CO_TIME_t;
135 
155  CO_TIME_t *TIME,
156  CO_EM_t *em,
157  CO_SDO_t *SDO,
158  CO_NMT_internalState_t *operatingState,
159  uint32_t COB_ID_TIMEMessage,
160  uint32_t TIMECyclePeriod,
161  CO_CANmodule_t *CANdevRx,
162  uint16_t CANdevRxIdx,
163  CO_CANmodule_t *CANdevTx,
164  uint16_t CANdevTxIdx);
165 
166 #if ((CO_CONFIG_TIME) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
167 
179  CO_TIME_t *TIME,
180  void *object,
181  void (*pFunctSignalPre)(void *object));
182 #endif
183 
196  CO_TIME_t *TIME,
197  uint32_t timeDifference_us);
198  /* CO_TIME */
200 
201 #ifdef __cplusplus
202 }
203 #endif /*__cplusplus*/
204 
205 #endif /* (CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE */
206 
207 #endif /* CO_TIME_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_TIME_t::functSignalObjectPre
void * functSignalObjectPre
From CO_TIME_initCallbackPre() or NULL.
Definition: CO_TIME.h:126
CO_TIME_t::TXbuff
CO_CANtx_t * TXbuff
CAN transmit buffer.
Definition: CO_TIME.h:132
CO_TIME_t::isProducer
bool_t isProducer
True, if device is TIME producer.
Definition: CO_TIME.h:107
uint16_t
unsigned int uint16_t
UNSIGNED16 in CANopen (0006h), 16-bit unsigned integer.
Definition: CO_driver.h:153
CO_TIME_t::CANdevTx
CO_CANmodule_t * CANdevTx
From CO_TIME_init()
Definition: CO_TIME.h:130
CO_TIME_initCallbackPre
void CO_TIME_initCallbackPre(CO_TIME_t *TIME, void *object, void(*pFunctSignalPre)(void *object))
Initialize TIME callback function.
CO_ReturnError_t
CO_ReturnError_t
Return values of some CANopen functions.
Definition: CO_driver.h:488
bool_t
unsigned char bool_t
Boolean data type for general use.
Definition: CO_driver.h:141
CO_TIME_t::periodTime
uint32_t periodTime
TIME period time in [milliseconds].
Definition: CO_TIME.h:111
CO_TIME_t::em
CO_EM_t * em
From CO_TIME_init()
Definition: CO_TIME.h:100
CO_TIME_t::COB_ID
uint16_t COB_ID
From CO_TIME_init()
Definition: CO_TIME.h:108
CO_TIME_t::CANdevRxIdx
uint16_t CANdevRxIdx
From CO_TIME_init()
Definition: CO_TIME.h:129
CO_TIME_t
TIME producer and consumer object.
Definition: CO_TIME.h:99
CO_TIME_t::CANrxNew
volatile void * CANrxNew
Variable indicates, if new TIME message received from CAN bus.
Definition: CO_TIME.h:116
CO_TIME_init
CO_ReturnError_t CO_TIME_init(CO_TIME_t *TIME, CO_EM_t *em, CO_SDO_t *SDO, CO_NMT_internalState_t *operatingState, uint32_t COB_ID_TIMEMessage, uint32_t TIMECyclePeriod, CO_CANmodule_t *CANdevRx, uint16_t CANdevRxIdx, CO_CANmodule_t *CANdevTx, uint16_t CANdevTxIdx)
Initialize TIME object.
CO_TIME_process
uint8_t CO_TIME_process(CO_TIME_t *TIME, uint32_t timeDifference_us)
Process TIME communication.
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_TIME_t::periodTimeoutTime
uint32_t periodTimeoutTime
TIME period timeout time in [milliseconds].
Definition: CO_TIME.h:114
CO_TIME_t::isConsumer
bool_t isConsumer
True, if device is TIME consumer.
Definition: CO_TIME.h:104
CO_CANmodule_t
Complete CAN module object.
Definition: CO_driver.h:319
CO_TIME_t::operatingState
CO_NMT_internalState_t * operatingState
From CO_TIME_init()
Definition: CO_TIME.h:101
CO_TIME_t::CANdevTxIdx
uint16_t CANdevTxIdx
From CO_TIME_init()
Definition: CO_TIME.h:131
CO_TIME_t::receiveError
uint16_t receiveError
Set to nonzero value, if TIME with wrong data length is received from CAN.
Definition: CO_TIME.h:121
CO_TIME_t::CANdevRx
CO_CANmodule_t * CANdevRx
From CO_TIME_init()
Definition: CO_TIME.h:128
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_TIME_t::timer
uint32_t timer
Timer for the TIME message in [microseconds].
Definition: CO_TIME.h:119