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

Go to the source code of this file.

Typedefs

typedef void co_tpdo_ind_t(co_tpdo_t *pdo, co_unsigned32_t ac, const void *ptr, size_t n, void *data)
 The type of a CANopen Transmit-PDO indication function, invoked when a PDO is sent or an error occurs. More...
 

Functions

co_tpdo_tco_tpdo_create (can_net_t *net, co_dev_t *dev, co_unsigned16_t num)
 Creates a new CANopen Transmit-PDO service. More...
 
void co_tpdo_destroy (co_tpdo_t *pdo)
 Destroys a CANopen Transmit-PDO service. More...
 
can_net_tco_tpdo_get_net (const co_tpdo_t *pdo)
 Returns a pointer to the CAN network of a Transmit-PDO.
 
co_dev_tco_tpdo_get_dev (const co_tpdo_t *pdo)
 Returns a pointer to the CANopen device of a Transmit-PDO.
 
co_unsigned16_t co_tpdo_get_num (const co_tpdo_t *pdo)
 Returns the PDO number of a Transmit-PDO.
 
const struct co_pdo_comm_parco_tpdo_get_comm_par (const co_tpdo_t *pdo)
 Returns a pointer to the PDO communication parameter record of a Transmit-PDO.
 
const struct co_pdo_map_parco_tpdo_get_map_par (const co_tpdo_t *pdo)
 Returns a pointer to the PDO mapping parameter record of a Transmit-PDO.
 
void co_tpdo_get_ind (const co_tpdo_t *pdo, co_tpdo_ind_t **pind, void **pdata)
 Retrieves the indication function invoked when a Transmit-PDO error occurs. More...
 
void co_tpdo_set_ind (co_tpdo_t *pdo, co_tpdo_ind_t *ind, void *data)
 Sets the indication function invoked when a Transmit-PDO error occurs. More...
 
int co_tpdo_event (co_tpdo_t *pdo)
 Triggers the transmission of an acyclic or event-driven PDO. More...
 
int co_tpdo_sync (co_tpdo_t *pdo, co_unsigned8_t cnt)
 Triggers the transmission of a synchronous PDO. More...
 
void co_tpdo_get_next (const co_tpdo_t *pdo, struct timespec *tp)
 Retrieves the time at which the next event-driven TPDO may be sent.
 

Detailed Description

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

Typedef Documentation

◆ co_tpdo_ind_t

typedef void co_tpdo_ind_t(co_tpdo_t *pdo, co_unsigned32_t ac, const void *ptr, size_t n, void *data)

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

Parameters
pdoa pointer to a Transmit-PDO service.
acthe SDO abort code: 0 on success, CO_SDO_AC_NO_OBJ, CO_SDO_AC_NO_PDO, CO_SDO_AC_NO_READ or CO_SDO_AC_PDO_LEN in case of a mapping error, or CO_SDO_AC_ERROR if an I/O error occurs.
ptra pointer to the bytes sent.
nthe number of bytes at ptr.
dataa pointer to user-specified data.

Definition at line 45 of file tpdo.h.

Function Documentation

◆ co_tpdo_create()

co_tpdo_t* co_tpdo_create ( can_net_t net,
co_dev_t dev,
co_unsigned16_t  num 
)

Creates a new CANopen Transmit-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 Transmit-PDO service, or NULL on error. In the latter case, the error number can be obtained with get_errc().
See also
co_tpdo_destroy()

Definition at line 269 of file tpdo.c.

◆ co_tpdo_destroy()

void co_tpdo_destroy ( co_tpdo_t pdo)

Destroys a CANopen Transmit-PDO service.

See also
co_tpdo_create()

Definition at line 296 of file tpdo.c.

◆ co_tpdo_get_ind()

void co_tpdo_get_ind ( const co_tpdo_t pdo,
co_tpdo_ind_t **  pind,
void **  pdata 
)

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

Parameters
pdoa pointer to a Transmit-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_tpdo_set_ind()

Definition at line 346 of file tpdo.c.

◆ co_tpdo_set_ind()

void co_tpdo_set_ind ( co_tpdo_t pdo,
co_tpdo_ind_t ind,
void *  data 
)

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

Parameters
pdoa pointer to a Transmit-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_tpdo_get_ind()

Definition at line 357 of file tpdo.c.

◆ co_tpdo_event()

int co_tpdo_event ( co_tpdo_t pdo)

Triggers the transmission of an acyclic or event-driven PDO.

This function returns an error if the inhibit time has not yet elapsed.

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

Definition at line 366 of file tpdo.c.

◆ co_tpdo_sync()

int co_tpdo_sync ( co_tpdo_t pdo,
co_unsigned8_t  cnt 
)

Triggers the transmission of a synchronous PDO.

Parameters
pdoa pointer to a Transmit-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().
See also
co_tpdo_event()

Definition at line 412 of file tpdo.c.