aboutsummaryrefslogtreecommitdiff
path: root/quantum/joystick.c
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2024-11-10 09:10:10 +1100
committerGitHub <noreply@github.com>2024-11-09 14:10:10 -0800
commita3cfb1dab7679a774d8aa09f7b609f3302dad73d (patch)
tree315e8c7a35ae390b56f84def0d37b867bfa428c7 /quantum/joystick.c
parent69093f6de9b551bd84ff0a8eabcccca73026d55e (diff)
Joystick: add support for 8-way hat switch (#24515)
Diffstat (limited to 'quantum/joystick.c')
-rw-r--r--quantum/joystick.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/quantum/joystick.c b/quantum/joystick.c
index 32f19b2cd9..62893fd199 100644
--- a/quantum/joystick.c
+++ b/quantum/joystick.c
@@ -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();
}