summaryrefslogtreecommitdiff
path: root/quantum/joystick.h
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2022-09-27 18:37:13 +1000
committerGitHub <noreply@github.com>2022-09-27 18:37:13 +1000
commitbe8907d634ac8967de1ae2ac8346b845f738c9e6 (patch)
tree5a56127946000bbd648f8a5f52d90eb6711be222 /quantum/joystick.h
parentfb400f2ac2c57fa0fc82ca803f6450b818bb32f9 (diff)
Further refactoring of joystick feature (#18437)
Diffstat (limited to 'quantum/joystick.h')
-rw-r--r--quantum/joystick.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/quantum/joystick.h b/quantum/joystick.h
index 5d81b14ef2..ee966fdb1a 100644
--- a/quantum/joystick.h
+++ b/quantum/joystick.h
@@ -1,3 +1,19 @@
+/* Copyright 2022
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#pragma once
#include <stdint.h>
@@ -54,7 +70,10 @@ typedef struct {
extern joystick_config_t joystick_axes[JOYSTICK_AXES_COUNT];
-enum joystick_status { JS_INITIALIZED = 1, JS_UPDATED = 2 };
+enum joystick_status {
+ JS_INITIALIZED = 1,
+ JS_UPDATED,
+};
typedef struct {
uint8_t buttons[(JOYSTICK_BUTTON_COUNT - 1) / 8 + 1];
@@ -65,7 +84,14 @@ typedef struct {
extern joystick_t joystick_status;
+void joystick_task(void);
void joystick_flush(void);
void register_joystick_button(uint8_t button);
void unregister_joystick_button(uint8_t button);
+
+int16_t joystick_read_axis(uint8_t axis);
+void joystick_read_axes(void);
+void joystick_set_axis(uint8_t axis, int16_t value);
+
+void host_joystick_send(joystick_t *joystick);