Lely core libraries 1.9.2
pdo.h
Go to the documentation of this file.
1
22#ifndef LELY_CO_PDO_H_
23#define LELY_CO_PDO_H_
24
25#include <lely/co/type.h>
26
28#define CO_PDO_COBID_VALID UINT32_C(0x80000000)
29
31#define CO_PDO_COBID_RTR UINT32_C(0x40000000)
32
37#define CO_PDO_COBID_FRAME UINT32_C(0x20000000)
38
40#define CO_DEFSTRUCT_PDO_COMM_PAR 0x0020
41
45 co_unsigned8_t n;
47 co_unsigned32_t cobid;
49 co_unsigned8_t trans;
51 co_unsigned16_t inhibit;
52 co_unsigned8_t reserved;
54 co_unsigned16_t event;
56 co_unsigned8_t sync;
57};
58
60#define CO_PDO_COMM_PAR_INIT \
61 { \
62 6, CO_PDO_COBID_VALID, 0, 0, 0, 0, 0 \
63 }
64
66#define CO_DEFSTRUCT_PDO_MAP_PAR 0x0021
67
71 co_unsigned8_t n;
73 co_unsigned32_t map[0x40];
74};
75
77// clang-format off
78#define CO_PDO_MAP_PAR_INIT \
79 { \
80 0, \
81 { \
82 0, 0, 0, 0, 0, 0, 0, 0, \
83 0, 0, 0, 0, 0, 0, 0, 0, \
84 0, 0, 0, 0, 0, 0, 0, 0, \
85 0, 0, 0, 0, 0, 0, 0, 0, \
86 0, 0, 0, 0, 0, 0, 0, 0, \
87 0, 0, 0, 0, 0, 0, 0, 0, \
88 0, 0, 0, 0, 0, 0, 0, 0, \
89 0, 0, 0, 0, 0, 0, 0, 0 \
90 } \
91 }
92// clang-format on
93
94// The CANopen SDO upload/download request from lely/co/sdo.h.
95struct co_sdo_req;
96
97#ifdef __cplusplus
98extern "C" {
99#endif
100
111co_unsigned32_t co_dev_chk_rpdo(const co_dev_t *dev, co_unsigned16_t idx,
112 co_unsigned8_t subidx);
113
128co_unsigned32_t co_dev_cfg_rpdo(const co_dev_t *dev, co_unsigned16_t num,
129 const struct co_pdo_comm_par *comm,
130 const struct co_pdo_map_par *map);
131
142co_unsigned32_t co_dev_cfg_rpdo_comm(const co_dev_t *dev, co_unsigned16_t num,
143 const struct co_pdo_comm_par *par);
144
156co_unsigned32_t co_dev_cfg_rpdo_map(const co_dev_t *dev, co_unsigned16_t num,
157 const struct co_pdo_map_par *par);
158
170co_unsigned32_t co_dev_chk_tpdo(const co_dev_t *dev, co_unsigned16_t idx,
171 co_unsigned8_t subidx);
172
187co_unsigned32_t co_dev_cfg_tpdo(const co_dev_t *dev, co_unsigned16_t num,
188 const struct co_pdo_comm_par *comm,
189 const struct co_pdo_map_par *map);
190
201co_unsigned32_t co_dev_cfg_tpdo_comm(const co_dev_t *dev, co_unsigned16_t num,
202 const struct co_pdo_comm_par *par);
203
215co_unsigned32_t co_dev_cfg_tpdo_map(const co_dev_t *dev, co_unsigned16_t num,
216 const struct co_pdo_map_par *par);
217
234co_unsigned32_t co_pdo_map(const struct co_pdo_map_par *par,
235 const co_unsigned64_t *val, co_unsigned8_t n, uint8_t *buf,
236 size_t *pn);
237
254co_unsigned32_t co_pdo_unmap(const struct co_pdo_map_par *par,
255 const uint8_t *buf, size_t n, co_unsigned64_t *val,
256 co_unsigned8_t *pn);
257
271co_unsigned32_t co_pdo_dn(const struct co_pdo_map_par *par, co_dev_t *dev,
272 struct co_sdo_req *req, const uint8_t *buf, size_t n);
273
290co_unsigned32_t co_pdo_up(const struct co_pdo_map_par *par, const co_dev_t *dev,
291 struct co_sdo_req *req, uint8_t *buf, size_t *pn);
292
293#ifdef __cplusplus
294}
295#endif
296
297#endif // !LELY_CO_PDO_H_
co_unsigned32_t co_dev_chk_rpdo(const co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx)
Checks if the specified object is valid and can be mapped into a Receive-PDO.
Definition: pdo.c:42
co_unsigned32_t co_dev_cfg_rpdo_comm(const co_dev_t *dev, co_unsigned16_t num, const struct co_pdo_comm_par *par)
Configures the communication parameters of a Receive-PDO service by updating CANopen object 1400 - 15...
Definition: pdo.c:100
co_unsigned32_t co_dev_cfg_tpdo_comm(const co_dev_t *dev, co_unsigned16_t num, const struct co_pdo_comm_par *par)
Configures the communication parameters of a Transmit-PDO service by updating CANopen object 1800 - 1...
Definition: pdo.c:172
co_unsigned32_t co_dev_cfg_rpdo(const co_dev_t *dev, co_unsigned16_t num, const struct co_pdo_comm_par *comm, const struct co_pdo_map_par *map)
Configures the communication and parameters of a Receive-PDO service.
Definition: pdo.c:74
co_unsigned32_t co_pdo_up(const struct co_pdo_map_par *par, const co_dev_t *dev, struct co_sdo_req *req, uint8_t *buf, size_t *pn)
Reads mapped PDO values from the object dictionary through a local SDO upload request.
Definition: pdo.c:305
co_unsigned32_t co_dev_cfg_tpdo(const co_dev_t *dev, co_unsigned16_t num, const struct co_pdo_comm_par *comm, const struct co_pdo_map_par *map)
Configures the communication and parameters of a Transmit-PDO service.
Definition: pdo.c:146
co_unsigned32_t co_dev_chk_tpdo(const co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx)
Checks if the specified object is valid and can be mapped into a Transmit-PDO.
Definition: pdo.c:120
co_unsigned32_t co_pdo_unmap(const struct co_pdo_map_par *par, const uint8_t *buf, size_t n, co_unsigned64_t *val, co_unsigned8_t *pn)
Unmaps a PDO into its constituent values.
Definition: pdo.c:223
co_unsigned32_t co_pdo_dn(const struct co_pdo_map_par *par, co_dev_t *dev, struct co_sdo_req *req, const uint8_t *buf, size_t n)
Writes mapped PDO values to the object dictionary through a local SDO download request.
Definition: pdo.c:254
co_unsigned32_t co_dev_cfg_tpdo_map(const co_dev_t *dev, co_unsigned16_t num, const struct co_pdo_map_par *par)
Configures the mapping parameters of a Transmit-PDO service by updating CANopen object 1A00 - 1BFF (T...
Definition: pdo.c:182
co_unsigned32_t co_dev_cfg_rpdo_map(const co_dev_t *dev, co_unsigned16_t num, const struct co_pdo_map_par *par)
Configures the mapping parameters of a Receive-PDO service by updating CANopen object 1600 - 17FF (RP...
Definition: pdo.c:110
co_unsigned32_t co_pdo_map(const struct co_pdo_map_par *par, const co_unsigned64_t *val, co_unsigned8_t n, uint8_t *buf, size_t *pn)
Maps values into a PDO.
Definition: pdo.c:192
A CANopen device.
Definition: dev.c:38
A PDO communication parameter record.
Definition: pdo.h:43
co_unsigned8_t sync
SYNC start value.
Definition: pdo.h:56
co_unsigned16_t inhibit
Inhibit time.
Definition: pdo.h:51
co_unsigned16_t event
Event timer.
Definition: pdo.h:54
co_unsigned32_t cobid
COB-ID.
Definition: pdo.h:47
co_unsigned8_t trans
Transmission type.
Definition: pdo.h:49
co_unsigned8_t n
Highest sub-index supported.
Definition: pdo.h:45
A PDO mapping parameter record.
Definition: pdo.h:69
co_unsigned8_t n
Number of mapped objects in PDO.
Definition: pdo.h:71
co_unsigned32_t map[0x40]
An array of objects to be mapped.
Definition: pdo.h:73
A CANopen SDO upload/download request.
Definition: sdo.h:178
const void * buf
A pointer to the next bytes to be uploaded/downloaded.
Definition: sdo.h:186
This header file is part of the CANopen library; it contains the CANopen type definitions.