CANopenDemo
CANopenNode demo, tutorial and testing
Loading...
Searching...
No Matches
OD.h
1/*******************************************************************************
2 CANopen Object Dictionary definition for CANopenNode V4
3
4 This file was automatically generated by CANopenEditor v4.1-1-ga49a51a
5
6 https://github.com/CANopenNode/CANopenNode
7 https://github.com/CANopenNode/CANopenEditor
8
9 DON'T EDIT THIS FILE MANUALLY !!!!
10********************************************************************************
11
12 File info:
13 File Names: OD.h; OD.c
14 Project File: demoDevice.xdd
15 File Version: 1
16
17 Created: 28. 11. 2020 12:37:54
18 Created By: Janez Paternoster
19 Modified: 17. 03. 2023 16:49:28
20 Modified By: Janez Paternoster
21
22 Device Info:
23 Vendor Name: -
24 Vendor ID: 0
25 Product Name: Demo device
26 Product ID: 1
27
28 Description: Demo CANopen device with example usage.
29*******************************************************************************/
30
31#ifndef OD_H
32#define OD_H
33/*******************************************************************************
34 Counters of OD objects
35*******************************************************************************/
36#define OD_CNT_NMT 1
37#define OD_CNT_EM 1
38#define OD_CNT_SYNC 1
39#define OD_CNT_SYNC_PROD 1
40#define OD_CNT_STORAGE 1
41#define OD_CNT_TIME 1
42#define OD_CNT_EM_PROD 1
43#define OD_CNT_HB_CONS 1
44#define OD_CNT_HB_PROD 1
45#define OD_CNT_SDO_SRV 1
46#define OD_CNT_RPDO 4
47#define OD_CNT_TPDO 4
48
49
50/*******************************************************************************
51 Sizes of OD arrays
52*******************************************************************************/
53#define OD_CNT_ARR_1003 16
54#define OD_CNT_ARR_1010 6
55#define OD_CNT_ARR_1011 6
56#define OD_CNT_ARR_1016 8
57#define OD_CNT_ARR_2110 16
58#define OD_CNT_ARR_2111 16
59#define OD_CNT_ARR_2112 16
60#define OD_CNT_ARR_6000 8
61#define OD_CNT_ARR_6200 8
62#define OD_CNT_ARR_6401 16
63#define OD_CNT_ARR_6411 8
64
65
66/*******************************************************************************
67 OD data declaration of all groups
68*******************************************************************************/
69typedef struct {
70 uint32_t x1000_deviceType;
71 uint32_t x1005_COB_ID_SYNCMessage;
72 uint32_t x1006_communicationCyclePeriod;
73 uint32_t x1007_synchronousWindowLength;
74 uint32_t x1012_COB_IDTimeStampObject;
75 uint32_t x1014_COB_ID_EMCY;
76 uint16_t x1015_inhibitTimeEMCY;
77 uint8_t x1016_consumerHeartbeatTime_sub0;
78 uint32_t x1016_consumerHeartbeatTime[OD_CNT_ARR_1016];
79 uint16_t x1017_producerHeartbeatTime;
80 struct {
81 uint8_t highestSub_indexSupported;
82 uint32_t vendor_ID;
83 uint32_t productCode;
84 uint32_t revisionNumber;
85 uint32_t serialNumber;
86 } x1018_identity;
87 uint8_t x1019_synchronousCounterOverflowValue;
88 struct {
89 uint8_t highestSub_indexSupported;
90 uint32_t COB_IDUsedByRPDO;
91 uint8_t transmissionType;
92 uint16_t eventTimer;
93 } x1400_RPDOCommunicationParameter;
94 struct {
95 uint8_t highestSub_indexSupported;
96 uint32_t COB_IDUsedByRPDO;
97 uint8_t transmissionType;
98 uint16_t eventTimer;
99 } x1401_RPDOCommunicationParameter;
100 struct {
101 uint8_t highestSub_indexSupported;
102 uint32_t COB_IDUsedByRPDO;
103 uint8_t transmissionType;
104 uint16_t eventTimer;
105 } x1402_RPDOCommunicationParameter;
106 struct {
107 uint8_t highestSub_indexSupported;
108 uint32_t COB_IDUsedByRPDO;
109 uint8_t transmissionType;
110 uint16_t eventTimer;
111 } x1403_RPDOCommunicationParameter;
112 struct {
113 uint8_t numberOfMappedApplicationObjectsInPDO;
114 uint32_t applicationObject1;
115 uint32_t applicationObject2;
116 uint32_t applicationObject3;
117 uint32_t applicationObject4;
118 uint32_t applicationObject5;
119 uint32_t applicationObject6;
120 uint32_t applicationObject7;
121 uint32_t applicationObject8;
122 } x1600_RPDOMappingParameter;
123 struct {
124 uint8_t numberOfMappedApplicationObjectsInPDO;
125 uint32_t applicationObject1;
126 uint32_t applicationObject2;
127 uint32_t applicationObject3;
128 uint32_t applicationObject4;
129 uint32_t applicationObject5;
130 uint32_t applicationObject6;
131 uint32_t applicationObject7;
132 uint32_t applicationObject8;
133 } x1601_RPDOMappingParameter;
134 struct {
135 uint8_t numberOfMappedApplicationObjectsInPDO;
136 uint32_t applicationObject1;
137 uint32_t applicationObject2;
138 uint32_t applicationObject3;
139 uint32_t applicationObject4;
140 uint32_t applicationObject5;
141 uint32_t applicationObject6;
142 uint32_t applicationObject7;
143 uint32_t applicationObject8;
144 } x1602_RPDOMappingParameter;
145 struct {
146 uint8_t numberOfMappedApplicationObjectsInPDO;
147 uint32_t applicationObject1;
148 uint32_t applicationObject2;
149 uint32_t applicationObject3;
150 uint32_t applicationObject4;
151 uint32_t applicationObject5;
152 uint32_t applicationObject6;
153 uint32_t applicationObject7;
154 uint32_t applicationObject8;
155 } x1603_RPDOMappingParameter;
156 struct {
157 uint8_t highestSub_indexSupported;
158 uint32_t COB_IDUsedByTPDO;
159 uint8_t transmissionType;
160 uint16_t inhibitTime;
161 uint16_t eventTimer;
162 uint8_t SYNCStartValue;
163 } x1800_TPDOCommunicationParameter;
164 struct {
165 uint8_t highestSub_indexSupported;
166 uint32_t COB_IDUsedByTPDO;
167 uint8_t transmissionType;
168 uint16_t inhibitTime;
169 uint16_t eventTimer;
170 uint8_t SYNCStartValue;
171 } x1801_TPDOCommunicationParameter;
172 struct {
173 uint8_t highestSub_indexSupported;
174 uint32_t COB_IDUsedByTPDO;
175 uint8_t transmissionType;
176 uint16_t inhibitTime;
177 uint16_t eventTimer;
178 uint8_t SYNCStartValue;
179 } x1802_TPDOCommunicationParameter;
180 struct {
181 uint8_t highestSub_indexSupported;
182 uint32_t COB_IDUsedByTPDO;
183 uint8_t transmissionType;
184 uint16_t inhibitTime;
185 uint16_t eventTimer;
186 uint8_t SYNCStartValue;
187 } x1803_TPDOCommunicationParameter;
188 struct {
189 uint8_t numberOfMappedApplicationObjectsInPDO;
190 uint32_t applicationObject1;
191 uint32_t applicationObject2;
192 uint32_t applicationObject3;
193 uint32_t applicationObject4;
194 uint32_t applicationObject5;
195 uint32_t applicationObject6;
196 uint32_t applicationObject7;
197 uint32_t applicationObject8;
198 } x1A00_TPDOMappingParameter;
199 struct {
200 uint8_t numberOfMappedApplicationObjectsInPDO;
201 uint32_t applicationObject1;
202 uint32_t applicationObject2;
203 uint32_t applicationObject3;
204 uint32_t applicationObject4;
205 uint32_t applicationObject5;
206 uint32_t applicationObject6;
207 uint32_t applicationObject7;
208 uint32_t applicationObject8;
209 } x1A01_TPDOMappingParameter;
210 struct {
211 uint8_t numberOfMappedApplicationObjectsInPDO;
212 uint32_t applicationObject1;
213 uint32_t applicationObject2;
214 uint32_t applicationObject3;
215 uint32_t applicationObject4;
216 uint32_t applicationObject5;
217 uint32_t applicationObject6;
218 uint32_t applicationObject7;
219 uint32_t applicationObject8;
220 } x1A02_TPDOMappingParameter;
221 struct {
222 uint8_t numberOfMappedApplicationObjectsInPDO;
223 uint32_t applicationObject1;
224 uint32_t applicationObject2;
225 uint32_t applicationObject3;
226 uint32_t applicationObject4;
227 uint32_t applicationObject5;
228 uint32_t applicationObject6;
229 uint32_t applicationObject7;
230 uint32_t applicationObject8;
231 } x1A03_TPDOMappingParameter;
232} OD_PERSIST_COMM_t;
233
234typedef struct {
235 uint8_t x1001_errorRegister;
236 uint8_t x1010_storeParameters_sub0;
237 uint32_t x1010_storeParameters[OD_CNT_ARR_1010];
238 uint8_t x1011_restoreDefaultParameters_sub0;
239 uint32_t x1011_restoreDefaultParameters[OD_CNT_ARR_1011];
240 struct {
241 uint8_t highestSub_indexSupported;
242 uint32_t COB_IDClientToServerRx;
243 uint32_t COB_IDServerToClientTx;
244 } x1200_SDOServerParameter;
245 uint8_t x2100_errorStatusBits[10];
246 uint8_t x2110_variableInt32_sub0;
247 int32_t x2110_variableInt32[OD_CNT_ARR_2110];
248 uint8_t x6000_readDigitalInput8_bit_sub0;
249 uint8_t x6000_readDigitalInput8_bit[OD_CNT_ARR_6000];
250 uint8_t x6200_writeDigitalOutput8_bit_sub0;
251 uint8_t x6200_writeDigitalOutput8_bit[OD_CNT_ARR_6200];
252 uint8_t x6401_readAnalogInput16_bit_sub0;
253 int16_t x6401_readAnalogInput16_bit[OD_CNT_ARR_6401];
254 uint8_t x6411_writeAnalogOutput16_bit_sub0;
255 int16_t x6411_writeAnalogOutput16_bit[OD_CNT_ARR_6411];
256} OD_RAM_t;
257
258typedef struct {
259 uint32_t x2106_power_onCounter;
260 uint8_t x2112_variableNV_Int32AutoSave_sub0;
261 int32_t x2112_variableNV_Int32AutoSave[OD_CNT_ARR_2112];
262} OD_PERSIST_APP_AUTO_t;
263
264typedef struct {
265 uint8_t x2111_variableInt32Save_sub0;
266 int32_t x2111_variableInt32Save[OD_CNT_ARR_2111];
267 struct {
268 uint8_t highestSub_indexSupported;
269 int64_t I64;
270 uint64_t U64;
271 float32_t R32;
272 float64_t R64;
273 uint16_t parameterWithDefaultValue;
274 } x2120_demoRecord;
275 struct {
276 uint8_t highestSub_indexSupported;
277 char stringShort[4];
278 char stringLong[1001];
279 uint8_t octetString[10];
280 } x2121_demoStrings;
281} OD_PERSIST_APP_t;
282
283#ifndef OD_ATTR_PERSIST_COMM
284#define OD_ATTR_PERSIST_COMM
285#endif
286extern OD_ATTR_PERSIST_COMM OD_PERSIST_COMM_t OD_PERSIST_COMM;
287
288#ifndef OD_ATTR_RAM
289#define OD_ATTR_RAM
290#endif
291extern OD_ATTR_RAM OD_RAM_t OD_RAM;
292
293#ifndef OD_ATTR_PERSIST_APP_AUTO
294#define OD_ATTR_PERSIST_APP_AUTO
295#endif
296extern OD_ATTR_PERSIST_APP_AUTO OD_PERSIST_APP_AUTO_t OD_PERSIST_APP_AUTO;
297
298#ifndef OD_ATTR_PERSIST_APP
299#define OD_ATTR_PERSIST_APP
300#endif
301extern OD_ATTR_PERSIST_APP OD_PERSIST_APP_t OD_PERSIST_APP;
302
303#ifndef OD_ATTR_OD
304#define OD_ATTR_OD
305#endif
306extern OD_ATTR_OD OD_t *OD;
307
308
309/*******************************************************************************
310 Object dictionary entries - shortcuts
311*******************************************************************************/
312#define OD_ENTRY_H1000 &OD->list[0]
313#define OD_ENTRY_H1001 &OD->list[1]
314#define OD_ENTRY_H1003 &OD->list[2]
315#define OD_ENTRY_H1005 &OD->list[3]
316#define OD_ENTRY_H1006 &OD->list[4]
317#define OD_ENTRY_H1007 &OD->list[5]
318#define OD_ENTRY_H1008 &OD->list[6]
319#define OD_ENTRY_H1009 &OD->list[7]
320#define OD_ENTRY_H100A &OD->list[8]
321#define OD_ENTRY_H1010 &OD->list[9]
322#define OD_ENTRY_H1011 &OD->list[10]
323#define OD_ENTRY_H1012 &OD->list[11]
324#define OD_ENTRY_H1014 &OD->list[12]
325#define OD_ENTRY_H1015 &OD->list[13]
326#define OD_ENTRY_H1016 &OD->list[14]
327#define OD_ENTRY_H1017 &OD->list[15]
328#define OD_ENTRY_H1018 &OD->list[16]
329#define OD_ENTRY_H1019 &OD->list[17]
330#define OD_ENTRY_H1200 &OD->list[18]
331#define OD_ENTRY_H1400 &OD->list[19]
332#define OD_ENTRY_H1401 &OD->list[20]
333#define OD_ENTRY_H1402 &OD->list[21]
334#define OD_ENTRY_H1403 &OD->list[22]
335#define OD_ENTRY_H1600 &OD->list[23]
336#define OD_ENTRY_H1601 &OD->list[24]
337#define OD_ENTRY_H1602 &OD->list[25]
338#define OD_ENTRY_H1603 &OD->list[26]
339#define OD_ENTRY_H1800 &OD->list[27]
340#define OD_ENTRY_H1801 &OD->list[28]
341#define OD_ENTRY_H1802 &OD->list[29]
342#define OD_ENTRY_H1803 &OD->list[30]
343#define OD_ENTRY_H1A00 &OD->list[31]
344#define OD_ENTRY_H1A01 &OD->list[32]
345#define OD_ENTRY_H1A02 &OD->list[33]
346#define OD_ENTRY_H1A03 &OD->list[34]
347#define OD_ENTRY_H2100 &OD->list[35]
348#define OD_ENTRY_H2106 &OD->list[36]
349#define OD_ENTRY_H2110 &OD->list[37]
350#define OD_ENTRY_H2111 &OD->list[38]
351#define OD_ENTRY_H2112 &OD->list[39]
352#define OD_ENTRY_H2120 &OD->list[40]
353#define OD_ENTRY_H2121 &OD->list[41]
354#define OD_ENTRY_H2122 &OD->list[42]
355#define OD_ENTRY_H6000 &OD->list[43]
356#define OD_ENTRY_H6200 &OD->list[44]
357#define OD_ENTRY_H6401 &OD->list[45]
358#define OD_ENTRY_H6411 &OD->list[46]
359
360
361/*******************************************************************************
362 Object dictionary entries - shortcuts with names
363*******************************************************************************/
364#define OD_ENTRY_H1000_deviceType &OD->list[0]
365#define OD_ENTRY_H1001_errorRegister &OD->list[1]
366#define OD_ENTRY_H1003_pre_definedErrorField &OD->list[2]
367#define OD_ENTRY_H1005_COB_ID_SYNCMessage &OD->list[3]
368#define OD_ENTRY_H1006_communicationCyclePeriod &OD->list[4]
369#define OD_ENTRY_H1007_synchronousWindowLength &OD->list[5]
370#define OD_ENTRY_H1008_manufacturerDeviceName &OD->list[6]
371#define OD_ENTRY_H1009_manufacturerHardwareVersion &OD->list[7]
372#define OD_ENTRY_H100A_manufacturerSoftwareVersion &OD->list[8]
373#define OD_ENTRY_H1010_storeParameters &OD->list[9]
374#define OD_ENTRY_H1011_restoreDefaultParameters &OD->list[10]
375#define OD_ENTRY_H1012_COB_IDTimeStampObject &OD->list[11]
376#define OD_ENTRY_H1014_COB_ID_EMCY &OD->list[12]
377#define OD_ENTRY_H1015_inhibitTimeEMCY &OD->list[13]
378#define OD_ENTRY_H1016_consumerHeartbeatTime &OD->list[14]
379#define OD_ENTRY_H1017_producerHeartbeatTime &OD->list[15]
380#define OD_ENTRY_H1018_identity &OD->list[16]
381#define OD_ENTRY_H1019_synchronousCounterOverflowValue &OD->list[17]
382#define OD_ENTRY_H1200_SDOServerParameter &OD->list[18]
383#define OD_ENTRY_H1400_RPDOCommunicationParameter &OD->list[19]
384#define OD_ENTRY_H1401_RPDOCommunicationParameter &OD->list[20]
385#define OD_ENTRY_H1402_RPDOCommunicationParameter &OD->list[21]
386#define OD_ENTRY_H1403_RPDOCommunicationParameter &OD->list[22]
387#define OD_ENTRY_H1600_RPDOMappingParameter &OD->list[23]
388#define OD_ENTRY_H1601_RPDOMappingParameter &OD->list[24]
389#define OD_ENTRY_H1602_RPDOMappingParameter &OD->list[25]
390#define OD_ENTRY_H1603_RPDOMappingParameter &OD->list[26]
391#define OD_ENTRY_H1800_TPDOCommunicationParameter &OD->list[27]
392#define OD_ENTRY_H1801_TPDOCommunicationParameter &OD->list[28]
393#define OD_ENTRY_H1802_TPDOCommunicationParameter &OD->list[29]
394#define OD_ENTRY_H1803_TPDOCommunicationParameter &OD->list[30]
395#define OD_ENTRY_H1A00_TPDOMappingParameter &OD->list[31]
396#define OD_ENTRY_H1A01_TPDOMappingParameter &OD->list[32]
397#define OD_ENTRY_H1A02_TPDOMappingParameter &OD->list[33]
398#define OD_ENTRY_H1A03_TPDOMappingParameter &OD->list[34]
399#define OD_ENTRY_H2100_errorStatusBits &OD->list[35]
400#define OD_ENTRY_H2106_power_onCounter &OD->list[36]
401#define OD_ENTRY_H2110_variableInt32 &OD->list[37]
402#define OD_ENTRY_H2111_variableInt32Save &OD->list[38]
403#define OD_ENTRY_H2112_variableNV_Int32AutoSave &OD->list[39]
404#define OD_ENTRY_H2120_demoRecord &OD->list[40]
405#define OD_ENTRY_H2121_demoStrings &OD->list[41]
406#define OD_ENTRY_H2122_demoDomain &OD->list[42]
407#define OD_ENTRY_H6000_readDigitalInput8_bit &OD->list[43]
408#define OD_ENTRY_H6200_writeDigitalOutput8_bit &OD->list[44]
409#define OD_ENTRY_H6401_readAnalogInput16_bit &OD->list[45]
410#define OD_ENTRY_H6411_writeAnalogOutput16_bit &OD->list[46]
411
412
413/*******************************************************************************
414 OD config structure
415*******************************************************************************/
416#ifdef CO_MULTIPLE_OD
417#define OD_INIT_CONFIG(config) {\
418 (config).CNT_NMT = OD_CNT_NMT;\
419 (config).ENTRY_H1017 = OD_ENTRY_H1017;\
420 (config).CNT_HB_CONS = OD_CNT_HB_CONS;\
421 (config).CNT_ARR_1016 = OD_CNT_ARR_1016;\
422 (config).ENTRY_H1016 = OD_ENTRY_H1016;\
423 (config).CNT_EM = OD_CNT_EM;\
424 (config).ENTRY_H1001 = OD_ENTRY_H1001;\
425 (config).ENTRY_H1014 = OD_ENTRY_H1014;\
426 (config).ENTRY_H1015 = OD_ENTRY_H1015;\
427 (config).CNT_ARR_1003 = OD_CNT_ARR_1003;\
428 (config).ENTRY_H1003 = OD_ENTRY_H1003;\
429 (config).CNT_SDO_SRV = OD_CNT_SDO_SRV;\
430 (config).ENTRY_H1200 = OD_ENTRY_H1200;\
431 (config).CNT_SDO_CLI = 0;\
432 (config).ENTRY_H1280 = OD_ENTRY_H1280;\
433 (config).CNT_TIME = OD_CNT_TIME;\
434 (config).ENTRY_H1012 = OD_ENTRY_H1012;\
435 (config).CNT_SYNC = OD_CNT_SYNC;\
436 (config).ENTRY_H1005 = OD_ENTRY_H1005;\
437 (config).ENTRY_H1006 = OD_ENTRY_H1006;\
438 (config).ENTRY_H1007 = OD_ENTRY_H1007;\
439 (config).ENTRY_H1019 = OD_ENTRY_H1019;\
440 (config).CNT_RPDO = OD_CNT_RPDO;\
441 (config).ENTRY_H1400 = OD_ENTRY_H1400;\
442 (config).ENTRY_H1600 = OD_ENTRY_H1600;\
443 (config).CNT_TPDO = OD_CNT_TPDO;\
444 (config).ENTRY_H1800 = OD_ENTRY_H1800;\
445 (config).ENTRY_H1A00 = OD_ENTRY_H1A00;\
446 (config).CNT_LEDS = 0;\
447 (config).CNT_GFC = 0;\
448 (config).ENTRY_H1300 = NULL;\
449 (config).CNT_SRDO = 0;\
450 (config).ENTRY_H1301 = NULL;\
451 (config).ENTRY_H1381 = NULL;\
452 (config).ENTRY_H13FE = NULL;\
453 (config).ENTRY_H13FF = NULL;\
454 (config).CNT_LSS_SLV = 0;\
455 (config).CNT_LSS_MST = 0;\
456 (config).CNT_GTWA = 0;\
457 (config).CNT_TRACE = 0;\
458}
459#endif
460
461#endif /* OD_H */
unsigned int uint16_t
unsigned long int uint32_t
float float32_t
signed long long int int64_t
signed int int16_t
unsigned char uint8_t
double float64_t
unsigned long long int uint64_t
signed long int int32_t