summaryrefslogtreecommitdiff
path: root/keyboards/tada68/keymaps/maartenwut/keymap.c
blob: d1e63a6b31318fff095e6169103c4f9f09337667 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
#include "tada68.h"
#include "action_layer.h"
#include "timer.h"
#include "bootloader.h"
#include "command.h"

#define _MA 0
#define _GA 1
#define _FL 2
#define _AR 3
#define _LO 4
#define _UL 5

#define TRNS KC_TRNS
#define trigger_time 400

#define T1 M(1)
#define T2 M(2)
#define T3 M(3)
#define T4 M(4)
#define T5 M(5)
#define T6 M(6)
#define T7 M(7)
#define T8 M(8)
#define T9 M(9)
#define T10 M(10)
#define T11 M(11)
#define T12 M(12)
#define END_HOME M(0)
#define LSHIFT OSM(MOD_LSFT)
#define SPACE LT(_AR, KC_SPC)

#define MACRO_BREATH_TOGGLE             13
#define MACRO_BREATH_SPEED_INC          14
#define MACRO_BREATH_SPEED_DEC          15
#define MACRO_BREATH_DEFAULT            16
#define M_BRTOG             M(MACRO_BREATH_TOGGLE)
#define M_BSPDU             M(MACRO_BREATH_SPEED_INC)
#define M_BSPDD             M(MACRO_BREATH_SPEED_DEC)
#define M_BDFLT             M(MACRO_BREATH_DEFAULT)

static uint16_t key_timer;

enum emoticons {
	LENNY = SAFE_RANGE,
	DWNHRT,
	SHRUG
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  /* Keymap _MA: Main Layer, Default
   * ,----------------------------------------------------------------.
   * |Esc | 1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backsp |P/P |
   * |----------------------------------------------------------------| 
   * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|  \  |Del |
   * |----------------------------------------------------------------|
   * |CAPS   |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return |PgUp|
   * |----------------------------------------------------------------|
   * |Shft|End|  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /|Shift | Up|PgDn|
   * |----------------------------------------------------------------|
   * |Ctrl|Win |Alt |        Space          |Alt|Ctrl| FN|Lef|Dow|Rig |
   * `----------------------------------------------------------------'
   */
[_MA] = KEYMAP_ANSI(
  KC_ESC,	T1, 		T2, 		T3, 		T4, 		T5, 		T6, 		T7, 		T8, 		T9, 		T10, 		T11, 		T12,		KC_BSPC,	KC_MPLY, \
  KC_TAB,	KC_Q, 		KC_W, 		KC_E, 		KC_R, 		KC_T, 		KC_Y, 		KC_U, 		KC_I,  		KC_O,  		KC_P, 		KC_LBRC,	KC_RBRC,	KC_BSLS,	KC_DEL, \
  KC_CAPS,	KC_A, 		KC_S,   	KC_D, 		KC_F, 		KC_G, 		KC_H, 		KC_J, 		KC_K,  		KC_L,  		KC_SCLN, 	KC_QUOT,  				KC_ENT,		KC_PGUP, \
  LSHIFT, 	END_HOME,	KC_Z, 		KC_X,   	KC_C, 		KC_V, 		KC_B, 		KC_N, 		KC_M, 		KC_COMM, 	KC_DOT,		KC_SLSH, 	KC_RSFT,    KC_UP,		KC_PGDN, \
  KC_LCTL, 	KC_LGUI, 	KC_LALT,							SPACE,											KC_RALT,	KC_RCTRL, 	MO(_FL),	KC_LEFT, 	KC_DOWN, 	KC_RGHT),
  
  /* Keymap _FL: Function Layer
   * ,----------------------------------------------------------------.
   * |~` | F1|F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Reset  |Prsc|
   * |----------------------------------------------------------------|
   * |     |MbL|MsU|MbR|   |   |   |   |   |   |   |   |   |     |_LO |
   * |----------------------------------------------------------------|
   * |      |MsL|MsD|MsR|   |_GA|   |   |   |   |   |   |        |Hme |
   * |----------------------------------------------------------------|
   * |    |   |BL-|BL+|BL |BR-|BR+|BR |   |VoU|VoD|Mut|      |MwU|End |
   * |----------------------------------------------------------------|
   * |    |    |    |                       |   |   |    |MwL|MwD|MwR |  
   * `----------------------------------------------------------------'
   */
[_FL] = KEYMAP_ANSI(
  KC_GRV,	KC_F1,		KC_F2,  	KC_F3,  	KC_F4,  	KC_F5,		KC_F6,		KC_F7, 		KC_F8,		KC_F9,		KC_F10,  	KC_F11,		KC_F12,		RESET,		KC_PSCR, \
  TRNS, 	KC_BTN1,	KC_MS_U,  	KC_BTN2, 	TRNS, 		TRNS, 		TRNS,		TRNS, 		TRNS, 		TRNS, 		TRNS, 		TRNS,		TRNS,		TRNS,		TO(_LO), \
  TRNS, 	KC_MS_L,	KC_MS_D, 	KC_MS_R,	TRNS,		TG(_GA),		TRNS,		TRNS,		TRNS,		TRNS,		TRNS,		TRNS,					TRNS,		KC_HOME, \
  TRNS, 	TRNS,		BL_DEC,		BL_INC,		BL_TOGG, 	M_BSPDD, 	M_BSPDU, 	M_BRTOG,	TRNS,		KC_VOLD,	KC_VOLU,	KC_MUTE,	TRNS,		KC_WH_U,	KC_END, \
  TRNS, 	TRNS, 		TRNS,								TRNS,											TRNS,		TRNS,		TRNS,   	KC_WH_L,	KC_WH_D, 	KC_WH_R),

  /* Keymap _AR: Arrow layer
   * ,----------------------------------------------------------------.
   * |   |   |   |   |   |   |   |   |   |   |   |   |   |       |    |
   * |----------------------------------------------------------------|
   * |Lenny|   |   |   |   |   |   |   |   |   |   |   |   |     |    |
   * |----------------------------------------------------------------|
   * |Dwnhrt|   |   |   |   |   |Lft|Dwn| Up|Rgt|   |   |        |    |
   * |----------------------------------------------------------------|
   * |Shrg|   |   |   |   |   |   |   |   |   |   |   |      |   |    |
   * |----------------------------------------------------------------|
   * |    |    |    |                       |   |   |    |   |   |    |
   * `----------------------------------------------------------------'
   */
[_AR] = KEYMAP_ANSI(
  TRNS,		TRNS, 		TRNS, 		TRNS, 		TRNS, 		TRNS, 		TRNS, 		TRNS, 		TRNS, 		TRNS, 		TRNS, 		TRNS, 		TRNS,		TRNS,		TRNS, \
  LENNY,	TRNS, 		TRNS, 		TRNS, 		TRNS, 		TRNS, 		TRNS, 		TRNS, 		TRNS,  		TRNS,  		TRNS, 		TRNS,		TRNS,		TRNS,		TRNS, \
  DWNHRT,	TRNS, 		TRNS,   	TRNS, 		TRNS, 		TRNS, 		KC_LEFT, 	KC_DOWN, 	KC_UP,  	KC_RGHT,  	TRNS, 		TRNS, 	 				TRNS,		TRNS, \
  SHRUG, 	TRNS,   	TRNS,		TRNS,		TRNS,		TRNS,	 	TRNS, 		TRNS, 		TRNS, 		TRNS, 		TRNS,		TRNS, 		TRNS,   	TRNS,		TRNS, \
  TRNS, 	TRNS, 		TRNS,								TRNS,											TRNS,		TRNS, 		TRNS,		TRNS, 		TRNS, 		TRNS),

  /* Keymap _GA: Game layer
   * ,----------------------------------------------------------------.
   * |Esc | 1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backsp |P/P |
   * |----------------------------------------------------------------| 
   * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|  \  |Del |
   * |----------------------------------------------------------------|
   * |CAPS   |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return |PgUp|
   * |----------------------------------------------------------------|
   * |Shft|End|  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /|Shift | Up|PgDn|
   * |----------------------------------------------------------------|
   * |Ctrl|Win |Alt |        Space          |Alt|Ctrl| FN|Lef|Dow|Rig |
   * `----------------------------------------------------------------'
   */
[_GA] = KEYMAP_ANSI(
  KC_ESC,	T1, 		T2, 		T3, 		T4, 		T5, 		T6, 		T7, 		T8, 		T9, 		T10, 		T11, 		T12,		KC_BSPC,	KC_MPLY, \
  KC_TAB,	KC_Q, 		KC_W, 		KC_E, 		KC_R, 		KC_T, 		KC_Y, 		KC_U, 		KC_I,  		KC_O,  		KC_P, 		KC_LBRC,	KC_RBRC,	KC_BSLS,	KC_DEL, \
  KC_CAPS,	KC_A, 		KC_S,   	KC_D, 		KC_F, 		KC_G, 		KC_H, 		KC_J, 		KC_K,  		KC_L,  		KC_SCLN, 	KC_QUOT,  				KC_ENT,		KC_PGUP, \
  KC_LSFT, 	END_HOME,	KC_Z, 		KC_X,   	KC_C, 		KC_V, 		KC_B, 		KC_N, 		KC_M, 		KC_COMM, 	KC_DOT,		KC_SLSH, 	KC_RSFT,    KC_UP,		KC_PGDN, \
  KC_LCTL, 	KC_LGUI, 	KC_LALT,							KC_SPC,											KC_RALT,	KC_RCTRL, 	MO(_FL),	KC_LEFT, 	KC_DOWN, 	KC_RGHT),

  /* Keymap _UL: Unlock layer
   * ,----------------------------------------------------------------.
   * |   |   |   |   |   |   |   |   |   |   |   |   |   |       |    |
   * |----------------------------------------------------------------|
   * |     |   |   |   |   |   |   |   |   |   |   |   |   |     |_MA |
   * |----------------------------------------------------------------|
   * |      |   |   |   |   |   |   |   |   |   |   |   |        |    |
   * |----------------------------------------------------------------|
   * |    |   |   |   |   |   |   |   |   |   |   |   |      |   |    |
   * |----------------------------------------------------------------|
   * |    |    |    |                       |   |   |    |   |   |    |
   * `----------------------------------------------------------------'
   */
[_UL] = KEYMAP_ANSI(
  KC_NO,	KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO,  	KC_NO, 		KC_NO, 		KC_NO,  	KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, \
  KC_NO, 	KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO,  	KC_NO, 		KC_NO,  	KC_NO, 		TO(_MA), \
  KC_NO, 	KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 					KC_NO, 		KC_NO, \
  KC_NO, 	KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, \
  KC_NO, 	KC_NO, 		KC_NO,    							KC_NO,											KC_NO, 		KC_NO, 		TRNS, 		KC_NO, 		KC_NO, 		KC_NO),

  /* Keymap _LO: Lock layer
   * ,----------------------------------------------------------------.
   * |   |   |   |   |   |   |   |   |   |   |   |   |   |       |    |
   * |----------------------------------------------------------------|
   * |     |   |   |   |   |   |   |   |   |   |   |   |   |     |    |
   * |----------------------------------------------------------------|
   * |      |   |   |   |   |   |   |   |   |   |   |   |        |    |
   * |----------------------------------------------------------------|
   * |    |   |   |   |   |   |   |   |   |   |   |   |      |   |    |
   * |----------------------------------------------------------------|
   * |    |    |    |                      |   |   | _UL |   |   |    |
   * `----------------------------------------------------------------'
   */
[_LO] = KEYMAP_ANSI(
  KC_NO,	KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO,  	KC_NO, 		KC_NO, 		KC_NO,  	KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, \
  KC_NO, 	KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO,  	KC_NO, 		KC_NO,  	KC_NO, 		KC_NO, \
  KC_NO, 	KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 					KC_NO, 		KC_NO, \
  KC_NO, 	KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, 		KC_NO, \
  KC_NO, 	KC_NO, 		KC_NO,    							KC_NO,											KC_NO, 		KC_NO, 		MO(_UL), 	KC_NO, 		KC_NO, 		KC_NO),
};

void tap(uint16_t keycode){
    register_code(keycode);
    unregister_code(keycode);
};

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
	switch (keycode) {
		case LENNY:			// ( ͡° ͜ʖ ͡°)
			if(record->event.pressed){
				set_unicode_input_mode(UC_WIN);
				register_code(KC_LSFT);
				tap(KC_9);										// Head
				unregister_code(KC_LSFT);
				tap(KC_SPC);									// Space
				process_unicode((0x0361|QK_UNICODE), record);	// Eyebrow
				process_unicode((0x00B0|QK_UNICODE), record);	// Eye
				tap(KC_SPC);
				process_unicode((0x035C|QK_UNICODE), record);	// Mouth
				process_unicode((0x0296|QK_UNICODE), record);	// Nose
				tap(KC_SPC);
				process_unicode((0x0361|QK_UNICODE), record);	// Eyebrow
				process_unicode((0x00B0|QK_UNICODE), record);	// Eye
				register_code(KC_LSFT);
				tap(KC_0);										// Head
				unregister_code(KC_LSFT);
			}
			return false;
			break;
		case DWNHRT:		// (´・ω・`)
			if(record->event.pressed){
				set_unicode_input_mode(UC_WIN);
				register_code(KC_LSFT);
				tap(KC_9);										// Head
				unregister_code(KC_LSFT);
				process_unicode((0x00B4|QK_UNICODE), record);	// Eyebrow
				process_unicode((0x30FB|QK_UNICODE), record);	// Eye
				process_unicode((0x03C9|QK_UNICODE), record);	// Mouth
				process_unicode((0x30FB|QK_UNICODE), record);	// Eye
				process_unicode((0x0060|QK_UNICODE), record);	// Eyebrow
				register_code(KC_LSFT);
				tap(KC_0);										// Head
				unregister_code(KC_LSFT);
			}
			return false;
			break;
		case SHRUG:			// ¯\_(ツ)_/¯
			if(record->event.pressed){
				set_unicode_input_mode(UC_WIN);
				process_unicode((0x00AF|QK_UNICODE), record);	// Hand
				tap(KC_BSLS);									// Arm
				register_code(KC_LSFT);
				tap(KC_UNDS);									// Arm
				tap(KC_LPRN);									// Head
				unregister_code(KC_LSFT);
				process_unicode((0x30C4|QK_UNICODE), record);	// Face
				register_code(KC_LSFT);
				tap(KC_RPRN);									// Head
				tap(KC_UNDS);									// Arm
				unregister_code(KC_LSFT);
				tap(KC_SLSH);									// Arm
				process_unicode((0x00AF|QK_UNICODE), record);	// Hand
			}
			return false;
			break;
	}
	return true;
};

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
    switch (id) {
		case 0:
			if (record->event.pressed) {
				key_timer = timer_read();
			}
			else {
				if (timer_elapsed(key_timer) > trigger_time) {
					return MACRO( T(END), END );
				}
				else {
					return MACRO( T(HOME), END );
				}
			}
			break;
		case 1:
			if (record->event.pressed) {
				key_timer = timer_read();
			}
			else { 
				if (timer_elapsed(key_timer) > trigger_time) {
					return MACRO( T(F1), END );
				}
				else {
					return MACRO( T(1), END );
				}
			}
			break;
		case 2:
			if (record->event.pressed) {
				key_timer = timer_read();
			}
			else { 
				if (timer_elapsed(key_timer) > trigger_time) {
					return MACRO( T(F2), END );
				}
				else {
					return MACRO( T(2), END );
				}
			}
			break;
		case 3:
			if (record->event.pressed) {
				key_timer = timer_read();
			}
			else { 
				if (timer_elapsed(key_timer) > trigger_time) {
					return MACRO( T(F3), END );
				}
				else {
					return MACRO( T(3), END );
				}
			}
			break;
		case 4:
			if (record->event.pressed) {
				key_timer = timer_read();
			}
			else { 
				if (timer_elapsed(key_timer) > trigger_time) {
					return MACRO( T(F4), END );
				}
				else {
					return MACRO( T(4), END );
				}
			}
			break;
		case 5:
			if (record->event.pressed) {
				key_timer = timer_read();
			}
			else { 
				if (timer_elapsed(key_timer) > trigger_time) {
					return MACRO( T(F5), END );
				}
				else {
					return MACRO( T(5), END );
				}
			}
			break;
		case 6:
			if (record->event.pressed) {
				key_timer = timer_read();
			}
			else { 
				if (timer_elapsed(key_timer) > trigger_time) {
					return MACRO( T(F6), END );
				}
				else {
					return MACRO( T(6), END );
				}
			}
			break;
		case 7:
			if (record->event.pressed) {
				key_timer = timer_read();
			}
			else { 
				if (timer_elapsed(key_timer) > trigger_time) {
					return MACRO( T(F7), END );
				}
				else {
					return MACRO( T(7), END );
				}
			}
			break;
		case 8:
			if (record->event.pressed) {
				key_timer = timer_read();
			}
			else { 
				if (timer_elapsed(key_timer) > trigger_time) {
					return MACRO( T(F8), END );
				}
				else {
					return MACRO( T(8), END );
				}
			}
			break;
		case 9:
			if (record->event.pressed) {
				key_timer = timer_read();
			}
			else { 
				if (timer_elapsed(key_timer) > trigger_time) {
					return MACRO( T(F9), END );
				}
				else {
					return MACRO( T(9), END );
				}
			}
			break;
		case 10:
			if (record->event.pressed) {
				key_timer = timer_read();
			}
			else { 
				if (timer_elapsed(key_timer) > trigger_time) {
					return MACRO( T(F10), END );
				}
				else {
					return MACRO( T(0), END );
				}
			}
			break;
		case 11:
			if (record->event.pressed) {
				key_timer = timer_read();
			}
			else { 
				if (timer_elapsed(key_timer) > trigger_time) {
					return MACRO( T(F11), END );
				}
				else {
					return MACRO( T(MINS), END );
				}
			}
			break;
		case 12:
			if (record->event.pressed) {
				key_timer = timer_read();
			}
			else { 
				if (timer_elapsed(key_timer) > trigger_time) {
					return MACRO( T(F12), END );
				}
				else {
					return MACRO( T(EQL), END );
				}
			}
			break;
		case MACRO_BREATH_TOGGLE:
			if (record->event.pressed) {
				breathing_toggle();
			}
			break;

		case MACRO_BREATH_SPEED_INC:
			if (record->event.pressed) {
				breathing_speed_inc(1);
			}
			break;

		case MACRO_BREATH_SPEED_DEC:
			if (record->event.pressed) {
				breathing_speed_dec(1);
			}
			break;

		case MACRO_BREATH_DEFAULT:
			if (record->event.pressed) {
				breathing_defaults();
			}
			break;
	}
    return MACRO_NONE;
};