-
Notifications
You must be signed in to change notification settings - Fork 1
/
coe_c.mustache
78 lines (69 loc) · 2.87 KB
/
coe_c.mustache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
* @file {{basename}}
* @author {{appname}}
* @date {{date}}
* @brief Sample EtherCAT CoE definitions.
*
* Automatically generated by {{appname}}
* All edits will be destroyed
*/
#include "g5im_coe.h"
{{#pdos}}
/******************************************************************************
* Object 0x{{hex_index}}: {{description}}
******************************************************************************/
const TSDOINFOENTRYDESC asEntryDesc0x{{hex_index}}[] = {
{{#subs}}
{ {{deftype}}, {{pdo_bitsize}}, {{access_code_hex}} }, /* Subindex {{subindex}}: {{description}} */
{{/subs}}
};
const UCHAR aName0x{{hex_index}}[] = "{{description}}\000{{#dsubs}}{{description}}\000{{/dsubs}}\377";
{{^merge?}}{{c_type}} {{symbol}} = { {{hex_defaults}} };
{{/merge?}}{{#merge0?}}{{c_type}} {{merge_base_name}}[{{merge_size}}] = { {{hex_defaults}} };
{{/merge0?}}{{#merge?}}// Object 0x{{hex_index}} is stored in {{merge_base_name}}[{{merge_index}}]
{{/merge?}}{{/pdos}}
/******************************************************************************
* Application Object Dictionary
******************************************************************************/
TOBJECT ApplicationObjDic[] = {
{{#pdos}}
/* {{description}} */
{NULL,NULL, 0x{{hex_index}}, { {{deftype}}, {{objflags}} }, asEntryDesc0x{{hex_index}}, aName0x{{hex_index}}, &{{symbol}}, {{^Read}}NULL{{/Read}}{{#Read}}&{{Read}}{{/Read}}, {{^Write}}NULL{{/Write}}{{#Write}}&{{Write}}{{/Write}}, {{^NonVolatileOffset}}0{{/NonVolatileOffset}}{{NonVolatileOffset}} },
{{/pdos}} {NULL,NULL, 0xFFFF, {0, 0}, NULL, NULL, NULL, NULL, NULL, 0x0000}};
/******************************************************************************
* Application helper functions
******************************************************************************/
void PDO_ResetOutputs(void)
{
{{#pdos}}{{#subs}}{{#rxpdo?}} {{symbol}}.{{subsymbol}} = {{default}}; // {{description}}
{{/rxpdo?}}{{/subs}}{{/pdos}}}
void APPL_InputMapping(void* pData)
{
int j;
uint8_t *data = (uint8_t *)pData;
for (j = 0; j < sTxPDOassign.u16SubIndex0; j++)
{
switch (sTxPDOassign.aEntries[j])
{ {{#pdos}}{{#tx_pdo_map?}}
case 0x{{hex_index}}: // {{description}}{{#mapped_subs}}
// {{description}}
{{{tx_pdo_code}}} {{/mapped_subs}}
break;{{/tx_pdo_map?}}{{/pdos}}
}
}
}
void APPL_OutputMapping(void* pData)
{
int j;
uint8_t *data = (uint8_t *)pData;
for (j = 0; j < sRxPDOassign.u16SubIndex0; j++)
{
switch (sRxPDOassign.aEntries[j])
{ {{#pdos}}{{#rx_pdo_map?}}
case 0x{{hex_index}}: // {{description}}{{#mapped_subs}}
// {{description}}
{{{rx_pdo_code}}} {{/mapped_subs}}
break;{{/rx_pdo_map?}}{{/pdos}}
}
}
}