aboutsummaryrefslogtreecommitdiff
path: root/keyboards/comet46/keymaps/satt/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/comet46/keymaps/satt/keymap.c')
-rw-r--r--keyboards/comet46/keymaps/satt/keymap.c288
1 files changed, 288 insertions, 0 deletions
diff --git a/keyboards/comet46/keymaps/satt/keymap.c b/keyboards/comet46/keymaps/satt/keymap.c
new file mode 100644
index 000000000..57aa63593
--- /dev/null
+++ b/keyboards/comet46/keymaps/satt/keymap.c
@@ -0,0 +1,288 @@
1// this is the style you want to emulate.
2// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
3
4#include QMK_KEYBOARD_H
5#include "keymap_jis2us.h"
6#include "action_pseudo_lut.h"
7#include "keymap_jp.h"
8#ifdef SSD1306OLED
9 #include "ssd1306.h"
10#endif
11
12// Each layer gets a name for readability, which is then used in the keymap matrix below.
13// The underscores don't mean anything - you can have a layer called STUFF or any other name.
14// Layer names don't all need to be of the same length, obviously, and you can also skip them
15// entirely and just use numbers.
16enum comet46_layers {
17 _QWERTY,
18 _LOWER,
19 _RAISE,
20 _PSEUDO_US,
21 _PSEUDO_US_LOWER,
22 _PSEUDO_US_RAISE,
23 _ADJUST
24};
25
26enum custom_keycodes {
27 QWERTY = SAFE_RANGE,
28 PSEUDO_US,
29 JIS2US,
30};
31
32// JIS keycodes
33#define KC_JZHT JP_ZKHK // hankaku/zenkaku|kanzi
34#define KC_JCIR JP_CIRC // ^, ~
35#define KC_JAT JP_AT // @, `
36#define KC_JLBR JP_LBRC // [, {
37#define KC_JCOL JP_COLN // :, *
38#define KC_JRBR JP_RBRC // ], }
39#define KC_JBSL JP_BSLS // \, _
40#define KC_JMHE JP_MHEN // muhenkan
41#define KC_JHEN JP_HENK // henkan
42#define KC_JKAN JP_KANA // katakana/hiragana|ro-mazi
43#define KC_JMKA JP_LANG1 //kana on MacOSX
44#define KC_JMEI KC_LANG2 //eisu on MacOSX
45#define KC_JAMP JP_AMPR // &
46#define KC_JQUO JP_QUOT // '
47#define KC_JLPR JP_LPRN // (
48#define KC_JRPR JP_RPRN // )
49#define KC_JEQL JP_EQL // =
50#define KC_JTIL JP_TILD // ~
51#define KC_JPIP JP_PIPE // |
52#define KC_JGRV JP_GRV // `
53#define KC_JLCB JP_LCBR // {
54#define KC_JPLU JP_PLUS // +
55#define KC_JAST JP_ASTR // *
56#define KC_JRCB JP_RCBR // }
57#define KC_JUND JP_UNDS // _
58
59// Layer related keycodes
60#define KC_LWR MO(_LOWER)
61#define KC_RSE MO(_RAISE)
62#define KC_P_LW MO(_PSEUDO_US_LOWER)
63#define KC_P_RS MO(_PSEUDO_US_RAISE)
64#define KC_QWRT QWERTY
65#define KC_P_US PSEUDO_US
66#define KC_J2US JIS2US
67
68// Special keycodes
69#define KC_SPCT CTL_T(KC_SPC)
70#define KC_ENSF SFT_T(KC_ENT)
71#define KC_CAEC MT(MOD_LCTL | MOD_LALT, KC_ESC)
72#define KC_CSTB C_S_T(KC_TAB)
73#define KC_IMON ALT_T(KC_F13)
74#define KC_IMOF GUI_T(KC_F14)
75#define KC_CAD LCA(KC_DEL)
76#define KC_RST RESET
77
78const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
79
80 [_QWERTY] = LAYOUT(
81 //,----+----+----+----+----+----+ +----+----+----+----+----+----.
82 KC_CAEC, KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P ,KC_DEL ,
83 //|----+----+----+----+----+----+----+ +----+----+----+----+----+----+----|
84 KC_CSTB, KC_A , KC_S , KC_D , KC_F , KC_G ,KC_LPRN, KC_RPRN, KC_H , KC_J , KC_K , KC_L ,KC_SCLN,KC_BSPC,
85 //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
86 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_QUOT,
87 //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
88 KC_IMOF,KC_LWR ,KC_SPCT, KC_ENSF,KC_RSE ,KC_IMON
89 // +----+----+---/ \---+----+----+
90 ),
91
92 [_LOWER] = LAYOUT(
93 //,----+----+----+----+----+----+ +----+----+----+----+----+----.
94 _______,KC_EXLM, KC_AT ,KC_HASH,KC_DLR ,KC_PERC, KC_CIRC,KC_AMPR,KC_ASTR,KC_LPRN,KC_RPRN,_______,
95 //|----+----+----+----+----+----+----+ +----+----+----+----+----+----+----|
96 _______, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_GRV ,KC_BSLS,KC_MINS,KC_EQL ,KC_LBRC,KC_RBRC,_______,
97 //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
98 _______, KC_F7 , KC_F8 , KC_F9 , KC_F10, KC_F11, KC_F12, KC_TILD,KC_PIPE,KC_UNDS,KC_PLUS,KC_LCBR,KC_RCBR,_______,
99 //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
100 _______,_______,_______, _______,_______,_______
101 // +----+----+---/ \---+----+----+
102 ),
103
104 [_RAISE] = LAYOUT(
105 //,----+----+----+----+----+----+ +----+----+----+----+----+----.
106 _______, KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 ,_______,
107 //|----+----+----+----+----+----+----+ +----+----+----+----+----+----+----|
108 _______,_______,_______,_______,_______,_______,_______, XXXXXXX,KC_LEFT,KC_DOWN, KC_UP ,KC_RGHT,KC_END ,_______,
109 //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
110 _______,_______,_______,_______,_______,_______,_______, KC_HOME,XXXXXXX,KC_PGDN,KC_PGUP,XXXXXXX,XXXXXXX,_______,
111 //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
112 _______,_______,_______, _______,_______,_______
113 // +----+----+---/ \---+----+----+
114 ),
115
116 [_PSEUDO_US] = LAYOUT(
117 //,----+----+----+----+----+----+ +----+----+----+----+----+----.
118 KC_CAEC, KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P ,KC_DEL ,
119 //|----+----+----+----+----+----+----+ +----+----+----+----+----+----+----|
120 KC_CSTB, KC_A , KC_S , KC_D , KC_F , KC_G ,KC_JLPR, KC_JRPR, KC_H , KC_J , KC_K , KC_L ,KC_J2US,KC_BSPC,
121 //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
122 KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B ,KC_J2US, KC_J2US, KC_N , KC_M ,KC_COMM,KC_DOT ,KC_SLSH,KC_J2US,
123 //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
124 KC_IMOF,KC_P_LW,KC_SPCT, KC_ENSF,KC_P_RS,KC_IMON
125 // +----+----+---/ \---+----+----+
126 ),
127
128
129 [_PSEUDO_US_LOWER] = LAYOUT(
130 //,----+----+----+----+----+----+ +----+----+----+----+----+----.
131 _______,KC_EXLM,KC_JAT ,KC_HASH,KC_DLR ,KC_PERC, KC_JCIR,KC_JAMP,KC_JAST,KC_JLPR,KC_JRPR,_______,
132 //|----+----+----+----+----+----+----+ +----+----+----+----+----+----+----|
133 _______, KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_JGRV,KC_JBSL,KC_MINS,KC_JEQL,KC_JLBR,KC_JRBR,_______,
134 //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
135 _______, KC_F7 , KC_F8 , KC_F9 , KC_F10, KC_F11, KC_F12, KC_JTIL,KC_JPIP,KC_JUND,KC_JPLU,KC_JLCB,KC_JRCB,_______,
136 //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
137 _______,_______,_______, _______,_______,_______
138 // +----+----+---/ \---+----+----+
139 ),
140
141 [_PSEUDO_US_RAISE] = LAYOUT(
142 //,----+----+----+----+----+----+ +----+----+----+----+----+----.
143 _______, KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 ,_______,
144 //|----+----+----+----+----+----+----+ +----+----+----+----+----+----+----|
145 _______,_______,_______,_______,_______,_______,KC_JZHT, XXXXXXX,KC_LEFT,KC_DOWN, KC_UP ,KC_RGHT,KC_END ,_______,
146 //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
147 _______,_______,_______,_______,_______,_______,_______, KC_HOME,XXXXXXX,KC_PGDN,KC_PGUP,XXXXXXX,XXXXXXX,_______,
148 //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
149 _______,_______,_______, _______,_______,_______
150 // +----+----+---/ \---+----+----+
151 ),
152
153 [_ADJUST] = LAYOUT(
154 //,----+----+----+----+----+----+ +----+----+----+----+----+----.
155 _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,
156 //|----+----+----+----+----+----+----+ +----+----+----+----+----+----+----|
157 _______,_______,_______,_______,_______,_______,KC_CAD , KC_QWRT,_______,_______,_______,_______,_______,_______,
158 //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
159 _______,_______,_______,_______,_______,_______,KC_RST , KC_P_US,_______,_______,_______,_______,_______,_______,
160 //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----|
161 _______,_______,_______, _______,_______,_______
162 // +----+----+---/ \---+----+----+
163 )
164
165};
166
167layer_state_t layer_state_set_user(layer_state_t state) {
168 switch (biton32(state)) {
169 case _PSEUDO_US_LOWER:
170 case _PSEUDO_US_RAISE:
171 return update_tri_layer_state(state, _PSEUDO_US_RAISE, _PSEUDO_US_LOWER, _ADJUST);
172 break;
173 default:
174 return update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
175 break;
176 }
177}
178
179//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
180#ifdef SSD1306OLED
181
182// You need to add source files to SRC in rules.mk when using OLED display functions
183void set_keylog(uint16_t keycode);
184const char *read_keylog(void);
185const char *read_modifier_state(void);
186const char *read_host_led_state(void);
187
188void matrix_init_user(void) {
189 iota_gfx_init(false); // turns on the display
190}
191
192void matrix_scan_user(void) {
193 iota_gfx_task(); // this is what updates the display continuously
194}
195
196void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) {
197 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
198 memcpy(dest->display, source->display, sizeof(dest->display));
199 dest->dirty = true;
200 }
201}
202
203void render_status(struct CharacterMatrix *matrix) {
204 // Layer state
205 char layer_str[22];
206 matrix_write(matrix, "Layer: ");
207 uint8_t layer = biton32(layer_state);
208 uint8_t default_layer = biton32(eeconfig_read_default_layer());
209 switch (layer) {
210 case _QWERTY:
211 switch (default_layer) {
212 case _QWERTY:
213 snprintf(layer_str, sizeof(layer_str), "Qwerty");
214 break;
215 case _PSEUDO_US:
216 snprintf(layer_str, sizeof(layer_str), "Psuedo_US");
217 break;
218 default:
219 snprintf(layer_str, sizeof(layer_str), "Undef-%d", default_layer);
220 break;
221 }
222 break;
223 case _RAISE:
224 snprintf(layer_str, sizeof(layer_str), "Raise");
225 break;
226 case _LOWER:
227 snprintf(layer_str, sizeof(layer_str), "Lower");
228 break;
229 case _PSEUDO_US_RAISE:
230 snprintf(layer_str, sizeof(layer_str), "P_US_Raise");
231 break;
232 case _PSEUDO_US_LOWER:
233 snprintf(layer_str, sizeof(layer_str), "P_US_Lower");
234 break;
235 case _ADJUST:
236 snprintf(layer_str, sizeof(layer_str), "Adjust");
237 break;
238 default:
239 snprintf(layer_str, sizeof(layer_str), "Undef-%d", layer);
240 }
241 matrix_write_ln(matrix, layer_str);
242 // Last entered keycode
243 matrix_write_ln(matrix, read_keylog());
244 // Modifier state
245 matrix_write_ln(matrix, read_modifier_state());
246 // Host Keyboard LED Status
247 matrix_write(matrix, read_host_led_state());
248}
249
250void iota_gfx_task_user(void) {
251 struct CharacterMatrix matrix;
252
253#if DEBUG_TO_SCREEN
254 if (debug_enable) {
255 return;
256 }
257#endif
258
259 matrix_clear(&matrix);
260 render_status(&matrix);
261 matrix_update(&display, &matrix);
262}
263
264#endif//SSD1306OLED
265
266bool process_record_user(uint16_t keycode, keyrecord_t *record) {
267 #ifdef SSD1306OLED
268 if (record->event.pressed) {
269 set_keylog(keycode);
270 }
271 #endif
272 switch (keycode) {
273 case QWERTY:
274 if (record->event.pressed) {
275 set_single_persistent_default_layer(_QWERTY);
276 }
277 break;
278 case PSEUDO_US:
279 if (record->event.pressed) {
280 set_single_persistent_default_layer(_PSEUDO_US);
281 }
282 break;
283 case JIS2US:
284 action_pseudo_lut(record, _QWERTY, keymap_jis2us);
285 break;
286 }
287 return true;
288}