aboutsummaryrefslogtreecommitdiff
path: root/keyboards/helix/rev2/keymaps/default/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/helix/rev2/keymaps/default/keymap.c')
-rw-r--r--keyboards/helix/rev2/keymaps/default/keymap.c616
1 files changed, 616 insertions, 0 deletions
diff --git a/keyboards/helix/rev2/keymaps/default/keymap.c b/keyboards/helix/rev2/keymaps/default/keymap.c
new file mode 100644
index 000000000..b8a9baee3
--- /dev/null
+++ b/keyboards/helix/rev2/keymaps/default/keymap.c
@@ -0,0 +1,616 @@
1#include "helix.h"
2#include "bootloader.h"
3#include "action_layer.h"
4#include "eeconfig.h"
5#ifdef PROTOCOL_LUFA
6#include "lufa.h"
7#include "split_util.h"
8#endif
9#include "LUFA/Drivers/Peripheral/TWI.h"
10#ifdef AUDIO_ENABLE
11 #include "audio.h"
12#endif
13#ifdef SSD1306OLED
14 #include "ssd1306.h"
15#endif
16
17extern keymap_config_t keymap_config;
18
19#ifdef RGBLIGHT_ENABLE
20//Following line allows macro to read current RGB settings
21extern rgblight_config_t rgblight_config;
22#endif
23
24extern uint8_t is_master;
25
26// Each layer gets a name for readability, which is then used in the keymap matrix below.
27// The underscores don't mean anything - you can have a layer called STUFF or any other name.
28// Layer names don't all need to be of the same length, obviously, and you can also skip them
29// entirely and just use numbers.
30#define _QWERTY 0
31#define _COLEMAK 1
32#define _DVORAK 2
33#define _LOWER 3
34#define _RAISE 4
35#define _ADJUST 16
36
37enum custom_keycodes {
38 QWERTY = SAFE_RANGE,
39 COLEMAK,
40 DVORAK,
41 LOWER,
42 RAISE,
43 ADJUST,
44 BACKLIT,
45 EISU,
46 KANA,
47 RGBRST
48};
49
50enum macro_keycodes {
51 KC_SAMPLEMACRO,
52};
53
54
55// Fillers to make layering more clear
56#define _______ KC_TRNS
57#define XXXXXXX KC_NO
58//Macros
59#define M_SAMPLE M(KC_SAMPLEMACRO)
60
61#if HELIX_ROWS == 5
62const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
63
64 /* Qwerty
65 * ,-----------------------------------------. ,-----------------------------------------.
66 * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del |
67 * |------+------+------+------+------+------| |------+------+------+------+------+------|
68 * | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp |
69 * |------+------+------+------+------+------| |------+------+------+------+------+------|
70 * | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' |
71 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
72 * | Shift| Z | X | C | V | B | [ | ] | N | M | , | . | / |Enter |
73 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
74 * |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right |
75 * `-------------------------------------------------------------------------------------------------'
76 */
77 [_QWERTY] = KEYMAP( \
78 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
79 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
80 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
81 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LBRC, KC_RBRC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
82 ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
83 ),
84
85 /* Colemak
86 * ,-----------------------------------------. ,-----------------------------------------.
87 * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del |
88 * |------+------+------+------+------+------| |------+------+------+------+------+------|
89 * | Tab | Q | W | F | P | G | | J | L | U | Y | ; | Bksp |
90 * |------+------+------+------+------+------| |------+------+------+------+------+------|
91 * | Ctrl | A | R | S | T | D | | H | N | E | I | O | ' |
92 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
93 * | Shift| Z | X | C | V | B | [ | ] | K | M | , | . | / |Enter |
94 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
95 * |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right |
96 * `-------------------------------------------------------------------------------------------------'
97 */
98 [_COLEMAK] = KEYMAP( \
99 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
100 KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
101 KC_LCTL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
102 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LBRC, KC_RBRC, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
103 ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
104 ),
105
106 /* Dvorak
107 * ,-----------------------------------------. ,-----------------------------------------.
108 * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp |
109 * |------+------+------+------+------+------| |------+------+------+------+------+------|
110 * | Tab | ' | , | . | P | Y | | F | G | C | R | L | Del |
111 * |------+------+------+------+------+------| |------+------+------+------+------+------|
112 * | Ctrl | A | O | E | U | I | | D | H | T | N | S | / |
113 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
114 * | Shift| ; | Q | J | K | X | [ | ] | B | M | W | V | Z |Enter |
115 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
116 * |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right |
117 * `-------------------------------------------------------------------------------------------------'
118 */
119 [_DVORAK] = KEYMAP( \
120 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
121 KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL, \
122 KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
123 KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_LBRC, KC_RBRC, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
124 ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
125 ),
126
127 /* Lower
128 * ,-----------------------------------------. ,-----------------------------------------.
129 * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | |
130 * |------+------+------+------+------+------| |------+------+------+------+------+------|
131 * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | |
132 * |------+------+------+------+------+------| |------+------+------+------+------+------|
133 * | | F1 | F2 | F3 | F4 | F5 | | F6 | _ | + | { | } | | |
134 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
135 * | | F7 | F8 | F9 | F10 | F11 | ( | ) | F12 | | | Home | End | |
136 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
137 * | | | | | | | | | | | Next | Vol- | Vol+ | Play |
138 * `-------------------------------------------------------------------------------------------------'
139 */
140 [_LOWER] = KEYMAP( \
141 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \
142 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \
143 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
144 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_LPRN, KC_RPRN, KC_F12, _______, _______, KC_HOME, KC_END, _______, \
145 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
146 ),
147
148 /* Raise
149 * ,-----------------------------------------. ,-----------------------------------------.
150 * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp |
151 * |------+------+------+------+------+------| |------+------+------+------+------+------|
152 * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del |
153 * |------+------+------+------+------+------| |------+------+------+------+------+------|
154 * | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ |
155 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
156 * | | F7 | F8 | F9 | F10 | F11 | | | F12 | | |PageDn|PageUp| |
157 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
158 * | | | | | | | | | | | Next | Vol- | Vol+ | Play |
159 * `-------------------------------------------------------------------------------------------------'
160 */
161 [_RAISE] = KEYMAP( \
162 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
163 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
164 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
165 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, KC_F12, _______, _______, KC_PGDN, KC_PGUP, _______, \
166 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
167 ),
168
169 /* Adjust (Lower + Raise)
170 * ,-----------------------------------------. ,-----------------------------------------.
171 * | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 |
172 * |------+------+------+------+------+------| |------+------+------+------+------+------|
173 * | | Reset|RGBRST| | | | | | | | | | Del |
174 * |------+------+------+------+------+------| |------+------+------+------+------+------|
175 * | | | |Aud on|Audoff| Mac | | Win |Qwerty|Colemk|Dvorak| | |
176 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
177 * | | | | | | | | | | |RGB ON| HUE+ | SAT+ | VAL+ |
178 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
179 * | | | | | | | | | | | MODE | HUE- | SAT- | VAL- |
180 * `-------------------------------------------------------------------------------------------------'
181 */
182 [_ADJUST] = KEYMAP( \
183 KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
184 _______, RESET, RGBRST, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \
185 _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
186 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, \
187 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD \
188 )
189};
190
191#elif HELIX_ROWS == 4
192
193const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
194
195 /* Qwerty
196 * ,-----------------------------------------. ,-----------------------------------------.
197 * | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp |
198 * |------+------+------+------+------+------| |------+------+------+------+------+------|
199 * | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' |
200 * |------+------+------+------+------+------| |------+------+------+------+------+------|
201 * | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter |
202 * |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
203 * |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right |
204 * `-------------------------------------------------------------------------------------------------'
205 */
206 [_QWERTY] = KEYMAP( \
207 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
208 KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
209 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
210 ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
211 ),
212
213 /* Colemak
214 * ,-----------------------------------------. ,-----------------------------------------.
215 * | Tab | Q | W | F | P | G | | J | L | U | Y | ; | Bksp |
216 * |------+------+------+------+------+------| |------+------+------+------+------+------|
217 * | Ctrl | A | R | S | T | D | | H | N | E | I | O | ' |
218 * |------+------+------+------+------+------| |------+------+------+------+------+------|
219 * | Shift| Z | X | C | V | B | | K | M | , | . | / |Enter |
220 * |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
221 * |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right |
222 * `-------------------------------------------------------------------------------------------------'
223 */
224 [_COLEMAK] = KEYMAP( \
225 KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
226 KC_LCTL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
227 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
228 ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
229 ),
230
231 /* Dvorak
232 * ,-----------------------------------------. ,-----------------------------------------.
233 * | Tab | ' | , | . | P | Y | | F | G | C | R | L | Del |
234 * |------+------+------+------+------+------| |------+------+------+------+------+------|
235 * | Ctrl | A | O | E | U | I | | D | H | T | N | S | / |
236 * |------+------+------+------+------+------| |------+------+------+------+------+------|
237 * | Shift| ; | Q | J | K | X | | B | M | W | V | Z |Enter |
238 * |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
239 * |Adjust| Esc | Alt | GUI | EISU |Lower |Space |Space |Raise | KANA | Left | Down | Up |Right |
240 * `-------------------------------------------------------------------------------------------------'
241 */
242 [_DVORAK] = KEYMAP( \
243 KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL, \
244 KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
245 KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
246 ADJUST, KC_ESC, KC_LALT, KC_LGUI, EISU, LOWER, KC_SPC, KC_SPC, RAISE, KANA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
247 ),
248
249 /* Lower
250 * ,-----------------------------------------. ,-----------------------------------------.
251 * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | |
252 * |------+------+------+------+------+------| |------+------+------+------+------+------|
253 * | | F1 | F2 | F3 | F4 | F5 | | F6 | _ | + | { | } | | |
254 * |------+------+------+------+------+------| |------+------+------+------+------+------|
255 * | | F7 | F8 | F9 | F10 | F11 | | F12 | | | Home | End | |
256 * |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
257 * | | | | | | | | | | | Next | Vol- | Vol+ | Play |
258 * `-------------------------------------------------------------------------------------------------'
259 */
260 [_LOWER] = KEYMAP( \
261 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \
262 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
263 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_HOME, KC_END, _______, \
264 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
265 ),
266
267 /* Raise
268 * ,-----------------------------------------. ,-----------------------------------------.
269 * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del |
270 * |------+------+------+------+------+------| |------+------+------+------+------+------|
271 * | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ |
272 * |------+------+------+------+------+------| |------+------+------+------+------+------|
273 * | | F7 | F8 | F9 | F10 | F11 | | F12 | | |PageDn|PageUp| |
274 * |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
275 * | | | | | | | | | | | Next | Vol- | Vol+ | Play |
276 * `-------------------------------------------------------------------------------------------------'
277 */
278 [_RAISE] = KEYMAP( \
279 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
280 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
281 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_PGDN, KC_PGUP, _______, \
282 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
283 ),
284
285 /* Adjust (Lower + Raise)
286 * ,-----------------------------------------. ,-----------------------------------------.
287 * | | Reset| | | | | | | | | | | Del |
288 * |------+------+------+------+------+------| |------+------+------+------+------+------|
289 * | | | |Aud on|Audoff| Mac | | Win |Qwerty|Colemk|Dvorak| | |
290 * |------+------+------+------+------+------| |------+------+------+------+------+------|
291 * | | | | | | | | | |RGB ON| HUE+ | SAT+ | VAL+ |
292 * |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
293 * | | | | | | | | | | | MODE | HUE- | SAT- | VAL- |
294 * `-------------------------------------------------------------------------------------------------'
295 */
296 [_ADJUST] = KEYMAP( \
297 _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \
298 _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
299 _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, \
300 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD \
301 )
302};
303
304#else
305#error "undefined keymaps"
306#endif
307
308
309#ifdef AUDIO_ENABLE
310
311float tone_qwerty[][2] = SONG(QWERTY_SOUND);
312float tone_dvorak[][2] = SONG(DVORAK_SOUND);
313float tone_colemak[][2] = SONG(COLEMAK_SOUND);
314float tone_plover[][2] = SONG(PLOVER_SOUND);
315float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
316float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
317#endif
318
319// define variables for reactive RGB
320bool TOG_STATUS = false;
321int RGB_current_mode;
322
323void persistent_default_layer_set(uint16_t default_layer) {
324 eeconfig_update_default_layer(default_layer);
325 default_layer_set(default_layer);
326}
327
328// Setting ADJUST layer RGB back to default
329void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
330 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
331 #ifdef RGBLIGHT_ENABLE
332 //rgblight_mode(RGB_current_mode);
333 #endif
334 layer_on(layer3);
335 } else {
336 layer_off(layer3);
337 }
338}
339
340bool process_record_user(uint16_t keycode, keyrecord_t *record) {
341 switch (keycode) {
342 case QWERTY:
343 if (record->event.pressed) {
344 #ifdef AUDIO_ENABLE
345 PLAY_SONG(tone_qwerty);
346 #endif
347 persistent_default_layer_set(1UL<<_QWERTY);
348 }
349 return false;
350 break;
351 case COLEMAK:
352 if (record->event.pressed) {
353 #ifdef AUDIO_ENABLE
354 PLAY_SONG(tone_colemak);
355 #endif
356 persistent_default_layer_set(1UL<<_COLEMAK);
357 }
358 return false;
359 break;
360 case DVORAK:
361 if (record->event.pressed) {
362 #ifdef AUDIO_ENABLE
363 PLAY_SONG(tone_dvorak);
364 #endif
365 persistent_default_layer_set(1UL<<_DVORAK);
366 }
367 return false;
368 break;
369 case LOWER:
370 if (record->event.pressed) {
371 //not sure how to have keyboard check mode and set it to a variable, so my work around
372 //uses another variable that would be set to true after the first time a reactive key is pressed.
373 if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
374 } else {
375 TOG_STATUS = !TOG_STATUS;
376 #ifdef RGBLIGHT_ENABLE
377 //rgblight_mode(16);
378 #endif
379 }
380 layer_on(_LOWER);
381 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
382 } else {
383 #ifdef RGBLIGHT_ENABLE
384 //rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
385 #endif
386 TOG_STATUS = false;
387 layer_off(_LOWER);
388 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
389 }
390 return false;
391 break;
392 case RAISE:
393 if (record->event.pressed) {
394 //not sure how to have keyboard check mode and set it to a variable, so my work around
395 //uses another variable that would be set to true after the first time a reactive key is pressed.
396 if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
397 } else {
398 TOG_STATUS = !TOG_STATUS;
399 #ifdef RGBLIGHT_ENABLE
400 //rgblight_mode(15);
401 #endif
402 }
403 layer_on(_RAISE);
404 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
405 } else {
406 #ifdef RGBLIGHT_ENABLE
407 //rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
408 #endif
409 layer_off(_RAISE);
410 TOG_STATUS = false;
411 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
412 }
413 return false;
414 break;
415 case ADJUST:
416 if (record->event.pressed) {
417 layer_on(_ADJUST);
418 } else {
419 layer_off(_ADJUST);
420 }
421 return false;
422 break;
423 //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
424 case RGB_MOD:
425 #ifdef RGBLIGHT_ENABLE
426 if (record->event.pressed) {
427 rgblight_mode(RGB_current_mode);
428 rgblight_step();
429 RGB_current_mode = rgblight_config.mode;
430 }
431 #endif
432 return false;
433 break;
434 case EISU:
435 if (record->event.pressed) {
436 if(keymap_config.swap_lalt_lgui==false){
437 register_code(KC_LANG2);
438 }else{
439 SEND_STRING(SS_LALT("`"));
440 }
441 } else {
442 unregister_code(KC_LANG2);
443 }
444 return false;
445 break;
446 case KANA:
447 if (record->event.pressed) {
448 if(keymap_config.swap_lalt_lgui==false){
449 register_code(KC_LANG1);
450 }else{
451 SEND_STRING(SS_LALT("`"));
452 }
453 } else {
454 unregister_code(KC_LANG1);
455 }
456 return false;
457 break;
458 case RGBRST:
459 #ifdef RGBLIGHT_ENABLE
460 if (record->event.pressed) {
461 eeconfig_update_rgblight_default();
462 rgblight_enable();
463 RGB_current_mode = rgblight_config.mode;
464 }
465 #endif
466 break;
467 }
468 return true;
469}
470
471void matrix_init_user(void) {
472 #ifdef AUDIO_ENABLE
473 startup_user();
474 #endif
475 #ifdef RGBLIGHT_ENABLE
476 RGB_current_mode = rgblight_config.mode;
477 #endif
478 //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
479 #ifdef SSD1306OLED
480 TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
481 iota_gfx_init(!has_usb()); // turns on the display
482 #endif
483}
484
485
486#ifdef AUDIO_ENABLE
487
488void startup_user()
489{
490 _delay_ms(20); // gets rid of tick
491}
492
493void shutdown_user()
494{
495 _delay_ms(150);
496 stop_all_notes();
497}
498
499void music_on_user(void)
500{
501 music_scale_user();
502}
503
504void music_scale_user(void)
505{
506 PLAY_SONG(music_scale);
507}
508
509#endif
510
511
512//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
513#ifdef SSD1306OLED
514
515void matrix_scan_user(void) {
516 iota_gfx_task(); // this is what updates the display continuously
517}
518
519void matrix_update(struct CharacterMatrix *dest,
520 const struct CharacterMatrix *source) {
521 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
522 memcpy(dest->display, source->display, sizeof(dest->display));
523 dest->dirty = true;
524 }
525}
526
527//assign the right code to your layers for OLED display
528#define L_BASE 0
529#define L_LOWER 8
530#define L_RAISE 16
531#define L_FNLAYER 64
532#define L_NUMLAY 128
533#define L_NLOWER 136
534#define L_NFNLAYER 192
535#define L_MOUSECURSOR 256
536#define L_ADJUST 65536
537#define L_ADJUST_TRI 65560
538
539static void render_logo(struct CharacterMatrix *matrix) {
540
541 static char logo[]={
542 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
543 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
544 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
545 0};
546 matrix_write(matrix, logo);
547 //matrix_write_P(&matrix, PSTR(" Split keyboard kit"));
548}
549
550
551
552void render_status(struct CharacterMatrix *matrix) {
553
554 // Render to mode icon
555 static char logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}};
556 if(keymap_config.swap_lalt_lgui==false){
557 matrix_write(matrix, logo[0][0]);
558 matrix_write_P(matrix, PSTR("\n"));
559 matrix_write(matrix, logo[0][1]);
560 }else{
561 matrix_write(matrix, logo[1][0]);
562 matrix_write_P(matrix, PSTR("\n"));
563 matrix_write(matrix, logo[1][1]);
564 }
565
566 // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
567 char buf[40];
568 snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
569 matrix_write_P(matrix, PSTR("\nLayer: "));
570 switch (layer_state) {
571 case L_BASE:
572 matrix_write_P(matrix, PSTR("Default"));
573 break;
574 case L_RAISE:
575 matrix_write_P(matrix, PSTR("Raise"));
576 break;
577 case L_LOWER:
578 matrix_write_P(matrix, PSTR("Lower"));
579 break;
580 case L_ADJUST:
581 case L_ADJUST_TRI:
582 matrix_write_P(matrix, PSTR("Adjust"));
583 break;
584 default:
585 matrix_write(matrix, buf);
586 }
587
588 // Host Keyboard LED Status
589 char led[40];
590 snprintf(led, sizeof(led), "\n%s %s %s",
591 (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
592 (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
593 (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
594 matrix_write(matrix, led);
595}
596
597
598void iota_gfx_task_user(void) {
599 struct CharacterMatrix matrix;
600
601#if DEBUG_TO_SCREEN
602 if (debug_enable) {
603 return;
604 }
605#endif
606
607 matrix_clear(&matrix);
608 if(is_master){
609 render_status(&matrix);
610 }else{
611 render_logo(&matrix);
612 }
613 matrix_update(&display, &matrix);
614}
615
616#endif