wheelmesg.h (429B)
1 #pragma once 2 #include <stdbool.h> 3 4 enum wheel_cmd_type { 5 AUTOCENTER, 6 AUTOCENTER_FORCE, 7 GAIN, 8 RANGE, 9 NONE, 10 }; 11 12 // tagged union 13 struct wheel_cmd { 14 enum wheel_cmd_type type; 15 union { 16 bool autocenter; 17 int autocenter_force; 18 int gain; 19 int range; 20 } value; 21 }; 22 23 24 /* struct wheel_cmd a = { */ 25 /* .type = AUTOCENTER, */ 26 /* .value = { .autocenter = true } */ 27 /* }; */