Encoder map added to default keymap

This commit is contained in:
mohoyt 2024-01-26 11:11:13 +01:00
parent 8376687e8d
commit 64d0472b34
4 changed files with 25 additions and 17 deletions

View File

@ -18,8 +18,8 @@
},
"encoder": {
"rotary": [
{"pin_a": "D4", "pin_b": "C6"},
{"pin_a": "F4", "pin_b": "F5"}
{"pin_a": "C6", "pin_b": "D4"},
{"pin_a": "F5", "pin_b": "F4"}
]
},
"layouts": {
@ -156,7 +156,7 @@
{"label": "-", "matrix": [1, 11], "x": 11, "y": 2.25},
{"label": "=", "matrix": [1, 12], "x": 12, "y": 2.25},
{"label": "Backspace", "matrix": [1, 14], "x": 13, "y": 2.25, "w": 2},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Tab", "matrix": [2, 2], "x": 0, "y": 3.25, "w": 1.5},
{"label": "Q", "matrix": [2, 3], "x": 1.5, "y": 3.25},
@ -251,7 +251,7 @@
{"label": "=", "matrix": [1, 12], "x": 12, "y": 2.25},
{"label": "Backspace", "matrix": [1, 13], "x": 13, "y": 2.25},
{"label": "Backspace", "matrix": [1, 14], "x": 14, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Tab", "matrix": [2, 2], "x": 0, "y": 3.25, "w": 1.5},
{"label": "Q", "matrix": [2, 3], "x": 1.5, "y": 3.25},
@ -345,7 +345,7 @@
{"label": "-", "matrix": [1, 11], "x": 11, "y": 2.25},
{"label": "=", "matrix": [1, 12], "x": 12, "y": 2.25},
{"label": "Backspace", "matrix": [1, 14], "x": 13, "y": 2.25, "w": 2},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Tab", "matrix": [2, 2], "x": 0, "y": 3.25, "w": 1.5},
{"label": "Q", "matrix": [2, 3], "x": 1.5, "y": 3.25},
@ -442,7 +442,7 @@
{"label": "=", "matrix": [1, 12], "x": 12, "y": 2.25},
{"label": "Backspace", "matrix": [1, 13], "x": 13, "y": 2.25},
{"label": "Backspace", "matrix": [1, 14], "x": 14, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Tab", "matrix": [2, 2], "x": 0, "y": 3.25, "w": 1.5},
{"label": "Q", "matrix": [2, 3], "x": 1.5, "y": 3.25},
@ -538,7 +538,7 @@
{"label": "-", "matrix": [1, 11], "x": 11, "y": 2.25},
{"label": "=", "matrix": [1, 12], "x": 12, "y": 2.25},
{"label": "Backspace", "matrix": [1, 14], "x": 13, "y": 2.25, "w": 2},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Tab", "matrix": [2, 2], "x": 0, "y": 3.25, "w": 1.5},
{"label": "Q", "matrix": [2, 3], "x": 1.5, "y": 3.25},
@ -632,7 +632,7 @@
{"label": "=", "matrix": [1, 12], "x": 12, "y": 2.25},
{"label": "Backspace", "matrix": [1, 13], "x": 13, "y": 2.25},
{"label": "Backspace", "matrix": [1, 14], "x": 14, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Tab", "matrix": [2, 2], "x": 0, "y": 3.25, "w": 1.5},
{"label": "Q", "matrix": [2, 3], "x": 1.5, "y": 3.25},
@ -821,7 +821,7 @@
{"label": "=", "matrix": [1, 12], "x": 12, "y": 2.25},
{"label": "Backspace", "matrix": [1, 13], "x": 13, "y": 2.25},
{"label": "Backspace", "matrix": [1, 14], "x": 14, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Tab", "matrix": [2, 2], "x": 0, "y": 3.25, "w": 1.5},
{"label": "Q", "matrix": [2, 3], "x": 1.5, "y": 3.25},
@ -917,7 +917,7 @@
{"label": "-", "matrix": [1, 11], "x": 11, "y": 2.25},
{"label": "=", "matrix": [1, 12], "x": 12, "y": 2.25},
{"label": "Backspace", "matrix": [1, 14], "x": 13, "y": 2.25, "w": 2},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Tab", "matrix": [2, 2], "x": 0, "y": 3.25, "w": 1.5},
{"label": "Q", "matrix": [2, 3], "x": 1.5, "y": 3.25},
@ -1016,7 +1016,7 @@
{"label": "=", "matrix": [1, 12], "x": 12, "y": 2.25},
{"label": "Backspace", "matrix": [1, 13], "x": 13, "y": 2.25},
{"label": "Backspace", "matrix": [1, 14], "x": 14, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Tab", "matrix": [2, 2], "x": 0, "y": 3.25, "w": 1.5},
{"label": "Q", "matrix": [2, 3], "x": 1.5, "y": 3.25},
@ -1114,7 +1114,7 @@
{"label": "-", "matrix": [1, 11], "x": 11, "y": 2.25},
{"label": "=", "matrix": [1, 12], "x": 12, "y": 2.25},
{"label": "Backspace", "matrix": [1, 14], "x": 13, "y": 2.25, "w": 2},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Tab", "matrix": [2, 2], "x": 0, "y": 3.25, "w": 1.5},
{"label": "Q", "matrix": [2, 3], "x": 1.5, "y": 3.25},
@ -1210,7 +1210,7 @@
{"label": "=", "matrix": [1, 12], "x": 12, "y": 2.25},
{"label": "Backspace", "matrix": [1, 13], "x": 13, "y": 2.25},
{"label": "Backspace", "matrix": [1, 14], "x": 14, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Home", "matrix": [1, 15], "x": 15, "y": 2.25},
{"label": "Tab", "matrix": [2, 2], "x": 0, "y": 3.25, "w": 1.5},
{"label": "Q", "matrix": [2, 3], "x": 1.5, "y": 3.25},

View File

@ -34,3 +34,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ),
};
#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[0] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }
};
#endif

View File

@ -1,2 +1,3 @@
CUSTOM_MATRIX = lite # Lite custom matrix
SRC += matrix.c
ENCODER_MAP_ENABLE = yes

View File

@ -20,15 +20,15 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_MPRV);
} else {
tap_code(KC_MNXT);
} else {
tap_code(KC_MPRV);
}
} else if (index == 1) {
if (clockwise) {
tap_code_delay(KC_VOLD, 10);
} else {
tap_code_delay(KC_VOLU, 10);
} else {
tap_code_delay(KC_VOLD, 10);
}
}
return true;