diff options
Diffstat (limited to 'keyboards/divergetm2/keymaps/default/keymap.c')
-rw-r--r-- | keyboards/divergetm2/keymaps/default/keymap.c | 199 |
1 files changed, 199 insertions, 0 deletions
diff --git a/keyboards/divergetm2/keymaps/default/keymap.c b/keyboards/divergetm2/keymaps/default/keymap.c new file mode 100644 index 000000000..fb5957cca --- /dev/null +++ b/keyboards/divergetm2/keymaps/default/keymap.c | |||
@@ -0,0 +1,199 @@ | |||
1 | /* Copyright 2018 Christon DeWan (xton) | ||
2 | * Copyright 2017 IslandMan93 | ||
3 | * | ||
4 | * This program is free software: you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation, either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #include QMK_KEYBOARD_H | ||
19 | |||
20 | |||
21 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
22 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
23 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
24 | // entirely and just use numbers. | ||
25 | #define _QWERTY 0 | ||
26 | #define _COLEMAK 1 | ||
27 | #define _DVORAK 2 | ||
28 | #define _LOWER 3 | ||
29 | #define _RAISE 4 | ||
30 | #define _ADJUST 16 | ||
31 | |||
32 | enum custom_keycodes { | ||
33 | QWERTY = SAFE_RANGE, | ||
34 | COLEMAK, | ||
35 | DVORAK | ||
36 | }; | ||
37 | |||
38 | |||
39 | |||
40 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
41 | |||
42 | /* Qwerty | ||
43 | * ,-----------------------------------------------------------------------------------. | ||
44 | * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | | ||
45 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
46 | * | Esc | A | S | D | F | G | H | J | K | L | ; | " | | ||
47 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
48 | * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | | ||
49 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
50 | * | | Ctrl | Alt | GUI | Lower | Raise | Left | Down | Up |Right | | ||
51 | * `-----------------------------------------------------------------------------------' | ||
52 | */ | ||
53 | [_QWERTY] = LAYOUT_ortho_4x12_2x2u( | ||
54 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, | ||
55 | KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, | ||
56 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , | ||
57 | RESET, KC_LCTL, KC_LALT, KC_LGUI, LT(_LOWER, KC_SPC), LT(_RAISE,KC_SPC), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT | ||
58 | ), | ||
59 | |||
60 | /* Colemak | ||
61 | * ,-----------------------------------------------------------------------------------. | ||
62 | * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | | ||
63 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
64 | * | Esc | A | R | S | T | D | H | N | E | I | O | " | | ||
65 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
66 | * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | | ||
67 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
68 | * | | Ctrl | Alt | GUI | Lower | Raise | Left | Down | Up |Right | | ||
69 | * `-----------------------------------------------------------------------------------' | ||
70 | */ | ||
71 | [_COLEMAK] = LAYOUT_ortho_4x12_2x2u( | ||
72 | KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, | ||
73 | KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, | ||
74 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , | ||
75 | KC_NO, KC_LCTL, KC_LALT, KC_LGUI, LT(_LOWER, KC_SPC), LT(_RAISE,KC_SPC), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT | ||
76 | ), | ||
77 | |||
78 | /* Dvorak | ||
79 | * ,-----------------------------------------------------------------------------------. | ||
80 | * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | | ||
81 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
82 | * | Esc | A | O | E | U | I | D | H | T | N | S | / | | ||
83 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
84 | * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | | ||
85 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
86 | * | | Ctrl | Alt | GUI | Lower | Raise | Left | Down | Up |Right | | ||
87 | * `-----------------------------------------------------------------------------------' | ||
88 | */ | ||
89 | [_DVORAK] = LAYOUT_ortho_4x12_2x2u( | ||
90 | KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, | ||
91 | KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, | ||
92 | KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , | ||
93 | KC_NO, KC_LCTL, KC_LALT, KC_LGUI, LT(_LOWER, KC_SPC), LT(_RAISE,KC_SPC), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT | ||
94 | ), | ||
95 | |||
96 | /* Lower | ||
97 | * ,-----------------------------------------------------------------------------------. | ||
98 | * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | | ||
99 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
100 | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | | ||
101 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
102 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | | ||
103 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
104 | * | | | | | | | Next | Vol- | Vol+ | Play | | ||
105 | * `-----------------------------------------------------------------------------------' | ||
106 | */ | ||
107 | [_LOWER] = LAYOUT_ortho_4x12_2x2u( | ||
108 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, | ||
109 | KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, | ||
110 | BL_STEP, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, | ||
111 | _______, _______, _______, _______, _______, MO(_RAISE), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY | ||
112 | ), | ||
113 | |||
114 | /* Raise | ||
115 | * ,-----------------------------------------------------------------------------------. | ||
116 | * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | | ||
117 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
118 | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | | ||
119 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
120 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | | ||
121 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
122 | * | | | | | | | Next | Vol- | Vol+ | Play | | ||
123 | * `-----------------------------------------------------------------------------------' | ||
124 | */ | ||
125 | [_RAISE] = LAYOUT_ortho_4x12_2x2u( | ||
126 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, | ||
127 | KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, | ||
128 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, | ||
129 | _______, _______, _______, _______, MO(_LOWER), _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY | ||
130 | ), | ||
131 | |||
132 | /* Adjust (Lower + Raise) | ||
133 | * ,-----------------------------------------------------------------------------------. | ||
134 | * | | Reset| | | | | | | | | | Del | | ||
135 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
136 | * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | | ||
137 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
138 | * | | | | | | | | | | | | | | ||
139 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
140 | * | | | | | | | | | | | | ||
141 | * `-----------------------------------------------------------------------------------' | ||
142 | */ | ||
143 | [_ADJUST] = LAYOUT_ortho_4x12_2x2u( | ||
144 | _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, | ||
145 | _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, | ||
146 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
147 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
148 | ) | ||
149 | |||
150 | |||
151 | }; | ||
152 | |||
153 | #ifdef AUDIO_ENABLE | ||
154 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
155 | float tone_dvorak[][2] = SONG(DVORAK_SOUND); | ||
156 | float tone_colemak[][2] = SONG(COLEMAK_SOUND); | ||
157 | #endif | ||
158 | |||
159 | #define SPACE_WAIT 100 | ||
160 | uint16_t rl_start_time = 0; | ||
161 | |||
162 | |||
163 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
164 | if(rl_start_time && record->event.pressed) rl_start_time = 0; | ||
165 | switch (keycode) { | ||
166 | case QWERTY: | ||
167 | if (record->event.pressed) { | ||
168 | #ifdef AUDIO_ENABLE | ||
169 | PLAY_SONG(tone_qwerty); | ||
170 | #endif | ||
171 | set_single_persistent_default_layer(1UL<<_QWERTY); | ||
172 | } | ||
173 | return false; | ||
174 | break; | ||
175 | case COLEMAK: | ||
176 | if (record->event.pressed) { | ||
177 | #ifdef AUDIO_ENABLE | ||
178 | PLAY_SONG(tone_colemak); | ||
179 | #endif | ||
180 | set_single_persistent_default_layer(1UL<<_COLEMAK); | ||
181 | } | ||
182 | return false; | ||
183 | break; | ||
184 | case DVORAK: | ||
185 | if (record->event.pressed) { | ||
186 | #ifdef AUDIO_ENABLE | ||
187 | PLAY_SONG(tone_dvorak); | ||
188 | #endif | ||
189 | set_single_persistent_default_layer(1UL<<_DVORAK); | ||
190 | } | ||
191 | return false; | ||
192 | break; | ||
193 | } | ||
194 | return true; | ||
195 | } | ||
196 | |||
197 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
198 | return update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); | ||
199 | } | ||