CO_TIME.h
Go to the documentation of this file.
#ifndef CO_TIME_H
#define CO_TIME_H
#include "301/CO_driver.h"
/* default configuration, see CO_config.h */
#ifndef CO_CONFIG_TIME
#define CO_CONFIG_TIME (0)
#endif
#if ((CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE) || defined CO_DOXYGEN
#ifdef __cplusplus
extern "C" {
#endif
#define TIME_MSG_LENGTH 6U
#ifndef timeOfDay_t
typedef union {
unsigned long long ullValue;
struct {
unsigned long ms:28;
unsigned reserved:4;
unsigned days:16;
unsigned reserved2:16;
};
} timeOfDay_t;
#endif
typedef timeOfDay_t TIME_OF_DAY;
typedef timeOfDay_t TIME_DIFFERENCE;
typedef struct{
CO_EM_t *em;
CO_NMT_internalState_t *operatingState;
bool_t isConsumer;
bool_t isProducer;
uint16_t COB_ID;
uint32_t periodTime;
uint32_t periodTimeoutTime;
volatile void *CANrxNew;
uint32_t timer;
uint16_t receiveError;
#if ((CO_CONFIG_TIME) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
void (*pFunctSignalPre)(void *object);
void *functSignalObjectPre;
#endif
CO_CANmodule_t *CANdevRx;
uint16_t CANdevRxIdx;
CO_CANmodule_t *CANdevTx;
uint16_t CANdevTxIdx;
CO_CANtx_t *TXbuff;
TIME_OF_DAY Time;
}CO_TIME_t;
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);
#if ((CO_CONFIG_TIME) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
void CO_TIME_initCallbackPre(
CO_TIME_t *TIME,
void *object,
void (*pFunctSignalPre)(void *object));
#endif
uint8_t CO_TIME_process(
CO_TIME_t *TIME,
uint32_t timeDifference_us);
/* CO_TIME */
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /* (CO_CONFIG_TIME) & CO_CONFIG_TIME_ENABLE */
#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