diff options
author | Nick Brassel <[email protected]> | 2022-03-09 19:29:00 +1100 |
---|---|---|
committer | GitHub <[email protected]> | 2022-03-09 19:29:00 +1100 |
commit | 8d5eacb7dd76bfd45444ceb1efa9a9f840173552 (patch) | |
tree | b6b8b641dd61f5de0c5b7ee1bf251f6a84043656 /docs/feature_encoders.md | |
parent | 7121a228eb204a0d697c97503ac7a28b762ab598 (diff) | |
download | qmk_firmware-8d5eacb7dd76bfd45444ceb1efa9a9f840173552.tar.gz qmk_firmware-8d5eacb7dd76bfd45444ceb1efa9a9f840173552.zip |
Add support for encoder mapping. (#13286)
Diffstat (limited to 'docs/feature_encoders.md')
-rw-r--r-- | docs/feature_encoders.md | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/docs/feature_encoders.md b/docs/feature_encoders.md index f71c7e7325..a3d56fd5ef 100644 --- a/docs/feature_encoders.md +++ b/docs/feature_encoders.md @@ -67,9 +67,30 @@ Additionally, if one side does not have an encoder, you can specify `{}` for the #define ENCODER_RESOLUTIONS_RIGHT { 4 } ``` +## Encoder map + +Encoder mapping may be added to your `keymap.c`, which replicates the normal keyswitch layer handling functionality, but with encoders. Add this to your `rules.mk`: + +```make +ENCODER_MAP_ENABLE = yes +``` + +Your `keymap.c` will then need an encoder mapping defined (for four layers and two encoders): + +```c +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [_BASE] = { ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [_LOWER] = { ENCODER_CCW_CW(RGB_HUD, RGB_HUI), ENCODER_CCW_CW(RGB_SAD, RGB_SAI) }, + [_RAISE] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI), ENCODER_CCW_CW(RGB_SPD, RGB_SPI) }, + [_ADJUST] = { ENCODER_CCW_CW(RGB_RMOD, RGB_MOD), ENCODER_CCW_CW(KC_RIGHT, KC_LEFT) }, +}; +#endif +``` + ## Callbacks -The callback functions can be inserted into your `<keyboard>.c`: +When not using `ENCODER_MAP_ENABLE = yes`, the callback functions can be inserted into your `<keyboard>.c`: ```c bool encoder_update_kb(uint8_t index, bool clockwise) { |