Skip to content

Commit 01aafcd

Browse files
fauxparkcori
authored andcommitted
Bugfix for Joystick and JSON schema (qmk#14295)
1 parent f4ba9fd commit 01aafcd

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

common_features.mk

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -698,19 +698,23 @@ ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes)
698698
endif
699699

700700
JOYSTICK_ENABLE ?= no
701-
ifneq ($(strip $(JOYSTICK_ENABLE)), no)
701+
VALID_JOYSTICK_TYPES := analog digital
702+
JOYSTICK_DRIVER ?= analog
703+
ifeq ($(strip $(JOYSTICK_ENABLE)), yes)
704+
ifeq ($(filter $(JOYSTICK_DRIVER),$(VALID_JOYSTICK_TYPES)),)
705+
$(error "$(JOYSTICK_DRIVER)" is not a valid joystick driver)
706+
endif
702707
OPT_DEFS += -DJOYSTICK_ENABLE
703708
SRC += $(QUANTUM_DIR)/process_keycode/process_joystick.c
704709
SRC += $(QUANTUM_DIR)/joystick.c
705-
endif
706-
707-
ifeq ($(strip $(JOYSTICK_ENABLE)), analog)
708-
OPT_DEFS += -DANALOG_JOYSTICK_ENABLE
709-
SRC += analog.c
710-
endif
711710

712-
ifeq ($(strip $(JOYSTICK_ENABLE)), digital)
713-
OPT_DEFS += -DDIGITAL_JOYSTICK_ENABLE
711+
ifeq ($(strip $(JOYSTICK_DRIVER)), analog)
712+
OPT_DEFS += -DANALOG_JOYSTICK_ENABLE
713+
SRC += analog.c
714+
endif
715+
ifeq ($(strip $(JOYSTICK_DRIVER)), digital)
716+
OPT_DEFS += -DDIGITAL_JOYSTICK_ENABLE
717+
endif
714718
endif
715719

716720
DIGITIZER_ENABLE ?= no

docs/feature_joystick.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
The keyboard can be made to be recognized as a joystick HID device by the operating system.
44

5-
This is enabled by adding `JOYSTICK_ENABLE` to `rules.mk`. You can set this value to `analog`, `digital`, or `no`.
6-
75
!> Joystick support is not currently available on V-USB devices.
86

97
The joystick feature provides two services:
@@ -18,7 +16,8 @@ or send gamepad reports based on values computed by the keyboard.
1816
To use analog input you must first enable it in `rules.mk`:
1917

2018
```makefile
21-
JOYSTICK_ENABLE = analog
19+
JOYSTICK_ENABLE = yes
20+
JOYSTICK_DRIVER = analog # or 'digital'
2221
```
2322
2423
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).
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
JOYSTICK_ENABLE = analog
1+
JOYSTICK_ENABLE = yes

0 commit comments

Comments
 (0)