1
0
Fork 0

Joystick: add support for 8-way hat switch (#24515)

This commit is contained in:
Ryan 2024-11-10 09:10:10 +11:00 committed by GitHub
parent 69093f6de9
commit a3cfb1dab7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 124 additions and 2 deletions

View file

@ -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();
}