diff options
Diffstat (limited to 'keyboards/dumbo/keymaps/default/keymap.c')
-rw-r--r-- | keyboards/dumbo/keymaps/default/keymap.c | 232 |
1 files changed, 232 insertions, 0 deletions
diff --git a/keyboards/dumbo/keymaps/default/keymap.c b/keyboards/dumbo/keymaps/default/keymap.c new file mode 100644 index 000000000..7fc3ffc2c --- /dev/null +++ b/keyboards/dumbo/keymaps/default/keymap.c | |||
@@ -0,0 +1,232 @@ | |||
1 | /* Copyright 2020 Adam Naldal <[email protected]> | ||
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 | #include QMK_KEYBOARD_H | ||
17 | |||
18 | enum layers { | ||
19 | _QWERTY = 0, | ||
20 | _NN, | ||
21 | _MS, | ||
22 | _SP | ||
23 | }; | ||
24 | |||
25 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
26 | /* | ||
27 | * Base Layer: QWERTY | ||
28 | * | ||
29 | * ,-------------------------------------------. ,-------------------------------------------. | ||
30 | * | TAB | Q | W | E | R | T | | Y | U | I | O | P | ESC | | ||
31 | * |--------+------+------+------+------+------| |------+------+------+------+------+--------| | ||
32 | * | CTRL | A | S | D | F | G | | H | J | K | L | ; : | ' " | | ||
33 | * |--------+------+------+------+------+------| |------+------+------+------+------+--------| | ||
34 | * | LShift | Z | X | C | V | B | | N | M | , < | . > | / ? | SHIFT | | ||
35 | * `------------------------⫟------⫟------⫟------⫟------. ,-----⫟------⫟------⫟------⫟-------------------------' | ||
36 | * | GUI | Caps | Space| Nav +| |Media+| Bksp | Enter| AltGr| | ||
37 | * | | | |Number| |symbol| | | | | ||
38 | * `---------------------------' `---------------------------' | ||
39 | */ | ||
40 | [_QWERTY] = LAYOUT_split_3x6_4( | ||
41 | //,-----------------------------------------------------. ,-----------------------------------------------------. | ||
42 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_ESC, | ||
43 | //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| | ||
44 | KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, | ||
45 | //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| | ||
46 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, | ||
47 | //|--------+--------+-----------⫟--------⫟--------⫟--------⫟--------. .--------⫟--------⫟--------⫟--------⫟-----------+--------+--------| | ||
48 | KC_LGUI, KC_CAPS, KC_SPC, MO(_NN), MO(_MS), KC_BSPC, KC_ENT, KC_RALT | ||
49 | //`------------------------------------' '------------------------------------' | ||
50 | ), | ||
51 | /* | ||
52 | * Navigation and Numbers: _NN | ||
53 | * | ||
54 | * ,-------------------------------------------. ,-------------------------------------------. | ||
55 | * | TAB | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | ESC | | ||
56 | * |--------+------+------+------+------+------| |------+------+------+------+------+--------| | ||
57 | * | CTRL | F1 | F2 | F3 | F4 | F5 | | left | down | up | right| | | | ||
58 | * |--------+------+------+------+------+------| |------+------+------+------+------+--------| | ||
59 | * | LShift | F6 | F7 | F8 | F9 | F10 | | home | pgdn | pgup | end | | SHIFT | | ||
60 | * `------------------------⫟------⫟------⫟------⫟------. ,-----⫟------⫟------⫟------⫟-------------------------' | ||
61 | * | GUI | Del | Space| Nav +| |Media+|Back- | Enter| AltGr| | ||
62 | * | | | |Number| |symbol|space | | | | ||
63 | * `---------------------------' `---------------------------' | ||
64 | */ | ||
65 | [_NN] = LAYOUT_split_3x6_4( | ||
66 | //,-----------------------------------------------------. ,-----------------------------------------------------. | ||
67 | KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_ESC, | ||
68 | //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| | ||
69 | KC_LCTL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_LEFT, KC_DOWN, KC_UP,KC_RIGHT, XXXXXXX, XXXXXXX, | ||
70 | //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| | ||
71 | KC_LSFT, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_HOME, KC_PGDN, KC_PGUP, KC_END, XXXXXXX, KC_RSFT, | ||
72 | //|--------+--------+-----------⫟--------⫟--------⫟--------⫟--------. .--------⫟--------⫟--------⫟--------⫟-----------+--------+--------| | ||
73 | KC_LGUI, KC_DEL, KC_SPC, _______, _______, KC_BSPC, KC_ENT, KC_RALT | ||
74 | //`------------------------------------' '------------------------------------' | ||
75 | ), | ||
76 | /* | ||
77 | * Media and Symbols: _MS | ||
78 | * | ||
79 | * ,-------------------------------------------. ,-------------------------------------------. | ||
80 | * | TAB | ! | @ | # | $ | % | | ^ | & | * | ( | ) | ESC | | ||
81 | * |--------+------+------+------+------+------| |------+------+------+------+------+--------| | ||
82 | * | CTRL | | prev | play | next | vol+ | | - | = | { | } | | | ´ | | ||
83 | * |--------+------+------+------+------+------| |------+------+------+------+------+--------| | ||
84 | * | LShift | |brght-|brght+| mute | vol- | | _ | + | [ | ] | \ | ~ | | ||
85 | * `------------------------⫟------⫟------⫟------⫟------. ,-----⫟------⫟------⫟------⫟-------------------------' | ||
86 | * | GUI | Del | Space| Nav +| |Media+| Bksp | Enter| AltGr| | ||
87 | * | | | |Number| |symbol| | | | | ||
88 | * `---------------------------' `---------------------------' | ||
89 | */ | ||
90 | [_MS] = LAYOUT_split_3x6_4( | ||
91 | //,-----------------------------------------------------. ,-----------------------------------------------------. | ||
92 | KC_TAB, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_ESC, | ||
93 | //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| | ||
94 | KC_LCTL, XXXXXXX, KC_MRWD, KC_MPLY, KC_MFFD, KC_VOLU, KC_MINS, KC_EQL, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV, | ||
95 | //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| | ||
96 | KC_LSFT, XXXXXXX, KC_BRID, KC_BRIU, KC_MUTE, KC_VOLD, KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_BSLS, KC_TILD, | ||
97 | //|--------+--------+-----------⫟--------⫟--------⫟--------⫟--------. .--------⫟--------⫟--------⫟--------⫟-----------+--------+--------| | ||
98 | KC_LGUI, KC_DEL, KC_SPC, _______, _______, KC_BSPC, KC_ENT, KC_RALT | ||
99 | //`------------------------------------' '------------------------------------' | ||
100 | ), | ||
101 | /* | ||
102 | * Special functions: _SP | ||
103 | * | ||
104 | * ,-------------------------------------------. ,-------------------------------------------. | ||
105 | * | TAB | | | | RESET| | | | | | | | ESC | | ||
106 | * |--------+------+------+------+------+------| |------+------+------+------+------+--------| | ||
107 | * | CTRL | | | DEBUG| | | | | | | | | | | ||
108 | * |--------+------+------+------+------+------| |------+------+------+------+------+--------| | ||
109 | * | LShift | | | | | | | | | | | | SHIFT | | ||
110 | * `------------------------⫟------⫟------⫟------⫟------. ,-----⫟------⫟------⫟------⫟-------------------------' | ||
111 | * | GUI | Del | Space| Nav +| |Media+| Bksp | Enter| AltGr| | ||
112 | * | | | |Number| |symbol| | | | | ||
113 | * `---------------------------' `---------------------------' | ||
114 | */ | ||
115 | [_SP] = LAYOUT_split_3x6_4( | ||
116 | //,-----------------------------------------------------. ,-----------------------------------------------------. | ||
117 | KC_TAB, XXXXXXX, XXXXXXX, XXXXXXX, RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, | ||
118 | //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| | ||
119 | KC_LCTL, XXXXXXX, XXXXXXX, DEBUG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, | ||
120 | //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| | ||
121 | KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_RSFT, | ||
122 | //|--------+--------+-----------⫟--------⫟--------⫟--------⫟--------. .--------⫟--------⫟--------⫟--------⫟-----------+--------+--------| | ||
123 | KC_LGUI, KC_DEL, KC_SPC, _______, _______, KC_BSPC, KC_ENT, KC_RALT | ||
124 | //`------------------------------------' '------------------------------------' | ||
125 | ), | ||
126 | |||
127 | }; | ||
128 | |||
129 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
130 | return update_tri_layer_state(state, _NN, _MS, _SP); | ||
131 | } | ||
132 | |||
133 | #ifdef OLED_ENABLE | ||
134 | |||
135 | static void render_logo(void) { | ||
136 | static const char PROGMEM qmk_logo[] = { | ||
137 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, | ||
138 | 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, | ||
139 | 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00 | ||
140 | }; | ||
141 | |||
142 | oled_write_P(qmk_logo, false); | ||
143 | } | ||
144 | |||
145 | static void print_status_narrow(void) { | ||
146 | // Print current mode | ||
147 | oled_write_P(PSTR("\n"), false); | ||
148 | oled_write_ln_P(PSTR("MODE"), false); | ||
149 | oled_write_ln_P(PSTR(""), false); | ||
150 | |||
151 | oled_write_P(PSTR("\n\n"), false); | ||
152 | // Print current layer | ||
153 | oled_write_ln_P(PSTR("LAYER"), false); | ||
154 | switch (get_highest_layer(layer_state)) { | ||
155 | case _QWERTY: | ||
156 | oled_write_P(PSTR("Base\n"), false); | ||
157 | break; | ||
158 | case _NN: | ||
159 | oled_write_P(PSTR("Nums\n"), false); | ||
160 | break; | ||
161 | case _MS: | ||
162 | oled_write_P(PSTR("Sym\n"), false); | ||
163 | break; | ||
164 | case _SP: | ||
165 | oled_write_P(PSTR("Spec\n"), false); | ||
166 | break; | ||
167 | default: | ||
168 | oled_write_ln_P(PSTR("Undef\n"), false); | ||
169 | } | ||
170 | oled_write_P(PSTR("\n\n"), false); | ||
171 | led_t led_usb_state = host_keyboard_led_state(); | ||
172 | oled_write_ln_P(PSTR("CPSLK"), led_usb_state.caps_lock); | ||
173 | } | ||
174 | |||
175 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
176 | if (is_keyboard_master()) { | ||
177 | return OLED_ROTATION_270; | ||
178 | } | ||
179 | return rotation; | ||
180 | } | ||
181 | |||
182 | bool oled_task_user(void) { | ||
183 | if (is_keyboard_master()) { | ||
184 | print_status_narrow(); | ||
185 | } else { | ||
186 | render_logo(); | ||
187 | } | ||
188 | return false; | ||
189 | } | ||
190 | #endif | ||
191 | |||
192 | #ifdef ENCODER_ENABLE | ||
193 | bool encoder_update_user(uint8_t index, bool clockwise) { | ||
194 | if (index == 0) { | ||
195 | // master side thumb encoder | ||
196 | // Volume control | ||
197 | if (clockwise) { | ||
198 | tap_code(KC_VOLU); | ||
199 | } else { | ||
200 | tap_code(KC_VOLD); | ||
201 | } | ||
202 | } | ||
203 | else if (index == 1) { | ||
204 | // master side pinky encoder | ||
205 | // Page down / Page up | ||
206 | if (clockwise) { | ||
207 | tap_code(KC_PGDN); | ||
208 | } else { | ||
209 | tap_code(KC_PGUP); | ||
210 | } | ||
211 | } | ||
212 | else if (index == 2) { | ||
213 | // minion side thumb encoder | ||
214 | // Next track / Previous track | ||
215 | if (clockwise) { | ||
216 | tap_code(KC_MFFD); | ||
217 | } else { | ||
218 | tap_code(KC_MRWD); | ||
219 | } | ||
220 | } | ||
221 | else if (index == 3) { | ||
222 | // minion side pinky encoder | ||
223 | // Page end / Page home | ||
224 | if (clockwise) { | ||
225 | tap_code(KC_END); | ||
226 | } else { | ||
227 | tap_code(KC_HOME); | ||
228 | } | ||
229 | } | ||
230 | return true; | ||
231 | } | ||
232 | #endif | ||