Lely core libraries 1.9.2
sdev.h
Go to the documentation of this file.
1
22#ifndef LELY_CO_SDEV_H_
23#define LELY_CO_SDEV_H_
24
25#include <lely/co/dev.h>
26#include <lely/co/obj.h>
27#include <lely/co/val.h>
28
30struct co_sdev {
32 co_unsigned8_t id;
34 const char *name;
36 const char *vendor_name;
38 co_unsigned32_t vendor_id;
40 const char *product_name;
42 co_unsigned32_t product_code;
44 co_unsigned32_t revision;
46 const char *order_code;
48 unsigned baud : 10;
50 co_unsigned16_t rate;
52 int lss;
54 co_unsigned32_t dummy;
56 co_unsigned16_t nobj;
58 const struct co_sobj *objs;
59};
60
62struct co_sobj {
64 const char *name;
66 co_unsigned16_t idx;
68 co_unsigned8_t code;
70 co_unsigned8_t nsub;
72 const struct co_ssub *subs;
73};
74
76struct co_ssub {
78 const char *name;
80 co_unsigned8_t subidx;
82 co_unsigned16_t type;
84 union co_val min;
86 union co_val max;
88 union co_val def;
90 union co_val val;
92 unsigned access : 5;
94 unsigned pdo_mapping : 1;
96 unsigned flags : 26;
97};
98
99#ifdef __cplusplus
100extern "C" {
101#endif
102
103struct __co_dev *__co_dev_init_from_sdev(
104 struct __co_dev *dev, const struct co_sdev *sdev);
105
112co_dev_t *co_dev_create_from_sdev(const struct co_sdev *sdev);
113
129int snprintf_c99_sdev(char *s, size_t n, const co_dev_t *dev);
130
144int asprintf_c99_sdev(char **ps, const co_dev_t *dev);
145
146#ifdef __cplusplus
147}
148#endif
149
150#endif // !LELY_CO_SDEV_H_
This header file is part of the CANopen library; it contains the device description declarations.
This header file is part of the CANopen library; it contains the object dictionary declarations.
co_dev_t * co_dev_create_from_sdev(const struct co_sdev *sdev)
Creates a CANopen device from a static device description.
Definition: sdev.c:83
int snprintf_c99_sdev(char *s, size_t n, const co_dev_t *dev)
Prints a C99 static initializer code fragment for a static device description (struct co_sdev) to a s...
Definition: sdev.c:108
int asprintf_c99_sdev(char **ps, const co_dev_t *dev)
Equivalent to snprintf_c99_sdev(), except that it allocates a string large enough to hold the output,...
Definition: sdev.c:405
A CANopen device.
Definition: dev.c:38
A static CANopen device.
Definition: sdev.h:30
co_unsigned8_t id
The node-ID.
Definition: sdev.h:32
co_unsigned16_t nobj
The number of objects in objs.
Definition: sdev.h:56
int lss
A flag specifying whether LSS is supported (1) or not (0).
Definition: sdev.h:52
const char * product_name
A pointer to the product name.
Definition: sdev.h:40
const char * vendor_name
A pointer to the vendor name.
Definition: sdev.h:36
co_unsigned32_t dummy
The data types supported for mapping dummy entries in PDOs.
Definition: sdev.h:54
co_unsigned16_t rate
The (pending) baudrate (in kbit/s).
Definition: sdev.h:50
unsigned baud
The supported bit rates.
Definition: sdev.h:48
co_unsigned32_t product_code
The product code.
Definition: sdev.h:42
co_unsigned32_t vendor_id
The vendor ID.
Definition: sdev.h:38
const char * name
A pointer to the name of the device.
Definition: sdev.h:34
const char * order_code
A pointer to the order code.
Definition: sdev.h:46
co_unsigned32_t revision
The revision number.
Definition: sdev.h:44
const struct co_sobj * objs
An array of objects.
Definition: sdev.h:58
A static CANopen object.
Definition: sdev.h:62
const struct co_ssub * subs
An array of sub-objects.
Definition: sdev.h:72
const char * name
A pointer to the name of the object.
Definition: sdev.h:64
co_unsigned16_t idx
The object index.
Definition: sdev.h:66
co_unsigned8_t nsub
The number of sub-objects in subs.
Definition: sdev.h:70
co_unsigned8_t code
The object code.
Definition: sdev.h:68
A static CANopen sub-object.
Definition: sdev.h:76
union co_val min
The lower limit of val.
Definition: sdev.h:84
unsigned access
The access type.
Definition: sdev.h:92
union co_val def
The default value of val.
Definition: sdev.h:88
unsigned flags
The object flags.
Definition: sdev.h:96
co_unsigned8_t subidx
The object sub-index.
Definition: sdev.h:80
const char * name
A pointer to the name of the sub-object.
Definition: sdev.h:78
union co_val val
The sub-object value.
Definition: sdev.h:90
unsigned pdo_mapping
A flag indicating if it is possible to map this object into a PDO.
Definition: sdev.h:94
co_unsigned16_t type
The data type.
Definition: sdev.h:82
union co_val max
The upper limit of val.
Definition: sdev.h:86
A union of the CANopen static data types.
Definition: val.h:163
This header file is part of the CANopen library; it contains the CANopen value declarations.