Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix for Joystick and JSON schema #14295

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions common_features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions docs/feature_joystick.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion keyboards/handwired/onekey/keymaps/joystick/rules.mk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
JOYSTICK_ENABLE = analog
JOYSTICK_ENABLE = yes