diff options
author | Ryan <fauxpark@gmail.com> | 2021-09-09 10:27:58 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-09 10:27:58 +1000 |
commit | 9e77cdf4e66ff1cfdd7effaf77e129bf3ae9a1a5 (patch) | |
tree | 03df93c79281afb39509bb4a0d30b94d519ce7a0 | |
parent | 3f2a030de6a306ed72eafe7aa143a5b695f9469d (diff) |
Bugfix for Joystick and JSON schema (#14295)
-rw-r--r-- | common_features.mk | 22 | ||||
-rw-r--r-- | docs/feature_joystick.md | 5 | ||||
-rw-r--r-- | keyboards/handwired/onekey/keymaps/joystick/rules.mk | 2 |
3 files changed, 16 insertions, 13 deletions
diff --git a/common_features.mk b/common_features.mk index c92f98ab7f..f4f79000b3 100644 --- a/common_features.mk +++ b/common_features.mk @@ -698,19 +698,23 @@ ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes) endif JOYSTICK_ENABLE ?= no -ifneq ($(strip $(JOYSTICK_ENABLE)), no) +VALID_JOYSTICK_TYPES := analog digital +JOYSTICK_DRIVER ?= analog +ifeq ($(strip $(JOYSTICK_ENABLE)), yes) + ifeq ($(filter $(JOYSTICK_DRIVER),$(VALID_JOYSTICK_TYPES)),) + $(error "$(JOYSTICK_DRIVER)" is not a valid joystick driver) + endif OPT_DEFS += -DJOYSTICK_ENABLE SRC += $(QUANTUM_DIR)/process_keycode/process_joystick.c SRC += $(QUANTUM_DIR)/joystick.c -endif - -ifeq ($(strip $(JOYSTICK_ENABLE)), analog) - OPT_DEFS += -DANALOG_JOYSTICK_ENABLE - SRC += analog.c -endif -ifeq ($(strip $(JOYSTICK_ENABLE)), digital) - OPT_DEFS += -DDIGITAL_JOYSTICK_ENABLE + ifeq ($(strip $(JOYSTICK_DRIVER)), analog) + OPT_DEFS += -DANALOG_JOYSTICK_ENABLE + SRC += analog.c + endif + ifeq ($(strip $(JOYSTICK_DRIVER)), digital) + OPT_DEFS += -DDIGITAL_JOYSTICK_ENABLE + endif endif DIGITIZER_ENABLE ?= no diff --git a/docs/feature_joystick.md b/docs/feature_joystick.md index 12bbf5b35e..95702d6a23 100644 --- a/docs/feature_joystick.md +++ b/docs/feature_joystick.md @@ -2,8 +2,6 @@ The keyboard can be made to be recognized as a joystick HID device by the operating system. -This is enabled by adding `JOYSTICK_ENABLE` to `rules.mk`. You can set this value to `analog`, `digital`, or `no`. - !> Joystick support is not currently available on V-USB devices. The joystick feature provides two services: @@ -18,7 +16,8 @@ or send gamepad reports based on values computed by the keyboard. To use analog input you must first enable it in `rules.mk`: ```makefile -JOYSTICK_ENABLE = analog +JOYSTICK_ENABLE = yes +JOYSTICK_DRIVER = analog # or 'digital' ``` An analog device such as a potentiometer found on a gamepad's analog axes is based on a [voltage divider](https://en.wikipedia.org/wiki/Voltage_divider). diff --git a/keyboards/handwired/onekey/keymaps/joystick/rules.mk b/keyboards/handwired/onekey/keymaps/joystick/rules.mk index b910bdbe6c..9e44c470f2 100644 --- a/keyboards/handwired/onekey/keymaps/joystick/rules.mk +++ b/keyboards/handwired/onekey/keymaps/joystick/rules.mk @@ -1 +1 @@ -JOYSTICK_ENABLE = analog +JOYSTICK_ENABLE = yes |