Skip to content

Commit

Permalink
Remove encoder in-matrix workaround code (qmk#20389)
Browse files Browse the repository at this point in the history
  • Loading branch information
waffle87 authored Jun 19, 2023
1 parent 74fbd5a commit c4a67d3
Show file tree
Hide file tree
Showing 241 changed files with 1,105 additions and 5,234 deletions.
3 changes: 0 additions & 3 deletions keyboards/atlantis/ak81_ve/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

#pragma once

#define ENCODERS_CCW_KEY { { 4, 5 } } // Note: array is { col, row )
#define ENCODERS_CW_KEY { { 3, 5 } } // Note: array is { col, row )

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE

Expand Down
91 changes: 42 additions & 49 deletions keyboards/atlantis/ak81_ve/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,54 +16,47 @@

#include QMK_KEYBOARD_H

#define LAYOUT_via( \
K000, K001, K002, K003, K004, K005, K006, K007, K008, K010, K011, K012, K013, K014, \
K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, \
K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214, \
K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K314, \
K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K413, K414, \
K500, K501, K502, K503, K504, K506, K510, K511, K512, K513, K514 \
) { \
{ K000, K001, K002, K003, K004, K005, K006, K007, K008, KC_NO, K010, K011, K012, K013, K014 }, \
{ K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114 }, \
{ K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214 }, \
{ K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, KC_NO, K314 }, \
{ K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, KC_NO, K413, K414 }, \
{ K500, K501, K502, K503, K504, KC_NO, K506, KC_NO, KC_NO, KC_NO, K510, K511, K512, K513, K514 } \
}

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

[0] = LAYOUT_via(
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,
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_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,
KC_LSFT, 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_END,
KC_LCTL, KC_LGUI, KC_LALT, KC_VOLU, KC_VOLD, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),

[1] = LAYOUT_via(
KC_SYSTEM_SLEEP, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, RGB_TOG,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SPI,
_______, _______, _______, _______, QK_BOOT, _______, _______, _______, _______, _______, KC_PSCR, _______, _______, _______, RGB_VAI,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAD,
_______, _______, _______, KC_CALC, _______, _______, _______, KC_MUTE, _______, _______, _______, _______, RGB_HUI, RGB_SPD,
_______, _______, _______, RGB_MOD, RGB_RMOD, _______, _______, _______, RGB_SAD, RGB_HUD, RGB_SAI),

[2] = LAYOUT_via(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),

[3] = LAYOUT_via(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______)

};
[0] = LAYOUT(
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,
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_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,
KC_LSFT, 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_END,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),

[1] = LAYOUT(
KC_SYSTEM_SLEEP, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, RGB_TOG,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SPI,
_______, _______, _______, _______, QK_BOOT, _______, _______, _______, _______, _______, KC_PSCR, _______, _______, _______, RGB_VAI,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAD,
_______, _______, _______, KC_CALC, _______, _______, _______, KC_MUTE, _______, _______, _______, _______, RGB_HUI, RGB_SPD,
_______, _______, _______, _______, _______, _______, RGB_SAD, RGB_HUD, RGB_SAI),

[2] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______),

[3] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______)

};

#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(RGB_RMOD, RGB_MOD) },
[2] = { ENCODER_CCW_CW(_______, _______) },
[3] = { ENCODER_CCW_CW(_______, _______) },
};
#endif
3 changes: 1 addition & 2 deletions keyboards/atlantis/ak81_ve/keymaps/via/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
VIA_ENABLE = yes

SRC += encoder_actions.c
ENCODER_MAP_ENABLE = yes
63 changes: 0 additions & 63 deletions keyboards/atlantis/encoder_actions.c

This file was deleted.

23 changes: 0 additions & 23 deletions keyboards/atlantis/encoder_actions.h

This file was deleted.

4 changes: 0 additions & 4 deletions keyboards/custommk/evo70/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,9 @@

{"matrix": [5, 6], "x": 0.5, "y": 1.1},

{"matrix": [4, 7], "x": 0, "y": 0},

{"matrix": [4, 8], "x": 12.5, "y": 5.1, "w": 1.25},
{"matrix": [4, 9], "x": 13.75, "y": 5.1, "w": 1.25},

{"matrix": [4, 10], "x": 1, "y": 0},

{"matrix": [4, 11], "x": 15.5, "y": 5.1},
{"matrix": [4, 12], "x": 16.5, "y": 5.1},
{"matrix": [4, 13], "x": 17.5, "y": 5.1}
Expand Down
6 changes: 3 additions & 3 deletions keyboards/custommk/evo70/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ 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_PGUP,
KC_F1, KC_F2, 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,
KC_F3, KC_F4, KC_LSFT, 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_END,
KC_F5, KC_F6, KC_LCTL, KC_LWIN, KC_LALT, KC_SPACE, KC_NO, KC_VOLD, KC_RALT, KC_RCTL, KC_VOLU, KC_LEFT, KC_DOWN, KC_RGHT
KC_F5, KC_F6, KC_LCTL, KC_LWIN, KC_LALT, KC_SPACE, KC_NO, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),

[1] = LAYOUT(
QK_BOOT, 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_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_BSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_F7, KC_F8, KC_TRNS, BL_TOGG, BL_STEP, BL_BRTG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_F9, KC_F10, KC_TRNS, RGB_TOG, RGB_MOD, RGB_RMOD, RGB_VAI, RGB_VAD, RGB_HUI, RGB_HUD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
)
};
58 changes: 7 additions & 51 deletions keyboards/custommk/evo70/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,65 +23,21 @@ 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_PGUP,
KC_F1, KC_F2, 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,
KC_F3, KC_F4, KC_LSFT, 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_END,
KC_F5, KC_F6, KC_LCTL, KC_LWIN, KC_LALT, KC_SPACE, KC_NO, KC_VOLD, KC_RALT, KC_RCTL, KC_VOLU, KC_LEFT, KC_DOWN, KC_RGHT
KC_F5, KC_F6, KC_LCTL, KC_LWIN, KC_LALT, KC_SPACE, KC_NO, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),

[1] = LAYOUT(
QK_BOOT, 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_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_BSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_F7, KC_F8, KC_TRNS, BL_TOGG, BL_STEP, BL_BRTG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_F9, KC_F10, KC_TRNS, RGB_TOG, RGB_MOD, RGB_RMOD, RGB_VAI, RGB_VAD, RGB_HUI, RGB_HUD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
};

static bool custom_encoder_mode = false;

void set_custom_encoder_mode_user(bool custom_mode) {
custom_encoder_mode = custom_mode;
}


keyevent_t encoder_ccw = {
.key = (keypos_t){.row = 4, .col = 7},
.pressed = false,
.type = KEY_EVENT
};

keyevent_t encoder_cw = {
.key = (keypos_t){.row = 4, .col = 10},
.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(_______, _______) },
};


bool encoder_update_user(uint8_t index, bool clockwise) {
if (custom_encoder_mode) {
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 false;
}
return true;
}

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
1 change: 1 addition & 0 deletions keyboards/custommk/evo70/keymaps/via/rules.mk
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes
33 changes: 0 additions & 33 deletions keyboards/custommk/genesis/rev2/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,39 +81,6 @@
{"matrix": [4, 2], "x": 0, "y": 4, "w": 2},
{"matrix": [4, 3], "x": 2, "y": 4}
]
},
"LAYOUT_via_6x4": {
"layout": [
{"matrix": [5, 0], "x": 0, "y": 0},
{"matrix": [5, 1], "x": 1, "y": 0},
{"matrix": [5, 2], "x": 3, "y": 0},
{"matrix": [5, 3], "x": 4, "y": 0},

{"matrix": [0, 0], "x": 0.5, "y": 1.1},
{"matrix": [0, 1], "x": 1.5, "y": 1.1},
{"matrix": [0, 2], "x": 2.5, "y": 1.1},
{"matrix": [0, 3], "x": 3.5, "y": 1.1},

{"matrix": [1, 0], "x": 0.5, "y": 2.1},
{"matrix": [1, 1], "x": 1.5, "y": 2.1},
{"matrix": [1, 2], "x": 2.5, "y": 2.1},
{"matrix": [1, 3], "x": 3.5, "y": 2.1},

{"matrix": [2, 0], "x": 0.5, "y": 3.1},
{"matrix": [2, 1], "x": 1.5, "y": 3.1},
{"matrix": [2, 2], "x": 2.5, "y": 3.1},
{"matrix": [2, 3], "x": 3.5, "y": 3.1},

{"matrix": [3, 0], "x": 0.5, "y": 4.1},
{"matrix": [3, 1], "x": 1.5, "y": 4.1},
{"matrix": [3, 2], "x": 2.5, "y": 4.1},
{"matrix": [3, 3], "x": 3.5, "y": 4.1},

{"matrix": [4, 0], "x": 0.5, "y": 5.1},
{"matrix": [4, 1], "x": 1.5, "y": 5.1},
{"matrix": [4, 2], "x": 2.5, "y": 5.1},
{"matrix": [4, 3], "x": 3.5, "y": 5.1}
]
}
}
}
Loading

0 comments on commit c4a67d3

Please sign in to comment.