Lely core libraries  2.3.4
dev.c File Reference
#include "co.h"
#include <lely/co/detail/dev.h>
#include <lely/co/detail/obj.h>
#include <lely/util/cmp.h>
#include <lely/util/diag.h>
#include <lely/co/pdo.h>
#include <assert.h>
#include <stdlib.h>
#include <lely/co/def/basic.def>
Include dependency graph for dev.c:

Go to the source code of this file.

Functions

co_dev_tco_dev_create (co_unsigned8_t id)
 Creates a new CANopen device. More...
 
void co_dev_destroy (co_dev_t *dev)
 Destroys a CANopen device, including all objects in its object dictionary. More...
 
co_unsigned8_t co_dev_get_netid (const co_dev_t *dev)
 Returns the network-ID of a CANopen device. More...
 
int co_dev_set_netid (co_dev_t *dev, co_unsigned8_t id)
 Sets the network-ID of a CANopen device. More...
 
co_unsigned8_t co_dev_get_id (const co_dev_t *dev)
 Returns the node-ID of a CANopen device. More...
 
int co_dev_set_id (co_dev_t *dev, co_unsigned8_t id)
 Sets the node-ID of a CANopen device. More...
 
co_unsigned16_t co_dev_get_idx (const co_dev_t *dev, co_unsigned16_t maxidx, co_unsigned16_t *idx)
 Retrieves a list of object indices in the object dictionary of a CANopen device. More...
 
int co_dev_insert_obj (co_dev_t *dev, co_obj_t *obj)
 Inserts an object into the object dictionary of a CANopen device. More...
 
int co_dev_remove_obj (co_dev_t *dev, co_obj_t *obj)
 Removes an object from the object dictionary a CANopen device. More...
 
co_obj_tco_dev_find_obj (const co_dev_t *dev, co_unsigned16_t idx)
 Finds an object in the object dictionary of a CANopen device. More...
 
co_sub_tco_dev_find_sub (const co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx)
 Finds a sub-object in the object dictionary of a CANopen device. More...
 
co_obj_tco_dev_first_obj (const co_dev_t *dev)
 Finds the first object (with the lowest index) in the object dictionary of a CANopen device. More...
 
co_obj_tco_dev_last_obj (const co_dev_t *dev)
 Finds the last object (with the highest index) in the object dictionary of a CANopen device. More...
 
const char * co_dev_get_name (const co_dev_t *dev)
 Returns the name of a CANopen device. More...
 
int co_dev_set_name (co_dev_t *dev, const char *name)
 Sets the name of a CANopen device. More...
 
const char * co_dev_get_vendor_name (const co_dev_t *dev)
 Returns a pointer to the vendor name of a CANopen device. More...
 
int co_dev_set_vendor_name (co_dev_t *dev, const char *vendor_name)
 Sets the vendor name of a CANopen device. More...
 
co_unsigned32_t co_dev_get_vendor_id (const co_dev_t *dev)
 Returns the vendor ID of a CANopen device. More...
 
void co_dev_set_vendor_id (co_dev_t *dev, co_unsigned32_t vendor_id)
 Sets the vendor ID of a CANopen device. More...
 
const char * co_dev_get_product_name (const co_dev_t *dev)
 Returns a pointer to the product name of a CANopen device. More...
 
int co_dev_set_product_name (co_dev_t *dev, const char *product_name)
 Sets the product name of a CANopen device. More...
 
co_unsigned32_t co_dev_get_product_code (const co_dev_t *dev)
 Returns the product code of a CANopen device. More...
 
void co_dev_set_product_code (co_dev_t *dev, co_unsigned32_t product_code)
 Sets the product code of a CANopen device. More...
 
co_unsigned32_t co_dev_get_revision (const co_dev_t *dev)
 Returns the revision number of a CANopen device. More...
 
void co_dev_set_revision (co_dev_t *dev, co_unsigned32_t revision)
 Sets the revision number of a CANopen device. More...
 
const char * co_dev_get_order_code (const co_dev_t *dev)
 Returns a pointer to the order code of a CANopen device. More...
 
int co_dev_set_order_code (co_dev_t *dev, const char *order_code)
 Sets the order code of a CANopen device. More...
 
unsigned int co_dev_get_baud (const co_dev_t *dev)
 Returns the supported bit rates of a CANopen device (any combination of CO_BAUD_1000, CO_BAUD_800, CO_BAUD_500, CO_BAUD_250, CO_BAUD_125, CO_BAUD_50, CO_BAUD_20, CO_BAUD_10 and CO_BAUD_AUTO). More...
 
void co_dev_set_baud (co_dev_t *dev, unsigned int baud)
 Sets the supported bit rates of a CANopen device. More...
 
co_unsigned16_t co_dev_get_rate (const co_dev_t *dev)
 Returns the (pending) baudrate of a CANopen device (in kbit/s). More...
 
void co_dev_set_rate (co_dev_t *dev, co_unsigned16_t rate)
 Sets the (pending) baudrate of a CANopen device. More...
 
int co_dev_get_lss (const co_dev_t *dev)
 Returns 1 if LSS is supported and 0 if not. More...
 
void co_dev_set_lss (co_dev_t *dev, int lss)
 Sets the LSS support flag. More...
 
co_unsigned32_t co_dev_get_dummy (const co_dev_t *dev)
 Returns the data types supported by a CANopen device for mapping dummy entries in PDOs (one bit for each of the basic types). More...
 
void co_dev_set_dummy (co_dev_t *dev, co_unsigned32_t dummy)
 Sets the data types supported by a CANopen device for mapping dummy entries in PDOs. More...
 
const void * co_dev_get_val (const co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx)
 Returns a pointer to the current value of a CANopen sub-object. More...
 
size_t co_dev_set_val (co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx, const void *ptr, size_t n)
 Sets the current value of a CANopen sub-object. More...
 
size_t co_dev_read_sub (co_dev_t *dev, co_unsigned16_t *pidx, co_unsigned8_t *psubidx, const uint_least8_t *begin, const uint_least8_t *end)
 Reads a value from a memory buffer, in the concise DCF format, and stores it in a sub-object in the object dictionary of a CANopen device. More...
 
size_t co_dev_write_sub (const co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx, uint_least8_t *begin, uint_least8_t *end)
 Loads the value of a sub-object from the object dictionary of a CANopen device, and writes it to a memory buffer, in the concise DCF format. More...
 
int co_dev_read_dcf (co_dev_t *dev, co_unsigned16_t *pmin, co_unsigned16_t *pmax, void *const *ptr)
 Reads the values of a range of objects from a memory buffer, in the concise DCF format, and stores them in the object dictionary of a CANopen device. More...
 
int co_dev_read_dcf_file (co_dev_t *dev, co_unsigned16_t *pmin, co_unsigned16_t *pmax, const char *filename)
 Reads the values of a range of objects from a file, in the concise DCF format, and stores them in the object dictionary of a CANopen device. More...
 
int co_dev_write_dcf (const co_dev_t *dev, co_unsigned16_t min, co_unsigned16_t max, void **ptr)
 Loads the values of a range of objects in the object dictionary of a CANopen device, and writes them to a memory buffer, in the concise DCF format. More...
 
int co_dev_write_dcf_file (const co_dev_t *dev, co_unsigned16_t min, co_unsigned16_t max, const char *filename)
 Loads the values of a range of objects in the object dictionary of a CANopen device, and writes them to a file, in the concise DCF format. More...
 
void co_dev_get_tpdo_event_ind (const co_dev_t *dev, co_dev_tpdo_event_ind_t **pind, void **pdata)
 Retrieves the indication function invoked by co_dev_tpdo_event() when an event is indicated for (a sub-object mapped into) an acyclic or event-driven Transmit-PDO. More...
 
void co_dev_set_tpdo_event_ind (co_dev_t *dev, co_dev_tpdo_event_ind_t *ind, void *data)
 Sets the indication function invoked by co_dev_tpdo_event() when an event is indicated for (a sub-object mapped into) an acyclic or event-driven Transmit-PDO. More...
 
void co_dev_tpdo_event (co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx)
 Checks if the specified sub-object in the object dictionary of a CANopen device can be mapped into a PDO and, if so, issues an indication for every valid, acylic or event-driven Transmit-PDO into which the sub-object is mapped by invoking the user-defined callback function set with co_dev_set_tpdo_event_ind(). More...
 
void co_dev_get_sam_mpdo_event_ind (const co_dev_t *dev, co_dev_sam_mpdo_event_ind_t **pind, void **pdata)
 Retrieves the indication function invoked by co_dev_sam_mpdo_event() when an event is indicated for (a sub-object mapped into) a SAM-MPDO. More...
 
void co_dev_set_sam_mpdo_event_ind (co_dev_t *dev, co_dev_sam_mpdo_event_ind_t *ind, void *data)
 Sets the indication function invoked by co_dev_sam_mpdo_event() when an event is indicated for (a sub-object mapped into) a SAM-MPDO. More...
 
void co_dev_sam_mpdo_event (co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx)
 Checks if the specified sub-object in the object dictionary of a CANopen device can be mapped into a source address mode multiplex PDO and, if so, issues an indication for the SAM-MPDO prdoucer Transmit-PDO, if any, by invoking the user-defined callback function set with co_dev_set_sam_mpdo_event_ind(). More...
 

Detailed Description

This file is part of the CANopen library; it contains the implementation of the device description.

See also
lely/co/dev.h
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 dev.c.

Function Documentation

◆ co_dev_create()

co_dev_t* co_dev_create ( co_unsigned8_t  id)

Creates a new CANopen device.

Parameters
idthe node-ID of the device (in the range [1..127, 255]). If id is 255, the device is unconfigured.
Returns
a pointer to a new CANopen device, or NULL on error. In the latter case, the error number can be obtained with get_errc().
See also
co_dev_destroy()

Definition at line 138 of file dev.c.

◆ co_dev_destroy()

void co_dev_destroy ( co_dev_t dev)

Destroys a CANopen device, including all objects in its object dictionary.

See also
co_dev_create()

Definition at line 163 of file dev.c.

◆ co_dev_get_netid()

co_unsigned8_t co_dev_get_netid ( const co_dev_t dev)

Returns the network-ID of a CANopen device.

See also
co_dev_set_netid()

Definition at line 174 of file dev.c.

◆ co_dev_set_netid()

int co_dev_set_netid ( co_dev_t dev,
co_unsigned8_t  id 
)

Sets the network-ID of a CANopen device.

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

Definition at line 182 of file dev.c.

◆ co_dev_get_id()

co_unsigned8_t co_dev_get_id ( const co_dev_t dev)

Returns the node-ID of a CANopen device.

See also
co_dev_set_id()

Definition at line 197 of file dev.c.

◆ co_dev_set_id()

int co_dev_set_id ( co_dev_t dev,
co_unsigned8_t  id 
)

Sets the node-ID of a CANopen device.

This function will also update any sub-object values of the form $NODEID { "+" number }.

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

Definition at line 205 of file dev.c.

◆ co_dev_get_idx()

co_unsigned16_t co_dev_get_idx ( const co_dev_t dev,
co_unsigned16_t  maxidx,
co_unsigned16_t *  idx 
)

Retrieves a list of object indices in the object dictionary of a CANopen device.

Parameters
deva pointer to a CANopen device.
maxidxthe maximum number of object indices to return.
idxan array of at least maxidx indices (can be NULL). On success, *idx contains the object indices.
Returns
the total number of object indices in the object dictionary (which may be different from maxidx).

Definition at line 223 of file dev.c.

◆ co_dev_insert_obj()

int co_dev_insert_obj ( co_dev_t dev,
co_obj_t obj 
)

Inserts an object into the object dictionary of a CANopen device.

This function fails if the object is already part of the object dictionary of another device, or if another object with the same index already exists.

Parameters
deva pointer to a CANopen device.
obja pointer to the object to be inserted.
Returns
0 on success, or -1 on error.
See also
co_dev_remove_obj(), co_dev_find_obj()

Definition at line 242 of file dev.c.

◆ co_dev_remove_obj()

int co_dev_remove_obj ( co_dev_t dev,
co_obj_t obj 
)

Removes an object from the object dictionary a CANopen device.

Parameters
deva pointer to a CANopen device.
obja pointer to the object to be removed.
Returns
0 on success, or -1 on error.
See also
co_dev_insert_obj()

Definition at line 263 of file dev.c.

◆ co_dev_find_obj()

co_obj_t* co_dev_find_obj ( const co_dev_t dev,
co_unsigned16_t  idx 
)

Finds an object in the object dictionary of a CANopen device.

Parameters
deva pointer to a CANopen device.
idxthe object index.
Returns
a pointer to the object if found, or NULL if not.
See also
co_dev_insert_obj()

Definition at line 279 of file dev.c.

◆ co_dev_find_sub()

co_sub_t* co_dev_find_sub ( const co_dev_t dev,
co_unsigned16_t  idx,
co_unsigned8_t  subidx 
)

Finds a sub-object in the object dictionary of a CANopen device.

Parameters
deva pointer to a CANopen device.
idxthe object index.
subidxthe object sub-index.
Returns
a pointer to the sub-object if found, or NULL if not.

Definition at line 290 of file dev.c.

◆ co_dev_first_obj()

co_obj_t* co_dev_first_obj ( const co_dev_t dev)

Finds the first object (with the lowest index) in the object dictionary of a CANopen device.

Returns
a pointer to the first object, or NULL if the object dictionary is empty.
See also
co_dev_last_obj(), co_obj_next()

Definition at line 297 of file dev.c.

◆ co_dev_last_obj()

co_obj_t* co_dev_last_obj ( const co_dev_t dev)

Finds the last object (with the highest index) in the object dictionary of a CANopen device.

Returns
a pointer to the last object, or NULL if the object dictionary is empty.
See also
co_dev_first_obj(), co_obj_prev()

Definition at line 306 of file dev.c.

◆ co_dev_get_name()

const char* co_dev_get_name ( const co_dev_t dev)

Returns the name of a CANopen device.

See also
co_dev_set_name()

Definition at line 317 of file dev.c.

◆ co_dev_set_name()

int co_dev_set_name ( co_dev_t dev,
const char *  name 
)

Sets the name of a CANopen device.

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

Definition at line 325 of file dev.c.

◆ co_dev_get_vendor_name()

const char* co_dev_get_vendor_name ( const co_dev_t dev)

Returns a pointer to the vendor name of a CANopen device.

See also
co_dev_set_vendor_name()

Definition at line 349 of file dev.c.

◆ co_dev_set_vendor_name()

int co_dev_set_vendor_name ( co_dev_t dev,
const char *  vendor_name 
)

Sets the vendor name of a CANopen device.

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

Definition at line 357 of file dev.c.

◆ co_dev_get_vendor_id()

co_unsigned32_t co_dev_get_vendor_id ( const co_dev_t dev)

Returns the vendor ID of a CANopen device.

See also
co_dev_set_vendor_id()

Definition at line 383 of file dev.c.

◆ co_dev_set_vendor_id()

void co_dev_set_vendor_id ( co_dev_t dev,
co_unsigned32_t  vendor_id 
)

Sets the vendor ID of a CANopen device.

See also
co_dev_get_vendor_id()

Definition at line 391 of file dev.c.

◆ co_dev_get_product_name()

const char* co_dev_get_product_name ( const co_dev_t dev)

Returns a pointer to the product name of a CANopen device.

See also
co_dev_set_product_name()

Definition at line 401 of file dev.c.

◆ co_dev_set_product_name()

int co_dev_set_product_name ( co_dev_t dev,
const char *  product_name 
)

Sets the product name of a CANopen device.

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

Definition at line 409 of file dev.c.

◆ co_dev_get_product_code()

co_unsigned32_t co_dev_get_product_code ( const co_dev_t dev)

Returns the product code of a CANopen device.

See also
co_dev_set_product_code()

Definition at line 435 of file dev.c.

◆ co_dev_set_product_code()

void co_dev_set_product_code ( co_dev_t dev,
co_unsigned32_t  product_code 
)

Sets the product code of a CANopen device.

See also
co_dev_get_product_code()

Definition at line 443 of file dev.c.

◆ co_dev_get_revision()

co_unsigned32_t co_dev_get_revision ( const co_dev_t dev)

Returns the revision number of a CANopen device.

See also
co_dev_set_revision()

Definition at line 451 of file dev.c.

◆ co_dev_set_revision()

void co_dev_set_revision ( co_dev_t dev,
co_unsigned32_t  revision 
)

Sets the revision number of a CANopen device.

See also
co_dev_get_revision()

Definition at line 459 of file dev.c.

◆ co_dev_get_order_code()

const char* co_dev_get_order_code ( const co_dev_t dev)

Returns a pointer to the order code of a CANopen device.

See also
co_dev_set_order_code()

Definition at line 469 of file dev.c.

◆ co_dev_set_order_code()

int co_dev_set_order_code ( co_dev_t dev,
const char *  order_code 
)

Sets the order code of a CANopen device.

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

Definition at line 477 of file dev.c.

◆ co_dev_get_baud()

unsigned int co_dev_get_baud ( const co_dev_t dev)

Returns the supported bit rates of a CANopen device (any combination of CO_BAUD_1000, CO_BAUD_800, CO_BAUD_500, CO_BAUD_250, CO_BAUD_125, CO_BAUD_50, CO_BAUD_20, CO_BAUD_10 and CO_BAUD_AUTO).

See also
co_dev_set_baud()

Definition at line 503 of file dev.c.

◆ co_dev_set_baud()

void co_dev_set_baud ( co_dev_t dev,
unsigned int  baud 
)

Sets the supported bit rates of a CANopen device.

Parameters
deva pointer to a CANopen device.
baudthe supported bit rates (any combination of CO_BAUD_1000, CO_BAUD_800, CO_BAUD_500, CO_BAUD_250, CO_BAUD_125, CO_BAUD_50, CO_BAUD_20, CO_BAUD_10 and CO_BAUD_AUTO).
See also
co_dev_get_baud()

Definition at line 511 of file dev.c.

◆ co_dev_get_rate()

co_unsigned16_t co_dev_get_rate ( const co_dev_t dev)

Returns the (pending) baudrate of a CANopen device (in kbit/s).

See also
co_dev_set_rate()

Definition at line 519 of file dev.c.

◆ co_dev_set_rate()

void co_dev_set_rate ( co_dev_t dev,
co_unsigned16_t  rate 
)

Sets the (pending) baudrate of a CANopen device.

Parameters
deva pointer to a CANopen device.
ratethe baudrate (in kbit/s).
See also
co_dev_get_rate()

Definition at line 527 of file dev.c.

◆ co_dev_get_lss()

int co_dev_get_lss ( const co_dev_t dev)

Returns 1 if LSS is supported and 0 if not.

See also
co_dev_set_lss()

Definition at line 535 of file dev.c.

◆ co_dev_set_lss()

void co_dev_set_lss ( co_dev_t dev,
int  lss 
)

Sets the LSS support flag.

See also
co_dev_get_lss()

Definition at line 543 of file dev.c.

◆ co_dev_get_dummy()

co_unsigned32_t co_dev_get_dummy ( const co_dev_t dev)

Returns the data types supported by a CANopen device for mapping dummy entries in PDOs (one bit for each of the basic types).

See also
co_dev_set_dummy()

Definition at line 551 of file dev.c.

◆ co_dev_set_dummy()

void co_dev_set_dummy ( co_dev_t dev,
co_unsigned32_t  dummy 
)

Sets the data types supported by a CANopen device for mapping dummy entries in PDOs.

Parameters
deva pointer to a CANopen device.
dummythe data types supported for mapping dummy entries in PDOs (one bit for each of the basic types).
See also
co_dev_get_dummy()

Definition at line 559 of file dev.c.

◆ co_dev_get_val()

const void* co_dev_get_val ( const co_dev_t dev,
co_unsigned16_t  idx,
co_unsigned8_t  subidx 
)

Returns a pointer to the current value of a CANopen sub-object.

In the case of strings or domains, this is the address of a pointer to the first byte in the array.

See also
co_dev_set_val(), co_sub_get_val()

Definition at line 567 of file dev.c.

◆ co_dev_set_val()

size_t co_dev_set_val ( co_dev_t dev,
co_unsigned16_t  idx,
co_unsigned8_t  subidx,
const void *  ptr,
size_t  n 
)

Sets the current value of a CANopen sub-object.

Parameters
deva pointer to a CANopen device.
idxthe object index.
subidxthe object sub-index.
ptra pointer to the bytes to be copied. In case of strings or domains, ptr MUST point to the first byte in the array.
nthe number of bytes at ptr. In case of strings, n SHOULD exclude the terminating null byte(s).
Returns
the number of bytes copied (i.e., n), or 0 on error. In the latter case, the error number can be obtained with get_errc().
See also
co_dev_get_val(), co_sub_set_val()

Definition at line 574 of file dev.c.

◆ co_dev_read_sub()

size_t co_dev_read_sub ( co_dev_t dev,
co_unsigned16_t *  pidx,
co_unsigned8_t *  psubidx,
const uint_least8_t *  begin,
const uint_least8_t *  end 
)

Reads a value from a memory buffer, in the concise DCF format, and stores it in a sub-object in the object dictionary of a CANopen device.

If the sub-object does not exist, the value is discarded.

Parameters
deva pointer to a CANopen device.
pidxthe address at which to store the object index (can be NULL).
psubidxthe address at which to store the object sub-index (can be NULL).
begina pointer to the start of the buffer.
enda pointer to one past the last byte in the buffer.
Returns
the number of bytes read on success (at least 7), or 0 on error.
See also
co_dev_write_sub()

Definition at line 617 of file dev.c.

◆ co_dev_write_sub()

size_t co_dev_write_sub ( const co_dev_t dev,
co_unsigned16_t  idx,
co_unsigned8_t  subidx,
uint_least8_t *  begin,
uint_least8_t *  end 
)

Loads the value of a sub-object from the object dictionary of a CANopen device, and writes it to a memory buffer, in the concise DCF format.

Parameters
deva pointer to a CANopen device.
idxthe object index.
subidxthe object sub-index.
begina pointer to the start of the buffer. If begin is NULL, nothing is written.
enda pointer to one past the last byte in the buffer. If end is not NULL, and the buffer is too small (i.e., end - begin is less than the return value), nothing is written.
Returns
the number of bytes that would have been written had the buffer been sufficiently large, or 0 on error.
See also
co_dev_read_sub()

Definition at line 671 of file dev.c.

◆ co_dev_read_dcf()

int co_dev_read_dcf ( co_dev_t dev,
co_unsigned16_t *  pmin,
co_unsigned16_t *  pmax,
void *const *  ptr 
)

Reads the values of a range of objects from a memory buffer, in the concise DCF format, and stores them in the object dictionary of a CANopen device.

If an object does not exist, the value is discarded.

Parameters
deva pointer to a CANopen device.
pminthe address at which to store the minimum object index (can be NULL).
pmaxthe address at which to store the maximum object index (can be NULL).
ptrthe address of a pointer to a DOMAIN value.
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
See also
co_dev_write_dcf()

Definition at line 707 of file dev.c.

◆ co_dev_read_dcf_file()

int co_dev_read_dcf_file ( co_dev_t dev,
co_unsigned16_t *  pmin,
co_unsigned16_t *  pmax,
const char *  filename 
)

Reads the values of a range of objects from a file, in the concise DCF format, and stores them in the object dictionary of a CANopen device.

If an object does not exist, the value is discarded.

Parameters
deva pointer to a CANopen device.
pminthe address at which to store the minimum object index (can be NULL).
pmaxthe address at which to store the maximum object index (can be NULL).
filenamea pointer to the name of the file.
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
See also
co_dev_read_dcf()

Definition at line 750 of file dev.c.

◆ co_dev_write_dcf()

int co_dev_write_dcf ( const co_dev_t dev,
co_unsigned16_t  min,
co_unsigned16_t  max,
void **  ptr 
)

Loads the values of a range of objects in the object dictionary of a CANopen device, and writes them to a memory buffer, in the concise DCF format.

Parameters
deva pointer to a CANopen device.
minthe minimum object index.
maxthe maximum object index.
ptrthe address of a pointer. On success, *ptr points to a DOMAIN value.
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
See also
co_dev_read_dcf()

Definition at line 768 of file dev.c.

◆ co_dev_write_dcf_file()

int co_dev_write_dcf_file ( const co_dev_t dev,
co_unsigned16_t  min,
co_unsigned16_t  max,
const char *  filename 
)

Loads the values of a range of objects in the object dictionary of a CANopen device, and writes them to a file, in the concise DCF format.

Parameters
deva pointer to a CANopen device.
minthe minimum object index.
maxthe maximum object index.
filenamea pointer to the name of the file.
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
See also
co_dev_write_dcf()

Definition at line 824 of file dev.c.

◆ co_dev_get_tpdo_event_ind()

void co_dev_get_tpdo_event_ind ( const co_dev_t dev,
co_dev_tpdo_event_ind_t **  pind,
void **  pdata 
)

Retrieves the indication function invoked by co_dev_tpdo_event() when an event is indicated for (a sub-object mapped into) an acyclic or event-driven Transmit-PDO.

Parameters
deva pointer to a CANopen device.
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_dev_set_tpdo_event_ind()

Definition at line 845 of file dev.c.

◆ co_dev_set_tpdo_event_ind()

void co_dev_set_tpdo_event_ind ( co_dev_t dev,
co_dev_tpdo_event_ind_t ind,
void *  data 
)

Sets the indication function invoked by co_dev_tpdo_event() when an event is indicated for (a sub-object mapped into) an acyclic or event-driven Transmit-PDO.

Parameters
deva pointer to a CANopen device.
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_dev_get_tpdo_event_ind()

Definition at line 857 of file dev.c.

◆ co_dev_tpdo_event()

void co_dev_tpdo_event ( co_dev_t dev,
co_unsigned16_t  idx,
co_unsigned8_t  subidx 
)

Checks if the specified sub-object in the object dictionary of a CANopen device can be mapped into a PDO and, if so, issues an indication for every valid, acylic or event-driven Transmit-PDO into which the sub-object is mapped by invoking the user-defined callback function set with co_dev_set_tpdo_event_ind().

At most one event is indicated for every matching TPDO.

Parameters
deva pointer to a CANopen device.
idxthe object index.
subidxthe object sub-index.
See also
co_dev_tpdo_event_ind_t

Definition at line 867 of file dev.c.

◆ co_dev_get_sam_mpdo_event_ind()

void co_dev_get_sam_mpdo_event_ind ( const co_dev_t dev,
co_dev_sam_mpdo_event_ind_t **  pind,
void **  pdata 
)

Retrieves the indication function invoked by co_dev_sam_mpdo_event() when an event is indicated for (a sub-object mapped into) a SAM-MPDO.

Parameters
deva pointer to a CANopen device.
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_dev_set_sam_mpdo_event_ind()

Definition at line 917 of file dev.c.

◆ co_dev_set_sam_mpdo_event_ind()

void co_dev_set_sam_mpdo_event_ind ( co_dev_t dev,
co_dev_sam_mpdo_event_ind_t ind,
void *  data 
)

Sets the indication function invoked by co_dev_sam_mpdo_event() when an event is indicated for (a sub-object mapped into) a SAM-MPDO.

Parameters
deva pointer to a CANopen device.
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_dev_get_sam_mpdo_event_ind()

Definition at line 929 of file dev.c.

◆ co_dev_sam_mpdo_event()

void co_dev_sam_mpdo_event ( co_dev_t dev,
co_unsigned16_t  idx,
co_unsigned8_t  subidx 
)

Checks if the specified sub-object in the object dictionary of a CANopen device can be mapped into a source address mode multiplex PDO and, if so, issues an indication for the SAM-MPDO prdoucer Transmit-PDO, if any, by invoking the user-defined callback function set with co_dev_set_sam_mpdo_event_ind().

Parameters
deva pointer to a CANopen device.
idxthe object index.
subidxthe object sub-index.
See also
co_dev_sam_mpdo_event_ind_t

Definition at line 939 of file dev.c.