Joystick: add support for 8-way hat switch (#24515)
This commit is contained in:
parent
69093f6de9
commit
a3cfb1dab7
7 changed files with 124 additions and 2 deletions
|
@ -29,6 +29,9 @@ joystick_t joystick_state = {
|
|||
0
|
||||
#endif
|
||||
},
|
||||
#ifdef JOYSTICK_HAS_HAT
|
||||
.hat = -1,
|
||||
#endif
|
||||
.dirty = false,
|
||||
};
|
||||
|
||||
|
@ -145,6 +148,13 @@ void joystick_set_axis(uint8_t axis, int16_t value) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef JOYSTICK_HAS_HAT
|
||||
void joystick_set_hat(int8_t value) {
|
||||
joystick_state.hat = value;
|
||||
joystick_state.dirty = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void joystick_init(void) {
|
||||
joystick_init_axes();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue