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

Go to the source code of this file.

Typedefs

typedef void co_rpdo_ind_t(co_rpdo_t *pdo, co_unsigned32_t ac, const void *ptr, size_t n, void *data)
 The type of a CANopen Receive-PDO indication function, invoked when a PDO is received or an error occurs. More...
 
typedef void co_rpdo_err_t(co_rpdo_t *pdo, co_unsigned16_t eec, co_unsigned8_t er, void *data)
 The type of a CANopen Receive-PDO error handling function, invoked in case of a timeout or length mismatch. More...
 

Functions

co_rpdo_tco_rpdo_create (can_net_t *net, co_dev_t *dev, co_unsigned16_t num)
 Creates a new CANopen Receive-PDO service. More...
 
void co_rpdo_destroy (co_rpdo_t *pdo)
 Destroys a CANopen Receive-PDO service. More...
 
can_net_tco_rpdo_get_net (const co_rpdo_t *pdo)
 Returns a pointer to the CAN network of a Receive-PDO.
 
co_dev_tco_rpdo_get_dev (const co_rpdo_t *pdo)
 Returns a pointer to the CANopen device of a Receive-PDO.
 
co_unsigned16_t co_rpdo_get_num (const co_rpdo_t *pdo)
 Returns the PDO number of a Receive-PDO.
 
const struct co_pdo_comm_parco_rpdo_get_comm_par (const co_rpdo_t *pdo)
 Returns a pointer to the PDO communication parameter record of a Receive-PDO.
 
const struct co_pdo_map_parco_rpdo_get_map_par (const co_rpdo_t *pdo)
 Returns a pointer to the PDO mapping parameter record of a Receive-PDO.
 
void co_rpdo_get_ind (const co_rpdo_t *pdo, co_rpdo_ind_t **pind, void **pdata)
 Retrieves the indication function invoked when a Receive-PDO error occurs. More...
 
void co_rpdo_set_ind (co_rpdo_t *pdo, co_rpdo_ind_t *ind, void *data)
 Sets the indication function invoked when a Receive-PDO error occurs. More...
 
void co_rpdo_get_err (const co_rpdo_t *pdo, co_rpdo_err_t **perr, void **pdata)
 Retrieves the error handling function of a Receive-PDO service. More...
 
void co_rpdo_set_err (co_rpdo_t *pdo, co_rpdo_err_t *err, void *data)
 Sets the error handling function of a Receive-PDO service. More...
 
int co_rpdo_sync (co_rpdo_t *pdo, co_unsigned8_t cnt)
 Triggers the actuation of a received synchronous PDO. More...
 
int co_rpdo_rtr (co_rpdo_t *pdo)
 Requests the transmission of a PDO. More...
 

Detailed Description

This header file is part of the CANopen library; it contains the Receive-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 rpdo.h.

Typedef Documentation

◆ co_rpdo_ind_t

typedef void co_rpdo_ind_t(co_rpdo_t *pdo, co_unsigned32_t ac, const void *ptr, size_t n, void *data)

The type of a CANopen Receive-PDO indication function, invoked when a PDO is received or an error occurs.

Parameters
pdoa pointer to a Receive-PDO service.
acthe SDO abort code: 0 on success, or CO_SDO_AC_NO_OBJ, CO_SDO_AC_NO_SUB, CO_SDO_AC_NO_WRITE, CO_SDO_AC_NO_PDO or CO_SDO_AC_PDO_LEN on error.
ptra pointer to the bytes received.
nthe number of bytes at ptr.
dataa pointer to user-specified data.

Definition at line 44 of file rpdo.h.

◆ co_rpdo_err_t

typedef void co_rpdo_err_t(co_rpdo_t *pdo, co_unsigned16_t eec, co_unsigned8_t er, void *data)

The type of a CANopen Receive-PDO error handling function, invoked in case of a timeout or length mismatch.

Parameters
pdoa pointer to a Receive-PDO service.
eecthe emergency error code (0x8210, 0x8220 or 0x8250).
erthe error register (0x10).
dataa pointer to user-specified data.

Definition at line 56 of file rpdo.h.

Function Documentation

◆ co_rpdo_create()

co_rpdo_t* co_rpdo_create ( can_net_t net,
co_dev_t dev,
co_unsigned16_t  num 
)

Creates a new CANopen Receive-PDO service.

Parameters
neta pointer to a CAN network.
deva pointer to a CANopen device describing the server.
numthe PDO number (in the range [1..512]). The PDO communication and mapping parameter records MUST exist in the object dictionary of dev.
Returns
a pointer to a new Receive-PDO service, or NULL on error. In the latter case, the error number can be obtained with get_errc().
See also
co_rpdo_destroy()

Definition at line 273 of file rpdo.c.

◆ co_rpdo_destroy()

void co_rpdo_destroy ( co_rpdo_t pdo)

Destroys a CANopen Receive-PDO service.

See also
co_rpdo_create()

Definition at line 300 of file rpdo.c.

◆ co_rpdo_get_ind()

void co_rpdo_get_ind ( const co_rpdo_t pdo,
co_rpdo_ind_t **  pind,
void **  pdata 
)

Retrieves the indication function invoked when a Receive-PDO error occurs.

Parameters
pdoa pointer to a Receive-PDO service.
pindthe address at which to store a pointer to the indication function (can be NULL).
pdatathe address at which to store a pointer to user-specified data (can be NULL).
See also
co_rpdo_set_ind()

Definition at line 350 of file rpdo.c.

◆ co_rpdo_set_ind()

void co_rpdo_set_ind ( co_rpdo_t pdo,
co_rpdo_ind_t ind,
void *  data 
)

Sets the indication function invoked when a Receive-PDO error occurs.

Parameters
pdoa pointer to a Receive-PDO service.
inda pointer to the function to be invoked.
dataa pointer to user-specified data (can be NULL). data is passed as the last parameter to ind.
See also
co_rpdo_get_ind()

Definition at line 361 of file rpdo.c.

◆ co_rpdo_get_err()

void co_rpdo_get_err ( const co_rpdo_t pdo,
co_rpdo_err_t **  perr,
void **  pdata 
)

Retrieves the error handling function of a Receive-PDO service.

Parameters
pdoa pointer to a Receive-PDO service.
perrthe address at which to store a pointer to the error handling function (can be NULL).
pdatathe address at which to store a pointer to user-specified data (can be NULL).
See also
co_rpdo_set_err()

Definition at line 370 of file rpdo.c.

◆ co_rpdo_set_err()

void co_rpdo_set_err ( co_rpdo_t pdo,
co_rpdo_err_t err,
void *  data 
)

Sets the error handling function of a Receive-PDO service.

Parameters
pdoa pointer to a Receive-PDO service.
erra pointer to the function to be invoked.
dataa pointer to user-specified data (can be NULL). data is passed as the last parameter to err.
See also
co_rpdo_get_err()

Definition at line 381 of file rpdo.c.

◆ co_rpdo_sync()

int co_rpdo_sync ( co_rpdo_t pdo,
co_unsigned8_t  cnt 
)

Triggers the actuation of a received synchronous PDO.

Parameters
pdoa pointer to a Receive-PDO service.
cntthe counter value (in the range [0..240]).
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().

Definition at line 411 of file rpdo.c.

◆ co_rpdo_rtr()

int co_rpdo_rtr ( co_rpdo_t pdo)

Requests the transmission of a PDO.

Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().

Definition at line 390 of file rpdo.c.