forked from odriverobotics/ODrive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
arduino_enums_template.j2
23 lines (17 loc) · 968 Bytes
/
arduino_enums_template.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef ODriveEnums_h
#define ODriveEnums_h
/* TODO: This file is dangerous because the enums could potentially change between API versions. Should transmit as part of the JSON.
** To regenerate this file, nagivate to the top level of the ODrive repository and run:
** python Firmware/interface_generator_stub.py --definitions Firmware/odrive-interface.yaml --template tools/arduino_enums_template.j2 --output Arduino/ODriveArduino/ODriveEnums.h
*/
[%- for _, enum in value_types.items() %]
[%- if enum.is_enum %]
// [[enum.fullname]]
enum [[(enum.parent.name if enum.name in ['Error', 'Mode'] else '') + enum.name ]] {
[%- for k, value in enum['values'].items() %]
[[((((enum.parent.name if enum.name in ['Error', 'Mode'] else '') + enum.name) | to_macro_case) + "_" + (k | to_macro_case)).ljust(40)]] = [% if enum.is_flags %]0x[['%08x' | format(value.value)]][% else %][[value.value]][% endif %],
[%- endfor %]
};
[%- endif %]
[%- endfor %]
#endif