CANopenNode
CO_PDO.h
Go to the documentation of this file.
1 
26 #ifndef CO_PDO_H
27 #define CO_PDO_H
28 
29 #include "301/CO_driver.h"
30 #include "301/CO_SDOserver.h"
31 #include "301/CO_Emergency.h"
32 #include "301/CO_NMT_Heartbeat.h"
33 #include "301/CO_SYNC.h"
34 
35 /* default configuration, see CO_config.h */
36 #ifndef CO_CONFIG_PDO
37 #define CO_CONFIG_PDO (CO_CONFIG_RPDO_ENABLE | \
38  CO_CONFIG_TPDO_ENABLE | \
39  CO_CONFIG_PDO_SYNC_ENABLE)
40 #endif
41 
42 #if ((CO_CONFIG_PDO) & (CO_CONFIG_RPDO_ENABLE | CO_CONFIG_TPDO_ENABLE)) || defined CO_DOXYGEN
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
80 typedef struct{
95 
96 
100 typedef struct{
117 
118 
122 typedef struct{
152 
153 
157 typedef struct{
174 
175 
179 typedef struct{
181  CO_SDO_t *SDO;
193  uint8_t *mapPointer[8];
194 #if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) || defined CO_DOXYGEN
199  volatile void *CANrxNew[2];
201  uint8_t CANrxData[2][8];
202 #else
203  volatile void *CANrxNew[1];
204  uint8_t CANrxData[1][8];
205 #endif
206 #if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
207 
208  void (*pFunctSignalPre)(void *object);
211 #endif
214 }CO_RPDO_t;
215 
216 
220 typedef struct{
222  CO_SDO_t *SDO;
236  uint8_t *mapPointer[8];
245 #if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) || defined CO_DOXYGEN
246 
249 #endif
253 }CO_TPDO_t;
254 
255 
287  CO_RPDO_t *RPDO,
288  CO_EM_t *em,
289  CO_SDO_t *SDO,
290 #if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) || defined CO_DOXYGEN
291  CO_SYNC_t *SYNC,
292 #endif
293  CO_NMT_internalState_t *operatingState,
294  uint8_t nodeId,
295  uint16_t defaultCOB_ID,
296  uint8_t restrictionFlags,
297  const CO_RPDOCommPar_t *RPDOCommPar,
298  const CO_RPDOMapPar_t *RPDOMapPar,
299  uint16_t idx_RPDOCommPar,
300  uint16_t idx_RPDOMapPar,
301  CO_CANmodule_t *CANdevRx,
302  uint16_t CANdevRxIdx);
303 
304 
305 #if ((CO_CONFIG_PDO) & CO_CONFIG_FLAG_CALLBACK_PRE) || defined CO_DOXYGEN
306 
318  CO_RPDO_t *RPDO,
319  void *object,
320  void (*pFunctSignalPre)(void *object));
321 #endif
322 
323 
355  CO_TPDO_t *TPDO,
356  CO_EM_t *em,
357  CO_SDO_t *SDO,
358 #if ((CO_CONFIG_PDO) & CO_CONFIG_PDO_SYNC_ENABLE) || defined CO_DOXYGEN
359  CO_SYNC_t *SYNC,
360 #endif
361  CO_NMT_internalState_t *operatingState,
362  uint8_t nodeId,
363  uint16_t defaultCOB_ID,
364  uint8_t restrictionFlags,
365  const CO_TPDOCommPar_t *TPDOCommPar,
366  const CO_TPDOMapPar_t *TPDOMapPar,
367  uint16_t idx_TPDOCommPar,
368  uint16_t idx_TPDOMapPar,
369  CO_CANmodule_t *CANdevTx,
370  uint16_t CANdevTxIdx);
371 
372 
388 
389 
402 
403 
414 void CO_RPDO_process(CO_RPDO_t *RPDO, bool_t syncWas);
415 
416 
429 void CO_TPDO_process(
430  CO_TPDO_t *TPDO,
431  bool_t syncWas,
432  uint32_t timeDifference_us,
433  uint32_t *timerNext_us);
434  /* CO_PDO */
436 
437 #ifdef __cplusplus
438 }
439 #endif /*__cplusplus*/
440 
441 #endif /* (CO_CONFIG_PDO) & (CO_CONFIG_RPDO_ENABLE | CO_CONFIG_TPDO_ENABLE) */
442 
443 #endif /* CO_PDO_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_RPDOCommPar_t::COB_IDUsedByRPDO
uint32_t COB_IDUsedByRPDO
Communication object identifier for message received.
Definition: CO_PDO.h:87
CO_TPDOCommPar_t::compatibilityEntry
uint8_t compatibilityEntry
Not used.
Definition: CO_PDO.h:142
CO_RPDOMapPar_t::mappedObject4
uint32_t mappedObject4
Same.
Definition: CO_PDO.h:111
CO_TPDOMapPar_t::mappedObject5
uint32_t mappedObject5
Same.
Definition: CO_PDO.h:169
CO_RPDO_t::functSignalObjectPre
void * functSignalObjectPre
From CO_RPDO_initCallbackPre() or NULL.
Definition: CO_PDO.h:210
CO_TPDOMapPar_t::mappedObject8
uint32_t mappedObject8
Same.
Definition: CO_PDO.h:172
CO_TPDOCommPar_t::SYNCStartValue
uint8_t SYNCStartValue
Used with numbered SYNC messages.
Definition: CO_PDO.h:150
CO_RPDO_t
RPDO object.
Definition: CO_PDO.h:179
CO_RPDO_t::em
CO_EM_t * em
From CO_RPDO_init()
Definition: CO_PDO.h:180
CO_RPDO_t::nodeId
uint8_t nodeId
From CO_RPDO_init()
Definition: CO_PDO.h:185
CO_TPDOCommPar_t::inhibitTime
uint16_t inhibitTime
Minimum time between transmissions of the PDO in 100micro seconds.
Definition: CO_PDO.h:140
CO_TPDO_t::sendRequest
uint8_t sendRequest
If application set this flag, PDO will be later sent by function CO_TPDO_process().
Definition: CO_PDO.h:234
CO_TPDO_t::defaultCOB_ID
uint16_t defaultCOB_ID
From CO_TPDO_init()
Definition: CO_PDO.h:227
CO_TPDO_t::CANdevTxIdx
uint16_t CANdevTxIdx
From CO_TPDO_init()
Definition: CO_PDO.h:252
uint16_t
unsigned int uint16_t
UNSIGNED16 in CANopen (0006h), 16-bit unsigned integer.
Definition: CO_driver.h:153
CO_RPDO_t::SDO
CO_SDO_t * SDO
From CO_RPDO_init()
Definition: CO_PDO.h:181
CO_RPDO_t::operatingState
CO_NMT_internalState_t * operatingState
From CO_RPDO_init()
Definition: CO_PDO.h:184
CO_ReturnError_t
CO_ReturnError_t
Return values of some CANopen functions.
Definition: CO_driver.h:488
CO_TPDO_process
void CO_TPDO_process(CO_TPDO_t *TPDO, bool_t syncWas, uint32_t timeDifference_us, uint32_t *timerNext_us)
Process transmitting PDO messages.
CO_RPDOMapPar_t
RPDO mapping parameter.
Definition: CO_PDO.h:100
CO_RPDOMapPar_t::mappedObject1
uint32_t mappedObject1
Location and size of the mapped object.
Definition: CO_PDO.h:108
CO_TPDO_t::TPDOMapPar
const CO_TPDOMapPar_t * TPDOMapPar
From CO_TPDO_init()
Definition: CO_PDO.h:224
bool_t
unsigned char bool_t
Boolean data type for general use.
Definition: CO_driver.h:141
CO_TPDOMapPar_t::mappedObject6
uint32_t mappedObject6
Same.
Definition: CO_PDO.h:170
CO_RPDO_t::restrictionFlags
uint8_t restrictionFlags
From CO_RPDO_init()
Definition: CO_PDO.h:187
CO_RPDOMapPar_t::mappedObject6
uint32_t mappedObject6
Same.
Definition: CO_PDO.h:113
CO_RPDOCommPar_t::transmissionType
uint8_t transmissionType
Transmission type.
Definition: CO_PDO.h:93
CO_TPDOCommPar_t::eventTimer
uint16_t eventTimer
Time between periodic transmissions of the PDO in milliseconds.
Definition: CO_PDO.h:145
CO_RPDOCommPar_t::maxSubIndex
uint8_t maxSubIndex
Equal to 2.
Definition: CO_PDO.h:81
CO_RPDO_process
void CO_RPDO_process(CO_RPDO_t *RPDO, bool_t syncWas)
Process received PDO messages.
CO_TPDO_t::SDO
CO_SDO_t * SDO
From CO_TPDO_init()
Definition: CO_PDO.h:222
CO_TPDO_t::operatingState
CO_NMT_internalState_t * operatingState
From CO_TPDO_init()
Definition: CO_PDO.h:225
CO_TPDOCommPar_t::COB_IDUsedByTPDO
uint32_t COB_IDUsedByTPDO
Communication object identifier for transmitting message.
Definition: CO_PDO.h:129
CO_TPDOsend
CO_ReturnError_t CO_TPDOsend(CO_TPDO_t *TPDO)
Send TPDO message.
CO_TPDO_t::SYNC
CO_SYNC_t * SYNC
From CO_TPDO_init()
Definition: CO_PDO.h:248
CO_RPDO_t::synchronous
bool_t synchronous
True, if PDO synchronous (transmissionType <= 240)
Definition: CO_PDO.h:197
CO_RPDOMapPar_t::mappedObject3
uint32_t mappedObject3
Same.
Definition: CO_PDO.h:110
CO_TPDOisCOS
uint8_t CO_TPDOisCOS(CO_TPDO_t *TPDO)
Verify Change of State of the PDO.
CO_SDOserver.h
CANopen Service Data Object - server protocol.
CO_SYNC.h
CANopen Synchronisation protocol.
CO_RPDOMapPar_t::numberOfMappedObjects
uint8_t numberOfMappedObjects
Actual number of mapped objects from 0 to 8.
Definition: CO_PDO.h:103
CO_RPDOMapPar_t::mappedObject2
uint32_t mappedObject2
Same.
Definition: CO_PDO.h:109
CO_TPDOMapPar_t::mappedObject2
uint32_t mappedObject2
Same.
Definition: CO_PDO.h:166
CO_TPDO_t::inhibitTimer
uint32_t inhibitTimer
Inhibit timer used for inhibit PDO sending translated to microseconds.
Definition: CO_PDO.h:238
CO_TPDOMapPar_t::mappedObject1
uint32_t mappedObject1
Location and size of the mapped object.
Definition: CO_PDO.h:165
CO_RPDO_t::defaultCOB_ID
uint16_t defaultCOB_ID
From CO_RPDO_init()
Definition: CO_PDO.h:186
CO_TPDOMapPar_t::numberOfMappedObjects
uint8_t numberOfMappedObjects
Actual number of mapped objects from 0 to 8.
Definition: CO_PDO.h:160
CO_TPDOMapPar_t::mappedObject7
uint32_t mappedObject7
Same.
Definition: CO_PDO.h:171
CO_TPDO_t::nodeId
uint8_t nodeId
From CO_TPDO_init()
Definition: CO_PDO.h:226
CO_RPDOMapPar_t::mappedObject5
uint32_t mappedObject5
Same.
Definition: CO_PDO.h:112
CO_TPDO_t::restrictionFlags
uint8_t restrictionFlags
From CO_TPDO_init()
Definition: CO_PDO.h:228
CO_RPDO_t::dataLength
uint8_t dataLength
Data length of the received PDO message.
Definition: CO_PDO.h:191
CO_RPDO_t::CANdevRx
CO_CANmodule_t * CANdevRx
From CO_RPDO_init()
Definition: CO_PDO.h:212
CO_TPDO_t::CANtxBuff
CO_CANtx_t * CANtxBuff
CAN transmit buffer inside CANdev.
Definition: CO_PDO.h:251
CO_RPDOCommPar_t
RPDO communication parameter.
Definition: CO_PDO.h:80
CO_TPDO_t::em
CO_EM_t * em
From CO_TPDO_init()
Definition: CO_PDO.h:221
CO_CONFIG_PDO
#define CO_CONFIG_PDO
Configuration of PDO.
Definition: CO_config.h:453
CO_RPDOMapPar_t::mappedObject8
uint32_t mappedObject8
Same.
Definition: CO_PDO.h:115
CO_RPDO_t::SYNC
CO_SYNC_t * SYNC
From CO_RPDO_init()
Definition: CO_PDO.h:195
CO_TPDO_t::TPDOCommPar
const CO_TPDOCommPar_t * TPDOCommPar
From CO_TPDO_init()
Definition: CO_PDO.h:223
CO_TPDO_t::syncCounter
uint8_t syncCounter
SYNC counter used for PDO sending.
Definition: CO_PDO.h:247
CO_EM_t
Emergency object.
Definition: CO_Emergency.h:369
CO_TPDOCommPar_t
TPDO communication parameter.
Definition: CO_PDO.h:122
CO_TPDOMapPar_t::mappedObject3
uint32_t mappedObject3
Same.
Definition: CO_PDO.h:167
CO_NMT_internalState_t
CO_NMT_internalState_t
Internal network state of the CANopen node.
Definition: CO_NMT_Heartbeat.h:77
CO_NMT_Heartbeat.h
CANopen Network management and Heartbeat producer protocol.
CO_TPDOCommPar_t::transmissionType
uint8_t transmissionType
Transmission type.
Definition: CO_PDO.h:137
CO_TPDO_t::valid
bool_t valid
True, if PDO is enabled and valid.
Definition: CO_PDO.h:229
CO_TPDOMapPar_t::mappedObject4
uint32_t mappedObject4
Same.
Definition: CO_PDO.h:168
CO_Emergency.h
CANopen Emergency protocol.
CO_RPDO_initCallbackPre
void CO_RPDO_initCallbackPre(CO_RPDO_t *RPDO, void *object, void(*pFunctSignalPre)(void *object))
Initialize RPDO callback function.
CO_TPDOMapPar_t
TPDO mapping parameter.
Definition: CO_PDO.h:157
CO_CANmodule_t
Complete CAN module object.
Definition: CO_driver.h:319
CO_RPDO_init
CO_ReturnError_t CO_RPDO_init(CO_RPDO_t *RPDO, CO_EM_t *em, CO_SDO_t *SDO, CO_SYNC_t *SYNC, CO_NMT_internalState_t *operatingState, uint8_t nodeId, uint16_t defaultCOB_ID, uint8_t restrictionFlags, const CO_RPDOCommPar_t *RPDOCommPar, const CO_RPDOMapPar_t *RPDOMapPar, uint16_t idx_RPDOCommPar, uint16_t idx_RPDOMapPar, CO_CANmodule_t *CANdevRx, uint16_t CANdevRxIdx)
Initialize RPDO object.
CO_TPDO_t::eventTimer
uint32_t eventTimer
Event timer used for PDO sending translated to microseconds.
Definition: CO_PDO.h:240
CO_TPDOCommPar_t::maxSubIndex
uint8_t maxSubIndex
Equal to 6.
Definition: CO_PDO.h:123
CO_RPDO_t::RPDOMapPar
const CO_RPDOMapPar_t * RPDOMapPar
From CO_RPDO_init()
Definition: CO_PDO.h:183
CO_SYNC_t
SYNC producer and consumer object.
Definition: CO_SYNC.h:75
CO_TPDO_t::dataLength
uint8_t dataLength
Data length of the transmitting PDO message.
Definition: CO_PDO.h:231
CO_RPDO_t::CANdevRxIdx
uint16_t CANdevRxIdx
From CO_RPDO_init()
Definition: CO_PDO.h:213
CO_RPDO_t::valid
bool_t valid
True, if PDO is enabled and valid.
Definition: CO_PDO.h:189
CO_TPDO_init
CO_ReturnError_t CO_TPDO_init(CO_TPDO_t *TPDO, CO_EM_t *em, CO_SDO_t *SDO, CO_SYNC_t *SYNC, CO_NMT_internalState_t *operatingState, uint8_t nodeId, uint16_t defaultCOB_ID, uint8_t restrictionFlags, const CO_TPDOCommPar_t *TPDOCommPar, const CO_TPDOMapPar_t *TPDOMapPar, uint16_t idx_TPDOCommPar, uint16_t idx_TPDOMapPar, CO_CANmodule_t *CANdevTx, uint16_t CANdevTxIdx)
Initialize TPDO object.
CO_TPDO_t::CANdevTx
CO_CANmodule_t * CANdevTx
From CO_TPDO_init()
Definition: CO_PDO.h:250
CO_RPDO_t::RPDOCommPar
const CO_RPDOCommPar_t * RPDOCommPar
From CO_RPDO_init()
Definition: CO_PDO.h:182
CO_CANtx_t
Configuration object for CAN transmit message for specific CANopenNode Object.
Definition: CO_driver.h:299
CO_TPDO_t
TPDO object.
Definition: CO_PDO.h:220
CO_TPDO_t::sendIfCOSFlags
uint8_t sendIfCOSFlags
Each flag bit is connected with one mapPointer.
Definition: CO_PDO.h:244
uint8_t
unsigned char uint8_t
UNSIGNED8 in CANopen (0005h), 8-bit unsigned integer.
Definition: CO_driver.h:151
CO_RPDOMapPar_t::mappedObject7
uint32_t mappedObject7
Same.
Definition: CO_PDO.h:114