aboutsummaryrefslogtreecommitdiff
path: root/keyboards/makrosu/keymaps/default/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/makrosu/keymaps/default/keymap.c')
-rw-r--r--keyboards/makrosu/keymaps/default/keymap.c133
1 files changed, 133 insertions, 0 deletions
diff --git a/keyboards/makrosu/keymaps/default/keymap.c b/keyboards/makrosu/keymaps/default/keymap.c
new file mode 100644
index 000000000..b7f60a414
--- /dev/null
+++ b/keyboards/makrosu/keymaps/default/keymap.c
@@ -0,0 +1,133 @@
1/* Copyright 2021 Valdydesu_
2 *
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
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
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/>.
15 */
16
17#include QMK_KEYBOARD_H
18
19enum planck_layers {
20 _1,
21 _2,
22 _3,
23 _4
24
25};
26
27
28enum planck_keycodes {
29 L1 = SAFE_RANGE,
30 L2,
31 L3
32
33};
34
35#define LOWER MO(_4)
36#define IND_1 D4
37#define IND_2 C6
38#define IND_3 D7
39
40const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
41
42 [_1] = LAYOUT(
43 KC_ESC, KC_F1, KC_F2,
44 LOWER, KC_Z, KC_X),
45
46 [_2] = LAYOUT(
47 LALT(KC_TAB), LGUI(KC_TAB), LCTL(KC_S),
48 LOWER, LCTL(KC_C), LCTL(KC_V)),
49
50 [_3] = LAYOUT(
51 KC_TRNS, KC_TRNS, KC_TRNS,
52 KC_TRNS, KC_TRNS, KC_TRNS),
53
54 [_4] = LAYOUT(
55 L1, L2, L3,
56 _______, _______, _______),
57
58};
59
60
61layer_state_t layer_state_set_user(layer_state_t state) {
62 state = update_tri_layer_state(state, _4, X_PAUSE, X_PAUSE);
63 writePin(IND_1, layer_state_cmp(state, 1));
64 writePin(IND_2, layer_state_cmp(state, 2));
65 writePin(IND_3, layer_state_cmp(state, 3));
66 return state;
67}
68
69bool process_record_user(uint16_t keycode, keyrecord_t *record) {
70 switch (keycode) {
71 case L1:
72 if (record->event.pressed) {
73 set_single_persistent_default_layer(_1);
74
75
76 }
77 return false;
78 break;
79 case L2:
80 if (record->event.pressed) {
81 set_single_persistent_default_layer(_2);
82
83 }
84 return false;
85 break;
86 case L3:
87 if (record->event.pressed) {
88 set_single_persistent_default_layer(_3);
89
90 }
91 return false;
92 break;
93
94 }
95 return true;
96}
97
98void matrix_init_user(void) {
99 //init the Pro Micro on-board LEDs
100 setPinOutput(IND_1);
101 setPinOutput(IND_2);
102 setPinOutput(IND_3);
103 //set to off
104 writePinHigh(IND_1);
105 writePinHigh(IND_2);
106 writePinHigh(IND_3);
107}
108
109void encoder_update_user(uint8_t index, bool clockwise) {
110 if (layer_state_is(_1)) {
111 if (clockwise) {
112 tap_code(KC_UP);
113 } else {
114 tap_code(KC_DOWN);
115 }
116 }
117
118 else if (layer_state_is(_2)) {
119 if (clockwise) {
120 tap_code(KC_RGHT);
121 } else {
122 tap_code(KC_LEFT);
123 }
124 }
125
126 else if (layer_state_is(_3)) {
127 if (clockwise) {
128 tap_code(KC_VOLU);
129 } else {
130 tap_code(KC_VOLD);
131 }
132 }
133}