Mercurial > crkbdyaz
annotate keymap.c @ 7:b9fe776c0227 draft default tip
- add eucalyn layout and eucalyn-mac layout
- add layer switch keys to _ADJUST layer
- minor fixes
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Thu, 21 Feb 2019 13:47:25 +0900 |
parents | 7b9e0c974769 |
children |
rev | line source |
---|---|
0 | 1 #include QMK_KEYBOARD_H |
2 #include "bootloader.h" | |
3 #ifdef PROTOCOL_LUFA | |
4 #include "lufa.h" | |
5 #include "split_util.h" | |
6 #endif | |
7 #ifdef SSD1306OLED | |
8 #include "ssd1306.h" | |
9 #endif | |
10 | |
11 extern keymap_config_t keymap_config; | |
12 | |
13 #ifdef RGBLIGHT_ENABLE | |
14 //Following line allows macro to read current RGB settings | |
15 extern rgblight_config_t rgblight_config; | |
16 #endif | |
17 | |
18 extern uint8_t is_master; | |
19 | |
20 // Each layer gets a name for readability, which is then used in the keymap matrix below. | |
21 // The underscores don't mean anything - you can have a layer called STUFF or any other name. | |
22 // Layer names don't all need to be of the same length, obviously, and you can also skip them | |
23 // entirely and just use numbers. | |
24 #define _QWERTY 0 | |
2 | 25 #define _MAC 1 |
7
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
26 #define _ECLN 2 |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
27 #define _ECLNMAC 3 |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
28 #define _LOWER 4 |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
29 #define _RAISE 5 |
0 | 30 #define _ADJUST 16 |
31 | |
32 enum custom_keycodes { | |
33 QWERTY = SAFE_RANGE, | |
34 LOWER, | |
35 RAISE, | |
36 ADJUST, | |
37 BACKLIT, | |
1
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
38 RGBRST, |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
39 RTAB, |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
40 LTAB, |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
41 RSPC, |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
42 LSPC, |
2 | 43 USPC, |
44 DSPC, | |
1
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
45 SSCR, |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
46 SWIN, |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
47 NAPP, |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
48 NWIN |
0 | 49 }; |
50 | |
51 enum macro_keycodes { | |
52 KC_SAMPLEMACRO, | |
53 }; | |
54 | |
55 #define KC______ KC_TRNS | |
56 #define KC_XXXXX KC_NO | |
57 #define KC_LOWER LOWER | |
58 #define KC_RAISE RAISE | |
59 #define KC_RST RESET | |
60 #define KC_LRST RGBRST | |
61 #define KC_LTOG RGB_TOG | |
62 #define KC_LHUI RGB_HUI | |
63 #define KC_LHUD RGB_HUD | |
64 #define KC_LSAI RGB_SAI | |
65 #define KC_LSAD RGB_SAD | |
66 #define KC_LVAI RGB_VAI | |
67 #define KC_LVAD RGB_VAD | |
68 #define KC_LMOD RGB_MOD | |
69 #define KC_CTLTB CTL_T(KC_TAB) | |
3
4bc0df3a6934
- assign tab to basic layer
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2
diff
changeset
|
70 #define KC_CLESC CTL_T(KC_ESC) |
0 | 71 #define KC_GUIEI GUI_T(KC_LANG2) |
72 #define KC_ALTKN ALT_T(KC_LANG1) | |
73 | |
1
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
74 #define KC_RTAB RTAB |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
75 #define KC_LTAB LTAB |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
76 #define KC_RSPC RSPC |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
77 #define KC_LSPC LSPC |
2 | 78 #define KC_USPC USPC |
79 #define KC_DSPC DSPC | |
1
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
80 #define KC_SSCR SSCR |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
81 #define KC_SWIN SWIN |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
82 #define KC_NAPP NAPP |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
83 #define KC_NWIN NWIN |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
84 |
7
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
85 #define KC_L1 TO(_QWERTY) |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
86 #define KC_L2 TO(_MAC) |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
87 #define KC_L3 TO(_ECLN) |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
88 #define KC_L4 TO(_ECLNMAC) |
2 | 89 |
90 | |
1
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
91 #define SS_RGUI(string) SS_DOWN(X_RGUI) string SS_UP(X_RGUI) |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
92 |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
93 |
0 | 94 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
95 [_QWERTY] = LAYOUT_kc( \ | |
96 //,-----------------------------------------. ,-----------------------------------------. | |
3
4bc0df3a6934
- assign tab to basic layer
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2
diff
changeset
|
97 TAB, Q, W, E, R, T, Y, U, I, O, P, MINS,\ |
0 | 98 //|------+------+------+------+------+------| |------+------+------+------+------+------| |
3
4bc0df3a6934
- assign tab to basic layer
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2
diff
changeset
|
99 CLESC, A, S, D, F, G, H, J, K, L, SCLN, QUOT,\ |
0 | 100 //|------+------+------+------+------+------| |------+------+------+------+------+------| |
101 LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT,\ | |
102 //|------+------+------+------+------+------+------| |------+------+------+------+------+------+------| | |
2 | 103 LOWER, SPC, LALT, ENT, BSPC, RAISE \ |
104 //`--------------------' `--------------------' | |
105 ), | |
106 | |
107 [_MAC] = LAYOUT_kc( \ | |
108 //,-----------------------------------------. ,-----------------------------------------. | |
3
4bc0df3a6934
- assign tab to basic layer
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2
diff
changeset
|
109 TAB, Q, W, E, R, T, Y, U, I, O, P, MINS,\ |
2 | 110 //|------+------+------+------+------+------| |------+------+------+------+------+------| |
3
4bc0df3a6934
- assign tab to basic layer
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2
diff
changeset
|
111 CLESC, A, S, D, F, G, H, J, K, L, SCLN, QUOT,\ |
2 | 112 //|------+------+------+------+------+------| |------+------+------+------+------+------| |
113 LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT,\ | |
114 //|------+------+------+------+------+------+------| |------+------+------+------+------+------+------| | |
1
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
115 LOWER, SPC, LGUI, ENT, BSPC, RAISE \ |
0 | 116 //`--------------------' `--------------------' |
117 ), | |
118 | |
7
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
119 [_ECLN] = LAYOUT_kc( \ |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
120 //,-----------------------------------------. ,-----------------------------------------. |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
121 TAB, Q, W, COMM, DOT, SCLN, M, R, D, Y, P, MINS,\ |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
122 //|------+------+------+------+------+------| |------+------+------+------+------+------| |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
123 CLESC, A, O, E, I, U, G, T, K, S, N, QUOT,\ |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
124 //|------+------+------+------+------+------| |------+------+------+------+------+------| |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
125 LSFT, Z, X, C, V, F, N, M, J, L, SLSH, RSFT,\ |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
126 //|------+------+------+------+------+------+------| |------+------+------+------+------+------+------| |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
127 LOWER, SPC, LALT, ENT, BSPC, RAISE \ |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
128 //`--------------------' `--------------------' |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
129 ), |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
130 |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
131 [_ECLNMAC] = LAYOUT_kc( \ |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
132 //,-----------------------------------------. ,-----------------------------------------. |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
133 TAB, Q, W, COMM, DOT, SCLN, M, R, D, Y, P, MINS,\ |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
134 //|------+------+------+------+------+------| |------+------+------+------+------+------| |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
135 CLESC, A, O, E, I, U, G, T, K, S, N, QUOT,\ |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
136 //|------+------+------+------+------+------| |------+------+------+------+------+------| |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
137 LSFT, Z, X, C, V, F, N, M, J, L, SLSH, RSFT,\ |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
138 //|------+------+------+------+------+------+------| |------+------+------+------+------+------+------| |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
139 LOWER, SPC, LGUI, ENT, BSPC, RAISE \ |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
140 //`--------------------' `--------------------' |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
141 ), |
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
142 |
0 | 143 [_LOWER] = LAYOUT_kc( \ |
144 //,-----------------------------------------. ,-----------------------------------------. | |
4 | 145 PLUS, EXLM, AT, HASH, DLR, PERC, CIRC, AMPR, ASTR, LPRN, RPRN, BSLS,\ |
0 | 146 //|------+------+------+------+------+------| |------+------+------+------+------+------| |
6
7b9e0c974769
- re-arrange move to each space keys as reversed-T shape
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
5
diff
changeset
|
147 CTLTB, TILD, LTAB, USPC, RTAB, XXXXX, XXXXX, LCBR, RCBR, LBRC, RBRC, PIPE,\ |
0 | 148 //|------+------+------+------+------+------| |------+------+------+------+------+------| |
6
7b9e0c974769
- re-arrange move to each space keys as reversed-T shape
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
5
diff
changeset
|
149 LSFT, GRV, LSPC, DSPC, RSPC, XXXXX, XXXXX, LT, GT, LCBR, RCBR, RSFT,\ |
0 | 150 //|------+------+------+------+------+------+------| |------+------+------+------+------+------+------| |
2 | 151 LOWER, SPC, LALT, ENT, BSPC, RAISE \ |
0 | 152 //`--------------------' `--------------------' |
153 ), | |
154 | |
155 [_RAISE] = LAYOUT_kc( \ | |
156 //,-----------------------------------------. ,-----------------------------------------. | |
5
eea4ee4ebb93
- move back cursor keys to _RAISE layer
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
4
diff
changeset
|
157 EQL, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, BSLS,\ |
0 | 158 //|------+------+------+------+------+------| |------+------+------+------+------+------| |
5
eea4ee4ebb93
- move back cursor keys to _RAISE layer
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
4
diff
changeset
|
159 CTLTB, XXXXX, WH_U, MS_U, WH_D, BTN1, HOME, PGUP, UP, PGDN, XXXXX, PIPE,\ |
0 | 160 //|------+------+------+------+------+------| |------+------+------+------+------+------| |
5
eea4ee4ebb93
- move back cursor keys to _RAISE layer
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
4
diff
changeset
|
161 LSFT, BTN3, MS_L, MS_D, MS_R, BTN2, END, LEFT, DOWN, RIGHT, XXXXX, RSFT,\ |
0 | 162 //|------+------+------+------+------+------+------| |------+------+------+------+------+------+------| |
2 | 163 LOWER, SPC, LALT, ENT, BSPC, RAISE \ |
0 | 164 //`--------------------' `--------------------' |
165 ), | |
166 | |
167 [_ADJUST] = LAYOUT_kc( \ | |
168 //,-----------------------------------------. ,-----------------------------------------. | |
4 | 169 F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,\ |
0 | 170 //|------+------+------+------+------+------| |------+------+------+------+------+------| |
7
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
171 XXXXX, SSCR, SWIN, XXXXX, XXXXX, L1, L3, MUTE, VOLD, VOLU, XXXXX, XXXXX,\ |
0 | 172 //|------+------+------+------+------+------| |------+------+------+------+------+------| |
7
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
173 RST, XXXXX, XXXXX, XXXXX, XXXXX, L2, L4, MRWD, MPLY, MFFD, XXXXX, RST,\ |
0 | 174 //|------+------+------+------+------+------+------| |------+------+------+------+------+------+------| |
2 | 175 LOWER, SPC, LALT, ENT, BSPC, RAISE \ |
0 | 176 //`--------------------' `--------------------' |
177 ) | |
4 | 178 |
2 | 179 #if 0 |
180 [_MAC] = LAYOUT_kc( \ | |
181 //,-----------------------------------------. ,-----------------------------------------. | |
182 _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____,\ | |
183 //|------+------+------+------+------+------| |------+------+------+------+------+------| | |
184 _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____,\ | |
185 //|------+------+------+------+------+------| |------+------+------+------+------+------| | |
186 _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____,\ | |
187 //|------+------+------+------+------+------+------| |------+------+------+------+------+------+------| | |
188 _____, _____, LGUI, _____, _____, _____,\ | |
189 //`--------------------' `--------------------' | |
190 ) | |
191 #endif | |
4 | 192 |
0 | 193 }; |
194 | |
195 int RGB_current_mode; | |
196 | |
197 void persistent_default_layer_set(uint16_t default_layer) { | |
198 eeconfig_update_default_layer(default_layer); | |
199 default_layer_set(default_layer); | |
200 } | |
201 | |
202 // Setting ADJUST layer RGB back to default | |
203 void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { | |
204 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { | |
205 layer_on(layer3); | |
206 } else { | |
207 layer_off(layer3); | |
208 } | |
209 } | |
210 | |
211 void matrix_init_user(void) { | |
212 #ifdef RGBLIGHT_ENABLE | |
213 RGB_current_mode = rgblight_config.mode; | |
214 #endif | |
215 //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h | |
216 #ifdef SSD1306OLED | |
217 iota_gfx_init(!has_usb()); // turns on the display | |
218 #endif | |
219 } | |
220 | |
221 //SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h | |
222 #ifdef SSD1306OLED | |
223 | |
224 // When add source files to SRC in rules.mk, you can use functions. | |
225 const char *read_layer_state(void); | |
226 const char *read_logo(void); | |
227 void set_keylog(uint16_t keycode, keyrecord_t *record); | |
228 const char *read_keylog(void); | |
229 const char *read_keylogs(void); | |
230 | |
231 // const char *read_mode_icon(bool swap); | |
232 // const char *read_host_led_state(void); | |
233 // void set_timelog(void); | |
234 // const char *read_timelog(void); | |
235 | |
236 void matrix_scan_user(void) { | |
237 iota_gfx_task(); | |
238 } | |
239 | |
240 void matrix_render_user(struct CharacterMatrix *matrix) { | |
241 if (is_master) { | |
242 // If you want to change the display of OLED, you need to change here | |
243 matrix_write_ln(matrix, read_layer_state()); | |
244 matrix_write_ln(matrix, read_keylog()); | |
245 matrix_write_ln(matrix, read_keylogs()); | |
246 //matrix_write_ln(matrix, read_mode_icon(keymap_config.swap_lalt_lgui)); | |
247 //matrix_write_ln(matrix, read_host_led_state()); | |
248 //matrix_write_ln(matrix, read_timelog()); | |
249 } else { | |
250 matrix_write(matrix, read_logo()); | |
251 } | |
252 } | |
253 | |
254 void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) { | |
255 if (memcmp(dest->display, source->display, sizeof(dest->display))) { | |
256 memcpy(dest->display, source->display, sizeof(dest->display)); | |
257 dest->dirty = true; | |
258 } | |
259 } | |
260 | |
261 void iota_gfx_task_user(void) { | |
262 struct CharacterMatrix matrix; | |
263 matrix_clear(&matrix); | |
264 matrix_render_user(&matrix); | |
265 matrix_update(&display, &matrix); | |
266 } | |
267 #endif//SSD1306OLED | |
268 | |
269 bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |
270 if (record->event.pressed) { | |
271 #ifdef SSD1306OLED | |
272 set_keylog(keycode, record); | |
273 #endif | |
274 // set_timelog(); | |
275 } | |
276 | |
277 switch (keycode) { | |
278 case QWERTY: | |
279 if (record->event.pressed) { | |
280 persistent_default_layer_set(1UL<<_QWERTY); | |
281 } | |
282 return false; | |
283 break; | |
284 case LOWER: | |
285 if (record->event.pressed) { | |
286 layer_on(_LOWER); | |
287 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | |
288 } else { | |
289 layer_off(_LOWER); | |
290 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | |
291 } | |
292 return false; | |
293 break; | |
294 case RAISE: | |
295 if (record->event.pressed) { | |
296 layer_on(_RAISE); | |
297 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | |
298 } else { | |
299 layer_off(_RAISE); | |
300 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | |
301 } | |
302 return false; | |
303 break; | |
304 case ADJUST: | |
305 if (record->event.pressed) { | |
306 layer_on(_ADJUST); | |
307 } else { | |
308 layer_off(_ADJUST); | |
309 } | |
310 return false; | |
311 break; | |
312 case RGB_MOD: | |
313 #ifdef RGBLIGHT_ENABLE | |
314 if (record->event.pressed) { | |
315 rgblight_mode(RGB_current_mode); | |
316 rgblight_step(); | |
317 RGB_current_mode = rgblight_config.mode; | |
318 } | |
319 #endif | |
320 return false; | |
321 break; | |
322 case RGBRST: | |
323 #ifdef RGBLIGHT_ENABLE | |
324 if (record->event.pressed) { | |
325 eeconfig_update_rgblight_default(); | |
326 rgblight_enable(); | |
327 RGB_current_mode = rgblight_config.mode; | |
328 } | |
329 #endif | |
330 break; | |
1
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
331 case RTAB: |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
332 //ctrl-tab |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
333 if(record->event.pressed) { |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
334 SEND_STRING(SS_LCTRL(SS_TAP(X_TAB))); |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
335 } |
7
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
336 return false; |
1
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
337 break; |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
338 case LTAB: |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
339 //ctrl-shift-tab |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
340 if(record->event.pressed) { |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
341 SEND_STRING(SS_LSFT(SS_LCTRL(SS_TAP(X_TAB)))); |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
342 } |
7
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
343 return false; |
1
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
344 break; |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
345 case RSPC: |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
346 //ctrl-right |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
347 if(record->event.pressed) { |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
348 SEND_STRING(SS_LCTRL(SS_TAP(X_RIGHT))); |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
349 } |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
350 break; |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
351 case LSPC: |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
352 //ctrl-left |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
353 if(record->event.pressed) { |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
354 SEND_STRING(SS_LCTRL(SS_TAP(X_LEFT))); |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
355 } |
7
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
356 return false; |
1
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
357 break; |
2 | 358 case USPC: |
359 //ctrl-up | |
360 if(record->event.pressed) { | |
361 SEND_STRING(SS_LCTRL(SS_TAP(X_UP))); | |
362 } | |
7
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
363 return false; |
2 | 364 break; |
365 case DSPC: | |
366 //ctrl-down | |
367 if(record->event.pressed) { | |
368 SEND_STRING(SS_LCTRL(SS_TAP(X_DOWN))); | |
369 } | |
7
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
370 return false; |
2 | 371 break; |
1
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
372 case SSCR: |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
373 //shift-cmd-3 |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
374 if(record->event.pressed) { |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
375 SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_3)))); |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
376 } |
7
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
377 return false; |
1
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
378 break; |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
379 case SWIN: |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
380 //shift-cmd-4 |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
381 if(record->event.pressed) { |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
382 SEND_STRING(SS_LSFT(SS_LGUI(SS_TAP(X_4)))); |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
383 } |
7
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
384 return false; |
1
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
385 break; |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
386 case NAPP: |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
387 //cmd-tab |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
388 if(record->event.pressed) { |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
389 SEND_STRING(SS_RGUI(SS_TAP(X_TAB))); |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
390 } |
7
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
391 return false; |
1
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
392 break; |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
393 case NWIN: |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
394 //cmd-grave |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
395 if(record->event.pressed) { |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
396 SEND_STRING(SS_RGUI(SS_TAP(X_GRAVE))); |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
397 } |
7
b9fe776c0227
- add eucalyn layout and eucalyn-mac layout
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
398 return false; |
1
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
399 break; |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
400 |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
401 #if 0 |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
402 case _ENTER: |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
403 if (record->event.pressed && get_mods() & MOD_BIT(KC_HYPR)) { |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
404 SEND_STRING ("string"); |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
405 } else { |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
406 SEND_STRING (SS_TAP(X_ENTER)); |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
407 } |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
408 return false; |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
409 break; |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
410 #endif |
366930ab82c7
- enable features: EXTRAKEY_ENABLE,NKRO_ENABLE
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
0
diff
changeset
|
411 |
0 | 412 } |
413 return true; | |
414 } | |
415 |