summary refs log tree commit diff
path: root/common_features.mk
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2021-09-09 10:27:58 +1000
committerGitHub <noreply@github.com>2021-09-09 10:27:58 +1000
commit9e77cdf4e66ff1cfdd7effaf77e129bf3ae9a1a5 (patch)
tree03df93c79281afb39509bb4a0d30b94d519ce7a0 /common_features.mk
parent3f2a030de6a306ed72eafe7aa143a5b695f9469d (diff)
Bugfix for Joystick and JSON schema (#14295)
Diffstat (limited to 'common_features.mk')
-rw-r--r--common_features.mk22
1 files changed, 13 insertions, 9 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