Remove encoder in-matrix workaround code (#20389)

This commit is contained in:
jack
2023-06-19 09:46:27 -06:00
committed by GitHub
parent 74fbd5a031
commit c4a67d3f33
241 changed files with 1106 additions and 5235 deletions

View File

@@ -10,7 +10,7 @@
},
"matrix_pins": {
"cols": ["A5", "A6", "A7", "C7", "C6", "C5", "C4", "C3", "C2", "C1", "A4", "A3", "A2", "B4"],
"rows": ["D5", "D6", "C0", "D7", null]
"rows": ["D5", "D6", "C0", "D7"]
},
"diode_direction": "COL2ROW",
"encoder": {
@@ -126,66 +126,6 @@
{"matrix": [2, 12], "x": 11.75, "y": 3, "w": 1.75},
{"matrix": [2, 13], "x": 13.5, "y": 3},
{"matrix": [3, 0], "x": 0, "y": 4, "w": 1.25},
{"matrix": [3, 1], "x": 1.25, "y": 4, "w": 1.25},
{"matrix": [3, 2], "x": 2.5, "y": 4, "w": 1.25},
{"matrix": [3, 4], "x": 3.75, "y": 4, "w": 3},
{"matrix": [3, 6], "x": 6.75, "y": 4},
{"matrix": [3, 8], "x": 7.75, "y": 4, "w": 3},
{"matrix": [3, 11], "x": 10.75, "y": 4, "w": 1.25},
{"matrix": [3, 12], "x": 12, "y": 4, "w": 1.25},
{"matrix": [3, 13], "x": 13.25, "y": 4, "w": 1.25}
]
},
"LAYOUT_all": {
"layout": [
{"matrix": [4, 0], "x": 11.5, "y": 0},
{"matrix": [1, 13], "x": 12.5, "y": 0},
{"matrix": [4, 1], "x": 13.5, "y": 0},
{"matrix": [0, 0], "x": 0, "y": 1},
{"matrix": [0, 1], "x": 1, "y": 1},
{"matrix": [0, 2], "x": 2, "y": 1},
{"matrix": [0, 3], "x": 3, "y": 1},
{"matrix": [0, 4], "x": 4, "y": 1},
{"matrix": [0, 5], "x": 5, "y": 1},
{"matrix": [0, 6], "x": 6, "y": 1},
{"matrix": [0, 7], "x": 7, "y": 1},
{"matrix": [0, 8], "x": 8, "y": 1},
{"matrix": [0, 9], "x": 9, "y": 1},
{"matrix": [0, 10], "x": 10, "y": 1},
{"matrix": [0, 11], "x": 11, "y": 1},
{"matrix": [0, 12], "x": 12, "y": 1},
{"matrix": [0, 13], "x": 13, "y": 1, "w": 1.5},
{"matrix": [1, 0], "x": 0, "y": 2, "w": 1.25},
{"matrix": [1, 1], "x": 1.25, "y": 2},
{"matrix": [1, 2], "x": 2.25, "y": 2},
{"matrix": [1, 3], "x": 3.25, "y": 2},
{"matrix": [1, 4], "x": 4.25, "y": 2},
{"matrix": [1, 5], "x": 5.25, "y": 2},
{"matrix": [1, 6], "x": 6.25, "y": 2},
{"matrix": [1, 7], "x": 7.25, "y": 2},
{"matrix": [1, 8], "x": 8.25, "y": 2},
{"matrix": [1, 9], "x": 9.25, "y": 2},
{"matrix": [1, 10], "x": 10.25, "y": 2},
{"matrix": [1, 11], "x": 11.25, "y": 2},
{"matrix": [1, 12], "x": 12.25, "y": 2, "w": 2.25},
{"matrix": [2, 0], "x": 0, "y": 3, "w": 1.75},
{"matrix": [2, 1], "x": 1.75, "y": 3},
{"matrix": [2, 2], "x": 2.75, "y": 3},
{"matrix": [2, 3], "x": 3.75, "y": 3},
{"matrix": [2, 4], "x": 4.75, "y": 3},
{"matrix": [2, 5], "x": 5.75, "y": 3},
{"matrix": [2, 6], "x": 6.75, "y": 3},
{"matrix": [2, 7], "x": 7.75, "y": 3},
{"matrix": [2, 8], "x": 8.75, "y": 3},
{"matrix": [2, 9], "x": 9.75, "y": 3},
{"matrix": [2, 10], "x": 10.75, "y": 3},
{"matrix": [2, 12], "x": 11.75, "y": 3, "w": 1.75},
{"matrix": [2, 13], "x": 13.5, "y": 3},
{"matrix": [3, 0], "x": 0, "y": 4, "w": 1.25},
{"matrix": [3, 1], "x": 1.25, "y": 4, "w": 1.25},
{"matrix": [3, 2], "x": 2.5, "y": 4, "w": 1.25},

View File

@@ -16,29 +16,29 @@
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_all(
KC_VOLD, KC_MUTE, KC_VOLU,
[0] = LAYOUT_ansi(
KC_MUTE,
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS,
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1),
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_BSPC, KC_RALT, KC_RGUI, KC_RCTL
),
[1] = LAYOUT_all(
_______, _______, _______,
[1] = LAYOUT_ansi(
_______,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, _______,
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, _______,
_______, KC_F11, KC_F12, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______
),
[2] = LAYOUT_all(
_______, _______, _______,
[2] = LAYOUT_ansi(
_______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______
),
[3] = LAYOUT_all(
_______, _______, _______,
[3] = LAYOUT_ansi(
_______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@@ -46,43 +46,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
keyevent_t encoder_ccw = {
.key = (keypos_t){.row = 4, .col = 0},
.pressed = false,
.type = KEY_EVENT
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(_______, _______) },
[2] = { ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______) },
};
keyevent_t encoder_cw = {
.key = (keypos_t){.row = 4, .col = 1},
.pressed = false,
.type = KEY_EVENT
};
void matrix_scan_user(void) {
if (encoder_ccw.pressed) {
encoder_ccw.pressed = false;
encoder_ccw.time = timer_read();
action_exec(encoder_ccw);
}
if (encoder_cw.pressed) {
encoder_cw.pressed = false;
encoder_cw.time = timer_read();
action_exec(encoder_cw);
}
}
bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
encoder_cw.pressed = true;
encoder_cw.time = timer_read();
action_exec(encoder_cw);
wait_ms(20);
} else {
encoder_ccw.pressed = true;
encoder_ccw.time = timer_read();
action_exec(encoder_ccw);
wait_ms(20);
}
return true;
}
#endif

View File

@@ -1 +1,2 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@@ -329,9 +329,7 @@
{"matrix": [5, 9], "x": 10, "y": 5.25, "w": 1.5},
{"matrix": [5, 10], "x": 11.5, "y": 5.25, "w": 1.5},
{"matrix": [5, 12], "x": 13.25, "y": 5.5},
{"matrix": [5, 13], "x": 14.25, "y": 5.5},
{"matrix": [5, 14], "x": 15.25, "y": 5.5}
{"matrix": [5, 13], "x": 14.25, "y": 5.5}
]
}
}

View File

@@ -19,7 +19,7 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_all(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_VOLD, KC_MUTE, KC_VOLU,
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_MUTE,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC, KC_HOME,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN,
@@ -27,7 +27,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_SPC, KC_NO, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT_all(
QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@@ -35,7 +35,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[2] = LAYOUT_all(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@@ -43,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[3] = LAYOUT_all(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@@ -52,31 +52,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
keyevent_t encoder_ccw = {
.key = (keypos_t){.row = 6, .col = 0},
.pressed = false,
.type = KEY_EVENT
};
keyevent_t encoder_cw = {
.key = (keypos_t){.row = 6, .col = 1},
.pressed = false,
.type = KEY_EVENT
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(_______, _______) },
[2] = { ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______) },
};
void matrix_scan_user(void) {
if (encoder_ccw.pressed) {
encoder_ccw.pressed = false;
encoder_ccw.time = timer_read();
action_exec(encoder_ccw);
}
if (encoder_cw.pressed) {
encoder_cw.pressed = false;
encoder_cw.time = timer_read();
action_exec(encoder_cw);
}
}
#endif
#ifdef OLED_ENABLE
uint32_t anim_timer = 0;
@@ -85,25 +68,6 @@ uint8_t current_frame = 0;
#define FRAME_DURATION 50
bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
encoder_cw.pressed = true;
encoder_cw.time = timer_read();
action_exec(encoder_cw);
wait_ms(20);
anim_sleep = timer_read32();
oled_on();
} else {
encoder_ccw.pressed = true;
encoder_ccw.time = timer_read();
action_exec(encoder_ccw);
wait_ms(20);
anim_sleep = timer_read32();
oled_on();
}
return true;
}
static void render_pattern(void) {
void animate(void) {
oled_set_cursor(4, 0);

View File

@@ -1 +1,2 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@@ -460,10 +460,7 @@
{"matrix": [7, 23], "x": 15.25, "y": 5.75},
{"matrix": [7, 24], "x": 16.25, "y": 5.75},
{"matrix": [7, 25], "x": 17.25, "y": 5.75},
{"matrix": [13, 0], "x": 18.5, "y": 0},
{"matrix": [13, 1], "x": 18.5, "y": 1}
{"matrix": [7, 25], "x": 17.25, "y": 5.75}
]
}
}

View File

@@ -22,46 +22,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_SPC, KC_NO, KC_RALT, KC_RGUI, KC_MENU, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT,
KC_VOLU, KC_VOLD
),
KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_SPC, KC_NO, KC_RALT, KC_RGUI, KC_MENU, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
)
};
keyevent_t encoder_ccw = {
.key = (keypos_t){.row = 13, .col = 0},
.pressed = false,
.type = KEY_EVENT
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }
};
keyevent_t encoder_cw = {
.key = (keypos_t){.row = 13, .col = 1},
.pressed = false,
.type = KEY_EVENT
};
void matrix_scan_user(void) {
if (encoder_ccw.pressed) {
encoder_ccw.pressed = false;
encoder_ccw.time = timer_read();
action_exec(encoder_ccw);
}
if (encoder_cw.pressed) {
encoder_cw.pressed = false;
encoder_cw.time = timer_read();
action_exec(encoder_cw);
}
}
bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
encoder_cw.pressed = true;
encoder_cw.time = timer_read();
action_exec(encoder_cw);
} else {
encoder_ccw.pressed = true;
encoder_ccw.time = timer_read();
action_exec(encoder_ccw);
}
return true;
}
#endif

View File

@@ -1 +1,2 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes

View File

@@ -396,10 +396,7 @@
{"matrix": [10, 8], "x": 16.25, "y": 5.25},
{"matrix": [11, 8], "x": 17.25, "y": 5.25},
{"matrix": [10, 9], "x": 18.25, "y": 5.25},
{"matrix": [11, 9], "x": 19.25, "y": 5.25},
{"matrix": [12, 0], "x": 19, "y": 0, "w": 0.5},
{"matrix": [12, 1], "x": 20.5, "y": 0, "w": 0.5}
{"matrix": [11, 9], "x": 19.25, "y": 5.25}
]
}
}

View File

@@ -14,6 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_all(
KC_PSCR, KC_SCRL, KC_PAUS, KC_INS, KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL,
@@ -21,8 +22,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_P7, KC_P8, KC_P9, KC_PPLS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_END,
KC_P4, KC_P5, KC_P6, KC_NO, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP,
KC_P1, KC_P2, KC_P3, KC_PENT, KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN,
KC_P0, KC_NO, KC_PDOT, KC_NO, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_NO, KC_LEFT, KC_DOWN, KC_RGHT,
KC_VOLD, KC_VOLU
KC_P0, KC_NO, KC_PDOT, KC_NO, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_NO, KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT_all(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@@ -30,49 +30,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
};
keyevent_t encoder_ccw = {
.key = (keypos_t){.row = 12, .col = 0},
.pressed = false,
.type = KEY_EVENT
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(_______, _______) }
};
keyevent_t encoder_cw = {
.key = (keypos_t){.row = 12, .col = 1},
.pressed = false,
.type = KEY_EVENT
};
void matrix_scan_user(void) {
if (encoder_ccw.pressed) {
encoder_ccw.pressed = false;
encoder_ccw.time = timer_read();
action_exec(encoder_ccw);
}
if (encoder_cw.pressed) {
encoder_cw.pressed = false;
encoder_cw.time = timer_read();
action_exec(encoder_cw);
}
}
bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
encoder_cw.pressed = true;
encoder_cw.time = timer_read();
action_exec(encoder_cw);
} else {
encoder_ccw.pressed = true;
encoder_ccw.time = timer_read();
action_exec(encoder_ccw);
}
return true;
}
#endif
#ifdef RGBLIGHT_ENABLE
// Can probably still be optimized, but I like it as is for clarity

View File

@@ -1 +1,2 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes