diff options
| author | Xelus22 <17491233+Xelus22@users.noreply.github.com> | 2021-06-23 13:30:42 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-22 20:30:42 -0700 |
| commit | ced7e9a0ced2fc394eca1cc9e935caa0317b7172 (patch) | |
| tree | 9888c1c8a25f24c9de52ea2d2470bfa9f1fdad71 /keyboards/makrosu | |
| parent | 268d0efa7e3c600f5749670f51199c3f12022730 (diff) | |
| download | qmk_firmware-ced7e9a0ced2fc394eca1cc9e935caa0317b7172.tar.gz qmk_firmware-ced7e9a0ced2fc394eca1cc9e935caa0317b7172.zip | |
[Keyboard][Bug] Makrosu VIA compile fix encoder and formatting (#13306)
* fix encoder and formatting
* remove redundant breaks
* Update keyboards/makrosu/keymaps/default/keymap.c
Co-authored-by: Drashna Jaelre <drashna@live.com>
* Update keyboards/makrosu/keymaps/via/keymap.c
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'keyboards/makrosu')
| -rw-r--r-- | keyboards/makrosu/keymaps/default/keymap.c | 137 | ||||
| -rw-r--r-- | keyboards/makrosu/keymaps/via/keymap.c | 137 |
2 files changed, 126 insertions, 148 deletions
diff --git a/keyboards/makrosu/keymaps/default/keymap.c b/keyboards/makrosu/keymaps/default/keymap.c index b7f60a414..b0c47dbdd 100644 --- a/keyboards/makrosu/keymaps/default/keymap.c +++ b/keyboards/makrosu/keymaps/default/keymap.c | |||
| @@ -1,17 +1,17 @@ | |||
| 1 | /* Copyright 2021 Valdydesu_ | 1 | /* Copyright 2021 Valdydesu_ |
| 2 | * | 2 | * |
| 3 | * This program is free software: you can redistribute it and/or modify | 3 | * This program is free software: you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by | 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation, either version 2 of the License, or | 5 | * the Free Software Foundation, either version 2 of the License, or |
| 6 | * (at your option) any later version. | 6 | * (at your option) any later version. |
| 7 | * | 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, | 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. | 11 | * GNU General Public License for more details. |
| 12 | * | 12 | * |
| 13 | * You should have received a copy of the GNU General Public License | 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include QMK_KEYBOARD_H | 17 | #include QMK_KEYBOARD_H |
| @@ -29,7 +29,7 @@ enum planck_keycodes { | |||
| 29 | L1 = SAFE_RANGE, | 29 | L1 = SAFE_RANGE, |
| 30 | L2, | 30 | L2, |
| 31 | L3 | 31 | L3 |
| 32 | 32 | ||
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | #define LOWER MO(_4) | 35 | #define LOWER MO(_4) |
| @@ -39,20 +39,20 @@ enum planck_keycodes { | |||
| 39 | 39 | ||
| 40 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 40 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 41 | 41 | ||
| 42 | [_1] = LAYOUT( | 42 | [_1] = LAYOUT( |
| 43 | KC_ESC, KC_F1, KC_F2, | 43 | KC_ESC, KC_F1, KC_F2, |
| 44 | LOWER, KC_Z, KC_X), | 44 | LOWER, KC_Z, KC_X), |
| 45 | 45 | ||
| 46 | [_2] = LAYOUT( | 46 | [_2] = LAYOUT( |
| 47 | LALT(KC_TAB), LGUI(KC_TAB), LCTL(KC_S), | 47 | LALT(KC_TAB), LGUI(KC_TAB), LCTL(KC_S), |
| 48 | LOWER, LCTL(KC_C), LCTL(KC_V)), | 48 | LOWER, LCTL(KC_C), LCTL(KC_V)), |
| 49 | 49 | ||
| 50 | [_3] = LAYOUT( | 50 | [_3] = LAYOUT( |
| 51 | KC_TRNS, KC_TRNS, KC_TRNS, | 51 | KC_TRNS, KC_TRNS, KC_TRNS, |
| 52 | KC_TRNS, KC_TRNS, KC_TRNS), | 52 | KC_TRNS, KC_TRNS, KC_TRNS), |
| 53 | 53 | ||
| 54 | [_4] = LAYOUT( | 54 | [_4] = LAYOUT( |
| 55 | L1, L2, L3, | 55 | L1, L2, L3, |
| 56 | _______, _______, _______), | 56 | _______, _______, _______), |
| 57 | 57 | ||
| 58 | }; | 58 | }; |
| @@ -61,38 +61,30 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 61 | layer_state_t layer_state_set_user(layer_state_t state) { | 61 | layer_state_t layer_state_set_user(layer_state_t state) { |
| 62 | state = update_tri_layer_state(state, _4, X_PAUSE, X_PAUSE); | 62 | state = update_tri_layer_state(state, _4, X_PAUSE, X_PAUSE); |
| 63 | writePin(IND_1, layer_state_cmp(state, 1)); | 63 | writePin(IND_1, layer_state_cmp(state, 1)); |
| 64 | writePin(IND_2, layer_state_cmp(state, 2)); | 64 | writePin(IND_2, layer_state_cmp(state, 2)); |
| 65 | writePin(IND_3, layer_state_cmp(state, 3)); | 65 | writePin(IND_3, layer_state_cmp(state, 3)); |
| 66 | return state; | 66 | return state; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 69 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
| 70 | switch (keycode) { | 70 | switch (keycode) { |
| 71 | case L1: | 71 | case L1: |
| 72 | if (record->event.pressed) { | 72 | if (record->event.pressed) { |
| 73 | set_single_persistent_default_layer(_1); | 73 | set_single_persistent_default_layer(_1); |
| 74 | 74 | } | |
| 75 | 75 | return false; | |
| 76 | } | 76 | case L2: |
| 77 | return false; | 77 | if (record->event.pressed) { |
| 78 | break; | 78 | set_single_persistent_default_layer(_2); |
| 79 | case L2: | 79 | } |
| 80 | if (record->event.pressed) { | 80 | return false; |
| 81 | set_single_persistent_default_layer(_2); | 81 | case L3: |
| 82 | 82 | if (record->event.pressed) { | |
| 83 | } | 83 | set_single_persistent_default_layer(_3); |
| 84 | return false; | 84 | } |
| 85 | break; | 85 | return false; |
| 86 | case L3: | 86 | } |
| 87 | if (record->event.pressed) { | 87 | return true; |
| 88 | set_single_persistent_default_layer(_3); | ||
| 89 | |||
| 90 | } | ||
| 91 | return false; | ||
| 92 | break; | ||
| 93 | |||
| 94 | } | ||
| 95 | return true; | ||
| 96 | } | 88 | } |
| 97 | 89 | ||
| 98 | void matrix_init_user(void) { | 90 | void matrix_init_user(void) { |
| @@ -106,28 +98,25 @@ void matrix_init_user(void) { | |||
| 106 | writePinHigh(IND_3); | 98 | writePinHigh(IND_3); |
| 107 | } | 99 | } |
| 108 | 100 | ||
| 109 | void encoder_update_user(uint8_t index, bool clockwise) { | 101 | bool encoder_update_user(uint8_t index, bool clockwise) { |
| 110 | if (layer_state_is(_1)) { | 102 | if (layer_state_is(_1)) { |
| 111 | if (clockwise) { | 103 | if (clockwise) { |
| 112 | tap_code(KC_UP); | 104 | tap_code(KC_UP); |
| 113 | } else { | 105 | } else { |
| 114 | tap_code(KC_DOWN); | 106 | tap_code(KC_DOWN); |
| 115 | } | 107 | } |
| 116 | } | 108 | } else if (layer_state_is(_2)) { |
| 117 | 109 | if (clockwise) { | |
| 118 | else if (layer_state_is(_2)) { | 110 | tap_code(KC_RGHT); |
| 119 | if (clockwise) { | 111 | } else { |
| 120 | tap_code(KC_RGHT); | 112 | tap_code(KC_LEFT); |
| 121 | } else { | 113 | } |
| 122 | tap_code(KC_LEFT); | 114 | } else if (layer_state_is(_3)) { |
| 123 | } | 115 | if (clockwise) { |
| 124 | } | 116 | tap_code(KC_VOLU); |
| 125 | 117 | } else { | |
| 126 | else if (layer_state_is(_3)) { | 118 | tap_code(KC_VOLD); |
| 127 | if (clockwise) { | 119 | } |
| 128 | tap_code(KC_VOLU); | ||
| 129 | } else { | ||
| 130 | tap_code(KC_VOLD); | ||
| 131 | } | 120 | } |
| 132 | } | 121 | return true; |
| 133 | } | 122 | } |
diff --git a/keyboards/makrosu/keymaps/via/keymap.c b/keyboards/makrosu/keymaps/via/keymap.c index b7f60a414..b0c47dbdd 100644 --- a/keyboards/makrosu/keymaps/via/keymap.c +++ b/keyboards/makrosu/keymaps/via/keymap.c | |||
| @@ -1,17 +1,17 @@ | |||
| 1 | /* Copyright 2021 Valdydesu_ | 1 | /* Copyright 2021 Valdydesu_ |
| 2 | * | 2 | * |
| 3 | * This program is free software: you can redistribute it and/or modify | 3 | * This program is free software: you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by | 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation, either version 2 of the License, or | 5 | * the Free Software Foundation, either version 2 of the License, or |
| 6 | * (at your option) any later version. | 6 | * (at your option) any later version. |
| 7 | * | 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, | 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. | 11 | * GNU General Public License for more details. |
| 12 | * | 12 | * |
| 13 | * You should have received a copy of the GNU General Public License | 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include QMK_KEYBOARD_H | 17 | #include QMK_KEYBOARD_H |
| @@ -29,7 +29,7 @@ enum planck_keycodes { | |||
| 29 | L1 = SAFE_RANGE, | 29 | L1 = SAFE_RANGE, |
| 30 | L2, | 30 | L2, |
| 31 | L3 | 31 | L3 |
| 32 | 32 | ||
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | #define LOWER MO(_4) | 35 | #define LOWER MO(_4) |
| @@ -39,20 +39,20 @@ enum planck_keycodes { | |||
| 39 | 39 | ||
| 40 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 40 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 41 | 41 | ||
| 42 | [_1] = LAYOUT( | 42 | [_1] = LAYOUT( |
| 43 | KC_ESC, KC_F1, KC_F2, | 43 | KC_ESC, KC_F1, KC_F2, |
| 44 | LOWER, KC_Z, KC_X), | 44 | LOWER, KC_Z, KC_X), |
| 45 | 45 | ||
| 46 | [_2] = LAYOUT( | 46 | [_2] = LAYOUT( |
| 47 | LALT(KC_TAB), LGUI(KC_TAB), LCTL(KC_S), | 47 | LALT(KC_TAB), LGUI(KC_TAB), LCTL(KC_S), |
| 48 | LOWER, LCTL(KC_C), LCTL(KC_V)), | 48 | LOWER, LCTL(KC_C), LCTL(KC_V)), |
| 49 | 49 | ||
| 50 | [_3] = LAYOUT( | 50 | [_3] = LAYOUT( |
| 51 | KC_TRNS, KC_TRNS, KC_TRNS, | 51 | KC_TRNS, KC_TRNS, KC_TRNS, |
| 52 | KC_TRNS, KC_TRNS, KC_TRNS), | 52 | KC_TRNS, KC_TRNS, KC_TRNS), |
| 53 | 53 | ||
| 54 | [_4] = LAYOUT( | 54 | [_4] = LAYOUT( |
| 55 | L1, L2, L3, | 55 | L1, L2, L3, |
| 56 | _______, _______, _______), | 56 | _______, _______, _______), |
| 57 | 57 | ||
| 58 | }; | 58 | }; |
| @@ -61,38 +61,30 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 61 | layer_state_t layer_state_set_user(layer_state_t state) { | 61 | layer_state_t layer_state_set_user(layer_state_t state) { |
| 62 | state = update_tri_layer_state(state, _4, X_PAUSE, X_PAUSE); | 62 | state = update_tri_layer_state(state, _4, X_PAUSE, X_PAUSE); |
| 63 | writePin(IND_1, layer_state_cmp(state, 1)); | 63 | writePin(IND_1, layer_state_cmp(state, 1)); |
| 64 | writePin(IND_2, layer_state_cmp(state, 2)); | 64 | writePin(IND_2, layer_state_cmp(state, 2)); |
| 65 | writePin(IND_3, layer_state_cmp(state, 3)); | 65 | writePin(IND_3, layer_state_cmp(state, 3)); |
| 66 | return state; | 66 | return state; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 69 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
| 70 | switch (keycode) { | 70 | switch (keycode) { |
| 71 | case L1: | 71 | case L1: |
| 72 | if (record->event.pressed) { | 72 | if (record->event.pressed) { |
| 73 | set_single_persistent_default_layer(_1); | 73 | set_single_persistent_default_layer(_1); |
| 74 | 74 | } | |
| 75 | 75 | return false; | |
| 76 | } | 76 | case L2: |
| 77 | return false; | 77 | if (record->event.pressed) { |
| 78 | break; | 78 | set_single_persistent_default_layer(_2); |
| 79 | case L2: | 79 | } |
| 80 | if (record->event.pressed) { | 80 | return false; |
| 81 | set_single_persistent_default_layer(_2); | 81 | case L3: |
| 82 | 82 | if (record->event.pressed) { | |
| 83 | } | 83 | set_single_persistent_default_layer(_3); |
| 84 | return false; | 84 | } |
| 85 | break; | 85 | return false; |
| 86 | case L3: | 86 | } |
| 87 | if (record->event.pressed) { | 87 | return true; |
| 88 | set_single_persistent_default_layer(_3); | ||
| 89 | |||
| 90 | } | ||
| 91 | return false; | ||
| 92 | break; | ||
| 93 | |||
| 94 | } | ||
| 95 | return true; | ||
| 96 | } | 88 | } |
| 97 | 89 | ||
| 98 | void matrix_init_user(void) { | 90 | void matrix_init_user(void) { |
| @@ -106,28 +98,25 @@ void matrix_init_user(void) { | |||
| 106 | writePinHigh(IND_3); | 98 | writePinHigh(IND_3); |
| 107 | } | 99 | } |
| 108 | 100 | ||
| 109 | void encoder_update_user(uint8_t index, bool clockwise) { | 101 | bool encoder_update_user(uint8_t index, bool clockwise) { |
| 110 | if (layer_state_is(_1)) { | 102 | if (layer_state_is(_1)) { |
| 111 | if (clockwise) { | 103 | if (clockwise) { |
| 112 | tap_code(KC_UP); | 104 | tap_code(KC_UP); |
| 113 | } else { | 105 | } else { |
| 114 | tap_code(KC_DOWN); | 106 | tap_code(KC_DOWN); |
| 115 | } | 107 | } |
| 116 | } | 108 | } else if (layer_state_is(_2)) { |
| 117 | 109 | if (clockwise) { | |
| 118 | else if (layer_state_is(_2)) { | 110 | tap_code(KC_RGHT); |
| 119 | if (clockwise) { | 111 | } else { |
| 120 | tap_code(KC_RGHT); | 112 | tap_code(KC_LEFT); |
| 121 | } else { | 113 | } |
| 122 | tap_code(KC_LEFT); | 114 | } else if (layer_state_is(_3)) { |
| 123 | } | 115 | if (clockwise) { |
| 124 | } | 116 | tap_code(KC_VOLU); |
| 125 | 117 | } else { | |
| 126 | else if (layer_state_is(_3)) { | 118 | tap_code(KC_VOLD); |
| 127 | if (clockwise) { | 119 | } |
| 128 | tap_code(KC_VOLU); | ||
| 129 | } else { | ||
| 130 | tap_code(KC_VOLD); | ||
| 131 | } | 120 | } |
| 132 | } | 121 | return true; |
| 133 | } | 122 | } |
