2020-04-13 05:32:46 +00:00
|
|
|
#include QMK_KEYBOARD_H
|
|
|
|
|
2021-01-21 22:23:27 +00:00
|
|
|
enum encoder_names {
|
|
|
|
_LEFT,
|
|
|
|
_RIGHT,
|
|
|
|
_MIDDLE,
|
|
|
|
};
|
|
|
|
|
2020-04-13 05:32:46 +00:00
|
|
|
enum layer_names {
|
|
|
|
_ZERO,
|
|
|
|
_ONE,
|
|
|
|
_TWO,
|
|
|
|
_THREE
|
|
|
|
};
|
|
|
|
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
|
|
|
|
|
|
[_ZERO] = LAYOUT(
|
|
|
|
KC_MPLY, KC_HOME, KC_MUTE,
|
|
|
|
MO(1), KC_UP, RGB_MOD,
|
|
|
|
KC_LEFT, KC_DOWN, KC_RGHT
|
|
|
|
),
|
|
|
|
|
|
|
|
[_ONE] = LAYOUT(
|
|
|
|
RESET, BL_STEP, KC_STOP,
|
|
|
|
_______, KC_HOME, RGB_MOD,
|
|
|
|
KC_MPRV, KC_END , KC_MNXT
|
|
|
|
),
|
|
|
|
|
|
|
|
[_TWO] = LAYOUT(
|
|
|
|
_______, _______, _______,
|
|
|
|
_______, _______, _______,
|
|
|
|
_______, _______, _______
|
|
|
|
),
|
|
|
|
|
|
|
|
[_THREE] = LAYOUT(
|
|
|
|
_______, _______, _______,
|
|
|
|
_______, _______, _______,
|
|
|
|
_______, _______, _______
|
|
|
|
)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
void encoder_update_user(uint8_t index, bool clockwise) {
|
2021-01-21 22:23:27 +00:00
|
|
|
if (index == _LEFT) {
|
2020-04-13 05:32:46 +00:00
|
|
|
if (clockwise) {
|
|
|
|
tap_code(KC_VOLU);
|
|
|
|
} else {
|
|
|
|
tap_code(KC_VOLD);
|
|
|
|
}
|
2021-01-21 22:23:27 +00:00
|
|
|
}
|
|
|
|
else if (index == _MIDDLE) {
|
|
|
|
if (clockwise) {
|
|
|
|
tap_code(KC_DOWN);
|
|
|
|
} else {
|
|
|
|
tap_code(KC_UP);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (index == _RIGHT) {
|
2020-04-13 05:32:46 +00:00
|
|
|
if (clockwise) {
|
2021-01-21 22:23:27 +00:00
|
|
|
tap_code(KC_PGDN);
|
2020-04-13 05:32:46 +00:00
|
|
|
} else {
|
2021-01-21 22:23:27 +00:00
|
|
|
tap_code(KC_PGUP);
|
2020-04-13 05:32:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|