mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-18 13:42:00 +00:00
move encoders to keymap, encoder_map
This commit is contained in:
parent
091a0747c4
commit
7c3cc826cb
@ -34,36 +34,3 @@ bool oled_task_kb(void) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
//Knobs
|
||||
#ifdef ENCODER_ENABLE
|
||||
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||
if (!encoder_update_user(index, clockwise)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (index == 0) {
|
||||
// Page Up/Down
|
||||
if (clockwise) {
|
||||
tap_code(KC_PGDN);
|
||||
} else {
|
||||
tap_code(KC_PGUP);
|
||||
}
|
||||
} else if (index == 1) {
|
||||
// Mouse Wheel Up/Down
|
||||
if (clockwise) {
|
||||
tap_code(KC_MS_WH_DOWN);
|
||||
} else {
|
||||
tap_code(KC_MS_WH_UP);
|
||||
}
|
||||
} else if (index == 2) {
|
||||
// Volume Up/Down
|
||||
if (clockwise) {
|
||||
tap_code(KC_VOLU);
|
||||
} else {
|
||||
tap_code(KC_VOLD);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
@ -59,3 +59,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
The large knob press is mapped as KC_B, despite it not having one.
|
||||
I'm not quite sure why, but the only reason it can't be clicked is because the potentiometer is different.
|
||||
If you were to replace it with one that can be clicked, it would work. I shorted it and it does work.*/
|
||||
|
||||
#ifdef ENCODER_MAP_ENABLE
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
[0] = { ENCODER_CCW_CW(KC_PGUP, KC_PGDN), ENCODER_CCW_CW(MS_WHLU, MS_WHLD), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
|
||||
[1] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }
|
||||
};
|
||||
#endif
|
||||
|
1
keyboards/doio/kb38/keymaps/default/rules.mk
Normal file
1
keyboards/doio/kb38/keymaps/default/rules.mk
Normal file
@ -0,0 +1 @@
|
||||
ENCODER_MAP_ENABLE = yes
|
Loading…
Reference in New Issue
Block a user