Add 3rd encoder to VIA keymap (#11580)

This commit is contained in:
Danny 2021-01-21 17:23:27 -05:00 committed by GitHub
parent c03ad0f802
commit 71d8e72b80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,11 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
enum encoder_names {
_LEFT,
_RIGHT,
_MIDDLE,
};
enum layer_names { enum layer_names {
_ZERO, _ZERO,
_ONE, _ONE,
@ -36,17 +42,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}; };
void encoder_update_user(uint8_t index, bool clockwise) { void encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { if (index == _LEFT) {
if (clockwise) { if (clockwise) {
tap_code(KC_VOLU); tap_code(KC_VOLU);
} else { } else {
tap_code(KC_VOLD); tap_code(KC_VOLD);
} }
} else if (index == 1) { }
else if (index == _MIDDLE) {
if (clockwise) { if (clockwise) {
tap_code(KC_WH_U); tap_code(KC_DOWN);
} else { } else {
tap_code(KC_WH_D); tap_code(KC_UP);
}
}
else if (index == _RIGHT) {
if (clockwise) {
tap_code(KC_PGDN);
} else {
tap_code(KC_PGUP);
} }
} }
} }