Lely core libraries  2.2.5
pdo.h File Reference
#include <lely/co/type.h>
Include dependency graph for pdo.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  co_pdo_comm_par
 A PDO communication parameter record. More...
 
struct  co_pdo_map_par
 A PDO mapping parameter record. More...
 

Macros

#define CO_PDO_COBID_VALID   UINT32_C(0x80000000)
 The bit in the PDO COB-ID specifying whether the PDO exists and is valid.
 
#define CO_PDO_COBID_RTR   UINT32_C(0x40000000)
 The bit in the PDO COB-ID specifying whether RTR is allowed.
 
#define CO_PDO_COBID_FRAME   UINT32_C(0x20000000)
 The bit in the PDO COB-ID specifying whether to use an 11-bit (0) or 29-bit (1) CAN-ID.
 
#define CO_DEFSTRUCT_PDO_COMM_PAR   0x0020
 The data type (and object index) of a PDO communication parameter record.
 
#define CO_PDO_COMM_PAR_INIT
 The static initializer from struct co_pdo_comm_par.
 
#define CO_DEFSTRUCT_PDO_MAP_PAR   0x0021
 The data type (and object index) of a PDO mapping parameter record.
 
#define CO_PDO_MAP_PAR_INIT
 The static initializer from struct co_pdo_map_par.
 

Functions

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. More...
 
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. More...
 
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 - 15FF (RPDO communication parameter). More...
 
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 (RPDO mapping parameter). More...
 
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. More...
 
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. More...
 
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 - 19FF (TPDO communication parameter). More...
 
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 (TPDO mapping parameter). More...
 
co_unsigned32_t co_pdo_map (const struct co_pdo_map_par *par, const co_unsigned64_t *val, co_unsigned8_t n, uint_least8_t *buf, size_t *pn)
 Maps values into a PDO. More...
 
co_unsigned32_t co_pdo_unmap (const struct co_pdo_map_par *par, const uint_least8_t *buf, size_t n, co_unsigned64_t *val, co_unsigned8_t *pn)
 Unmaps a PDO into its constituent values. More...
 
co_unsigned32_t co_pdo_dn (const struct co_pdo_map_par *par, co_dev_t *dev, struct co_sdo_req *req, const uint_least8_t *buf, size_t n)
 Writes mapped PDO values to the object dictionary through a local SDO download request. More...
 
co_unsigned32_t co_pdo_up (const struct co_pdo_map_par *par, const co_dev_t *dev, struct co_sdo_req *req, uint_least8_t *buf, size_t *pn)
 Reads mapped PDO values from the object dictionary through a local SDO upload request. More...
 

Detailed Description

This header file is part of the CANopen library; it contains the Process Data Object (PDO) declarations.

Author
J. S. Seldenthuis jseld.nosp@m.enth.nosp@m.uis@l.nosp@m.ely..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file pdo.h.

Function Documentation

◆ co_dev_chk_rpdo()

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.

Parameters
deva pointer to a CANopen device.
idxthe object index.
subidxthe object sub-index.
Returns
0 if the object is valid and can be mapped, or an SDO abort code on error.

Definition at line 42 of file pdo.c.

◆ co_dev_cfg_rpdo()

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.

This function disables the RPDO before configuring the parameters and re-enables it on success.

Parameters
deva pointer to a CANopen device.
numthe PDO number (in the range [1..512]).
comma pointer to the communication parameters.
mapa pointer to the mapping parameters.
Returns
0 on success, or an SDO abort code on error.
See also
co_dev_cfg_rpdo_comm(), co_dev_cfg_rpdo_map()

Definition at line 71 of file pdo.c.

◆ co_dev_cfg_rpdo_comm()

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 - 15FF (RPDO communication parameter).

Parameters
deva pointer to a CANopen device.
numthe PDO number (in the range [1..512]).
para pointer to the communication parameters.
Returns
0 on success, or an SDO abort code on error.

Definition at line 97 of file pdo.c.

◆ co_dev_cfg_rpdo_map()

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 (RPDO mapping parameter).

It is the responsibility of the caller to disable the RPDO before changing the mapping.

Parameters
deva pointer to a CANopen device.
numthe PDO number (in the range [1..512]).
para pointer to the mapping parameters.
Returns
0 on success, or an SDO abort code on error.

Definition at line 107 of file pdo.c.

◆ co_dev_chk_tpdo()

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.

Parameters
deva pointer to a CANopen device.
idxthe object index.
subidxthe object sub-index.
Returns
0 if the object is valid and can be mapped, or an SDO abort code on error.

Definition at line 117 of file pdo.c.

◆ co_dev_cfg_tpdo()

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.

This function disables the TPDO before configuring the parameters and re-enables it on success.

Parameters
deva pointer to a CANopen device.
numthe PDO number (in the range [1..512]).
comma pointer to the communication parameters.
mapa pointer to the mapping parameters.
Returns
0 on success, or an SDO abort code on error.
See also
co_dev_cfg_tpdo_comm(), co_dev_cfg_tpdo_map()

Definition at line 140 of file pdo.c.

◆ co_dev_cfg_tpdo_comm()

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 - 19FF (TPDO communication parameter).

Parameters
deva pointer to a CANopen device.
numthe PDO number (in the range [1..512]).
para pointer to the communication parameters.
Returns
0 on success, or an SDO abort code on error.

Definition at line 166 of file pdo.c.

◆ co_dev_cfg_tpdo_map()

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 (TPDO mapping parameter).

It is the responsibility of the caller to disable the TPDO before changing the mapping.

Parameters
deva pointer to a CANopen device.
numthe PDO number (in the range [1..512]).
para pointer to the mapping parameters.
Returns
0 on success, or an SDO abort code on error.

Definition at line 176 of file pdo.c.

◆ co_pdo_map()

co_unsigned32_t co_pdo_map ( const struct co_pdo_map_par par,
const co_unsigned64_t *  val,
co_unsigned8_t  n,
uint_least8_t *  buf,
size_t *  pn 
)

Maps values into a PDO.

Parameters
para pointer to the PDO mapping parameters.
vala pointer to the values to map.
nthe number of values at val.
bufthe address at which to store the mapped values (can be NULL).
pnthe address of a value containing the size (in bytes) of the buffer at buf. On exit, if pn is not NULL, *pn contains the number of bytes that would have been written had the buffer at buf been sufficiently large.
Returns
0 on success, or an SDO abort code on error.
See also
co_pdo_unmap()

Definition at line 186 of file pdo.c.

◆ co_pdo_unmap()

co_unsigned32_t co_pdo_unmap ( const struct co_pdo_map_par par,
const uint_least8_t *  buf,
size_t  n,
co_unsigned64_t *  val,
co_unsigned8_t *  pn 
)

Unmaps a PDO into its constituent values.

Parameters
para pointer to the PDO mapping parameters.
bufa pointer to the mapped values.
nthe number of bytes at buf.
valthe address at which to store the unmapped values (can be NULL).
pnthe address of a value containing the size (in number of values) of the buffer at val. On exit, if pn is not NULL, *pn contains the number of values that would have been written had the buffer at val been sufficiently large.
Returns
0 on success, or an SDO abort code on error.
See also
co_pdo_map()

Definition at line 220 of file pdo.c.

◆ co_pdo_dn()

co_unsigned32_t co_pdo_dn ( const struct co_pdo_map_par par,
co_dev_t dev,
struct co_sdo_req req,
const uint_least8_t *  buf,
size_t  n 
)

Writes mapped PDO values to the object dictionary through a local SDO download request.

Parameters
para pointer to the PDO mapping parameters.
deva pointer to a CANopen device.
reqa pointer to the CANopen SDO download request used for writing to the object dictionary.
bufa pointer to the mapped values.
nthe number of bytes at buf.
Returns
0 on success, or an SDO abort code on error.

Definition at line 254 of file pdo.c.

◆ co_pdo_up()

co_unsigned32_t co_pdo_up ( const struct co_pdo_map_par par,
const co_dev_t dev,
struct co_sdo_req req,
uint_least8_t *  buf,
size_t *  pn 
)

Reads mapped PDO values from the object dictionary through a local SDO upload request.

Parameters
para pointer to the PDO mapping parameters.
deva pointer to a CANopen device.
reqa pointer to the CANopen SDO upload request used for reading from the object dictionary.
bufthe address at which to store the mapped values (can be NULL).
pnthe address of a value containing the size (in bytes) of the buffer at buf. On exit, if pn is not NULL, *pn contains the number of bytes that would have been written had the buffer at buf been sufficiently large.
Returns
0 on success, or an SDO abort code on error.

Definition at line 308 of file pdo.c.