move encoders to keymap, encoder_map

This commit is contained in:
clownfish-og 2025-04-24 15:35:41 -04:00
parent 091a0747c4
commit 7c3cc826cb
No known key found for this signature in database
GPG Key ID: C9D44CAF2D9FF6EA
3 changed files with 8 additions and 33 deletions

View File

@ -34,36 +34,3 @@ bool oled_task_kb(void) {
return true; return true;
} }
#endif #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

View File

@ -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. 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. 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.*/ 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

View File

@ -0,0 +1 @@
ENCODER_MAP_ENABLE = yes