From be8907d634ac8967de1ae2ac8346b845f738c9e6 Mon Sep 17 00:00:00 2001 From: Ryan Date: Tue, 27 Sep 2022 18:37:13 +1000 Subject: Further refactoring of joystick feature (#18437) --- quantum/joystick.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'quantum/joystick.h') 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 . + */ + #pragma once #include @@ -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); -- cgit v1.2.3