Provide Button and Axis enum data in cached state
When trying to use this library, I have a need to use the cached data, and provide a mapping from the different axes and buttons to specific magic u8 constants. The buttons() and axes() iterators do not provide the enums, only a Code, which has led to this horrendously opaque and unintuitive function in my codebase.
fn code_to_roborio(code: Code) -> u8 {
match code.into_u32() {
// Axes (sticks and triggers)
196608 => 0,
196609 => 1,
196610 => 2,
196613 => 3,
196611 => 4,
196612 => 5,
// Buttons
65840 => 1,
65841 => 2,
65844 => 3,
65843 => 4,
65846 => 5,
65847 => 6,
65850 => 7,
65851 => 8,
65853 => 9,
65854 => 10,
code => unreachable!("Unknown code {}", code),
}
}
I would love it if the higher level enums were provided here to make this mapping a lot more clear