The keyboard can be made to be recognized as a joystick HID device by the operating system.
The keyboard can be made to be recognized as a joystick HID device by the operating system.
This is enabled by adding the following to `rules.mk`:
This is enabled by adding `JOYSTICK_ENABLE` to `rules.mk`. You can set this value to `analog`, `digital`, or `no`.
```makefile
JOYSTICK_ENABLE = yes
```
!> Joystick support is not currently available on V-USB devices.
!> Joystick support is not currently available on V-USB devices.
@ -19,6 +15,12 @@ or send gamepad reports based on values computed by the keyboard.
### Analog Input
### Analog Input
To use analog input you must first enable it in `rules.mk`:
```makefile
JOYSTICK_ENABLE = analog
```
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).
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).
It is composed of three connectors linked to the ground, the power input and power output (usually the middle one). The power output holds the voltage that varies based on the position of the cursor,
It is composed of three connectors linked to the ground, the power input and power output (usually the middle one). The power output holds the voltage that varies based on the position of the cursor,
which value will be read using your MCU's [ADC](https://en.wikipedia.org/wiki/Analog-to-digital_converter).
which value will be read using your MCU's [ADC](https://en.wikipedia.org/wiki/Analog-to-digital_converter).
@ -75,7 +77,7 @@ You assign a value by writing to `joystick_status.axes[axis_index]` a signed 8-b
The following example writes two axes based on keypad presses, with `KC_P5` as a precision modifier:
The following example writes two axes based on keypad presses, with `KC_P5` as a precision modifier: