Remove encoder in-matrix workaround code (#20389)
This commit is contained in:
		
							parent
							
								
									74fbd5a031
								
							
						
					
					
						commit
						c4a67d3f33
					
				
					 241 changed files with 1106 additions and 5235 deletions
				
			
		| 
						 | 
				
			
			@ -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},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +1,2 @@
 | 
			
		|||
VIA_ENABLE = yes
 | 
			
		||||
ENCODER_MAP_ENABLE = yes
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue