Lely core libraries
2.2.5
|
#include "co.h"
#include <lely/can/msg.h>
#include <lely/co/dev.h>
#include <lely/co/obj.h>
#include <lely/co/pdo.h>
#include <lely/co/sdo.h>
#include <lely/util/endian.h>
#include <assert.h>
Go to the source code of this file.
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... | |
This file is part of the CANopen library; it contains the implementation of the Process Data Object (PDO) functions.
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.c.
co_unsigned32_t co_dev_chk_rpdo | ( | const co_dev_t * | dev, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx | ||
) |
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.
dev | a pointer to a CANopen device. |
num | the PDO number (in the range [1..512]). |
comm | a pointer to the communication parameters. |
map | a pointer to the mapping parameters. |
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).
dev | a pointer to a CANopen device. |
num | the PDO number (in the range [1..512]). |
par | a pointer to the communication parameters. |
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.
dev | a pointer to a CANopen device. |
num | the PDO number (in the range [1..512]). |
par | a pointer to the mapping parameters. |
co_unsigned32_t co_dev_chk_tpdo | ( | const co_dev_t * | dev, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx | ||
) |
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.
dev | a pointer to a CANopen device. |
num | the PDO number (in the range [1..512]). |
comm | a pointer to the communication parameters. |
map | a pointer to the mapping parameters. |
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).
dev | a pointer to a CANopen device. |
num | the PDO number (in the range [1..512]). |
par | a pointer to the communication parameters. |
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.
dev | a pointer to a CANopen device. |
num | the PDO number (in the range [1..512]). |
par | a pointer to the mapping parameters. |
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.
par | a pointer to the PDO mapping parameters. |
val | a pointer to the values to map. |
n | the number of values at val. |
buf | the address at which to store the mapped values (can be NULL). |
pn | the 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. |
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.
par | a pointer to the PDO mapping parameters. |
buf | a pointer to the mapped values. |
n | the number of bytes at buf. |
val | the address at which to store the unmapped values (can be NULL). |
pn | the 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. |
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.
par | a pointer to the PDO mapping parameters. |
dev | a pointer to a CANopen device. |
req | a pointer to the CANopen SDO download request used for writing to the object dictionary. |
buf | a pointer to the mapped values. |
n | the number of bytes at buf. |
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.
par | a pointer to the PDO mapping parameters. |
dev | a pointer to a CANopen device. |
req | a pointer to the CANopen SDO upload request used for reading from the object dictionary. |
buf | the address at which to store the mapped values (can be NULL). |
pn | the 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. |