1
0
Fork 0
forked from forks/qmk_firmware
qmk_firmware/keyboards/splitkb/kyria/keymaps/gotham
..
config.h
encoder_utils.c
encoder_utils.h
keycodes.h
keymap.c
oled_utils.c
oled_utils.h
README.md
rules.mk
thumbstick.c
thumbstick.h

Gotham's Keymap for Kyria

Keymap

This is my personal keymap for Kyria with some mods.

More information about the Kyria keyboard can be found here

Rotary Encoders

Press the encoder on each half to cycle between:

  • Volume
  • Word Nav (Ctrl + Left / Right)
  • Left / Right
  • Up / Down
  • Page Up / Page Down

OLEDs

Master-side OLED displays dynamic data:

  • Current layer
  • Current mode of each rotary encoder
  • Current mode of thumbstick

Slave-side OLED currently only displays a static content.

Thumbstick

A PSP 2000 thumbstick is attached to the right half. It will currently only function when the USB cable is connected to the right half. When I figure out how to transfer data between halves using serial link, I will make this work regardless of which side is the master.

Thumbstick Configuration

  • THUMBSTICK_ENABLE: Enable thumbstick.
  • THUMBSTICK_PIN_X/Y (mandatory): The QMK pins to use for the respective axis. The values are from the QMK's ADC driver. I used F0 and F1, for example.
  • THUMBSTICK_FLIP_X/Y: Mirror the direction of the respective axis. Use to compensate for actual orientation of thumbstick.
  • THUMBSTICK_DEBUG: Print raw and calculated values from analogReadPin to console. Will only work with CONSOLE_ENABLE turned on.

Thumbstick Fine-tuning

More tunables are described here. Values like deadzone threshold are hardware-specific. The theoretical range for analog readings is [0, 1023], but emperical readings don't extend the entire range. To find the right values, turn on CONSOLE_ENABLE in rules.mk and THUMBSTICK_DEBUG in config.h to look at the raw values from the pins using hid_listen (or QMK Toolbox).

  • THUMBSTICK_DEAD_ZONE 90: Values below this are ignored (deadzone).

  • THUMBSTICK_FINE_ZONE 180: Values below this enable fine movement.

  • THUMBSTICK_MODE : One of THUMBSTICK_MODE_MOUSE, THUMBSTICK_MODE_ARROWS and THUMBSTICK_MODE_SCROLL. This is just the default mode, it can be changed by calling void thumbstick_mode_cycle(bool reverse) within code.

  • THUMBSTICK_SPEED 127: Cursor speed in THUMBSTICK_MODE_MOUSE.

  • THUMBSTICK_FINE_SPEED 64: Fine cursor speed in THUMBSTICK_MODE_MOUSE (kicks in when slightly nudging the thumbstick).

  • THUMBSTICK_SCROLL_SPEED 1: Scrolling speed in THUMBSTICK_MODE_SCROLL.

  • THUMBSTICK_EIGHT_AXIS true: 8-axis toggle for ARROW and SCROLL modes. Disable to fall back to 4 axes (think D-pads vs analog stick).

  • THUMBSTICK_AXIS_SEPARATION 0.5f: Float value between 0 and 1, used to discretize the circular range into distinct zones for 8-axis. Imagine the top-right quadrant on a graph, and picture the diagonal. This value indicates the angular "distance" from the diagonal to either axis. Moving from the diagonal to each of the axes, this value changes from 0 to 1. So, a value of 0.5 will "sweep" from the center to half-way towards each axis, creating a zone across the diagonal. Smaller values make narrower diagonal zones, and vice versa.

Thanks

  • @pyrho and u/_GEIST_ for the inspiration and initial reference code.
  • @zvecr and @drashna for code review and more pointers.