diff options
Diffstat (limited to 'quantum/joystick.h')
-rw-r--r-- | quantum/joystick.h | 28 |
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); |