diff options
-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 c92f98ab7..f4f79000b 100644 --- a/common_features.mk +++ b/common_features.mk | |||
@@ -698,19 +698,23 @@ ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes) | |||
698 | endif | 698 | endif |
699 | 699 | ||
700 | JOYSTICK_ENABLE ?= no | 700 | 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 | ||
702 | OPT_DEFS += -DJOYSTICK_ENABLE | 707 | OPT_DEFS += -DJOYSTICK_ENABLE |
703 | SRC += $(QUANTUM_DIR)/process_keycode/process_joystick.c | 708 | SRC += $(QUANTUM_DIR)/process_keycode/process_joystick.c |
704 | SRC += $(QUANTUM_DIR)/joystick.c | 709 | 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 | ||
711 | 710 | ||
712 | ifeq ($(strip $(JOYSTICK_ENABLE)), digital) | 711 | ifeq ($(strip $(JOYSTICK_DRIVER)), analog) |
713 | OPT_DEFS += -DDIGITAL_JOYSTICK_ENABLE | 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 | ||
714 | endif | 718 | endif |
715 | 719 | ||
716 | DIGITIZER_ENABLE ?= no | 720 | DIGITIZER_ENABLE ?= no |
diff --git a/docs/feature_joystick.md b/docs/feature_joystick.md index 12bbf5b35..95702d6a2 100644 --- a/docs/feature_joystick.md +++ b/docs/feature_joystick.md | |||
@@ -2,8 +2,6 @@ | |||
2 | 2 | ||
3 | The keyboard can be made to be recognized as a joystick HID device by the operating system. | 3 | The keyboard can be made to be recognized as a joystick HID device by the operating system. |
4 | 4 | ||
5 | This is enabled by adding `JOYSTICK_ENABLE` to `rules.mk`. You can set this value to `analog`, `digital`, or `no`. | ||
6 | |||
7 | !> Joystick support is not currently available on V-USB devices. | 5 | !> Joystick support is not currently available on V-USB devices. |
8 | 6 | ||
9 | The joystick feature provides two services: | 7 | The joystick feature provides two services: |
@@ -18,7 +16,8 @@ or send gamepad reports based on values computed by the keyboard. | |||
18 | To use analog input you must first enable it in `rules.mk`: | 16 | To use analog input you must first enable it in `rules.mk`: |
19 | 17 | ||
20 | ```makefile | 18 | ```makefile |
21 | JOYSTICK_ENABLE = analog | 19 | JOYSTICK_ENABLE = yes |
20 | JOYSTICK_DRIVER = analog # or 'digital' | ||
22 | ``` | 21 | ``` |
23 | 22 | ||
24 | 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). | 23 | 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 b910bdbe6..9e44c470f 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 | ||