summaryrefslogtreecommitdiffstats
path: root/keyboards/arch_36/keymaps/obosob/keymap.c
blob: 104ee378f51a087636305284ffdee24f7de22da8 (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
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
/* Copyright 2020 Obosob <obosob@riseup.net>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include QMK_KEYBOARD_H

enum layer_names {
  _QWERTY,
  _COLMAK,
  _NUM,
  _NAV,
  _SYM,
  _MISC,
  _ADJUST
};

#define MY_SPC  LT(_NAV, KC_SPC)
#define MY_ENT  LT(_NUM, KC_ENT)
#define MY_BSPC SFT_T(KC_BSPC)
#define MY_DEL  SFT_T(KC_DEL)
#define MY_ESC  CTL_T(KC_ESC)
#define MY_TAB  RALT_T(KC_TAB)

#define KC_NUPI S(KC_NUBS)

#define OS_SFT  OSM(MOD_LSFT)
#define OS_CTL  OSM(MOD_LCTL)
#define OS_GUI  OSM(MOD_LGUI)
#define OS_ALT  OSM(MOD_LALT)

enum keycodes {
  QWERTY = SAFE_RANGE,
  COLEMAK,
// layers
  SYM,
  MISC,
// special keys
  ENC_PRS,
  DOTSPC,
  COMMSPC,
  EXLMSPC,
  QUESSPC,
  DQUOT,
  QUOT,
  PRN,
  BRC,
  CBR,
  LTGT,
  LTGTC,
  GRV,
  A_TAB,
  AS_TAB,
  WOKE,
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

//   Qwerty            ________                                                         ________
//            ________|      E |________                                       ________|      I |________
//           |      W |        |      R |________                     ________|      U |        |      O |
//   ________|        |________|        |      T |                   |      Y |        |________|        |________
//  |      Q |________|      D |________|        |                   |        |________|      K |________|      P |
//  |        |      S |        |      F |________|                   |________|      J |        |      L |        |
//  |________|        |________|        |      G |                   |      H |        |________|        |________|
//  |      A |________|      C |________|        |                   |        |________|    SYM |________|      : |
//  |        |      X |        |      V |________|                   |________|      M |        |   MISC |      ; |
//  |________|        |________|        |      B |                   |      N |        |________|        |________|
//  |      Z |________|        |________|        |                   |        |________|        |________|      ? |
//  |        |                 |    Esc |________|                   |________|    Tab |                 |      / |
//  |________|                 | Ctrl   |  Enter |________   ________|  Space | Alt    |                 |________|
//                             |________| NUM    |  Del   | |   BkSp | NAV    |________|
//                                       ________| Shift  | | Shift  |________
//                                               |________| |________|

    [_QWERTY] = LAYOUT_split_3x5_3(
      KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,                      KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,
      KC_A,    KC_S,    KC_D,    KC_F,    KC_G,                      KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN,
      KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,                      KC_N,    KC_M,    SYM,     MISC,    KC_SLSH,
                                 MY_ESC,  MY_ENT,  MY_DEL,  MY_BSPC, MY_SPC,  MY_TAB
    ),
//   Colemak (Mod-DH)  ________                                                         ________
//            ________|      F |________                                       ________|      U |________
//           |      W |        |      P |________                     ________|      L |        |      Y |
//   ________|        |________|        |      B |                   |      J |        |________|        |________
//  |      Q |________|      S |________|        |                   |        |________|      E |________|      : |
//  |        |      R |        |      T |________|                   |________|      N |        |      I |      ; |
//  |________|        |________|        |      G |                   |      K |        |________|        |________|
//  |      A |________|      C |________|        |                   |        |________|    SYM |________|      O |
//  |        |      X |        |      D |________|                   |________|      H |        |   MISC |        |
//  |________|        |________|        |      V |                   |      M |        |________|        |________|
//  |      Z |________|        |________|        |                   |        |________|        |________|      ? |
//  |        |                 |    Esc |________|                   |________|    Tab |                 |      / |
//  |________|                 | Ctrl   |  Enter |________   ________|  Space | Alt    |                 |________|
//                             |________| NUM    |  Del   | |   BkSp | NAV    |________|
//                                       ________| Shift  | | Shift  |________
//                                               |________| |________|

    [_COLMAK] = LAYOUT_split_3x5_3(
      KC_Q,    KC_W,    KC_F,    KC_P,    KC_B,                      KC_J,    KC_L,    KC_U,    KC_Y,    KC_SCLN,
      KC_A,    KC_R,    KC_S,    KC_T,    KC_G,                      KC_K,    KC_N,    KC_E,    KC_I,    KC_O,
      KC_Z,    KC_X,    KC_C,    KC_D,    KC_V,                      KC_M,    KC_H,    SYM,     MISC,    KC_SLSH,
                                 MY_ESC,  MY_ENT,  MY_DEL,  MY_BSPC, MY_SPC,  MY_TAB
    ),
//   Number            ________                                                         ________
//            ________|     F3 |________                                       ________|      8 |________
//           |     F2 |        |     F4 |________                     ________|      7 |        |      9 |
//   ________|        |________|        |        |                   |      + |        |________|        |________
//  |     F1 |________|     F7 |________|        |                   |        |________|      5 |________|      / |
//  |        |     F6 |        |     F8 |________|                   |________|      4 |        |      6 |        |
//  |________|        |________|        |        |                   |      0 |        |________|        |________|
//  |     F5 |________|    F11 |________|        |                   |        |________|      2 |________|      . |
//  |        |    F10 |        |    F12 |________|                   |________|      1 |        |      3 |        |
//  |________|        |________|        |        |                   |      - |        |________|        |________|
//  |     F9 |________|        |________|        |                   |        |________|        |________|      * |
//  |        |                 |        |________|                   |________|        |                 |        |
//  |________|                 |        |        |________   ________| ADJUST |        |                 |________|
//                             |________|  ****  |        | |        |        |________|
//                                      |________|        | |        |________|
//                                               |________| |________|
    [_NUM] = LAYOUT_split_3x5_3(
     KC_F1,   KC_F2,   KC_F3,   KC_F4,   XXXXXXX,                    KC_PLUS, KC_7,    KC_8,    KC_9,    KC_SLSH,
     KC_F5,   KC_F6,   KC_F7,   KC_F8,   XXXXXXX,                    KC_COMM, KC_4,    KC_5,    KC_6,    KC_DOT,
     KC_F9,   KC_F10,  KC_F11,  KC_F12,  XXXXXXX,                    KC_MINS, KC_1,    KC_2,    KC_3,    KC_ASTR,
                                XXXXXXX, _______, XXXXXXX,  _______, _______, KC_0
    ),
//   Navigation        ________                                                          ________
//            ________|     OS |________                                        ________|   PgUp |________
//           |     OS |   Ctrl |     OS |________                      ________|   PgDn |        |    End |
//   ________|    Alt |________|  Shift | AltTab |                    |   Home |        |________|        |________
//  |     OS |________|   Ctrl |________|        |                    |        |________|     Up |________| PrtScr |
//  |  Super |    Alt |        |  Shift |________|                    |________|   Down |        |  Right |        |
//  |________|        |________|        |        |                    |   Left |        |________|        |________|
//  |  Super |________|        |________|        |                    |        |________|        |________| Insert |
//  |        |        |        |        |________|                    |________|        |        |        |        |
//  |________|        |________|        |        |                    |        |        |________|        |________|
//  |        |________|        |________|        |                    |        |________|        |________|        |
//  |        |                 |        |________|                    |________|        |                 |        |
//  |________|                 |        | ADJUST |________    ________|        |        |                 |________|
//                             |________|        |        |  |        |  ****  |________|
//                                      |________|        |  |        |________|
//                                               |________|  |________|
    [_NAV] = LAYOUT_split_3x5_3(
      OS_GUI,  OS_ALT,  OS_CTL,  OS_SFT,  XXXXXXX,                    KC_HOME, KC_PGDN, KC_PGUP, KC_END,  KC_PSCR,
      KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX,                    KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT, KC_INS,
      XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,                    XXXXXXX, AS_TAB,  A_TAB,   XXXXXXX, XXXXXXX,
                                 _______, _______, _______,  XXXXXXX, _______, XXXXXXX
      ),
//   Symbol            ________                                                          ________
//            ________|      { |________                                        ________|        |________
//           |      > |        |      } |________                      ________|        |        |        |
//   ________|        |________|        |      ` |                    |        |        |________|        |________
//  |      < |________|      ( |________|        |                    |        |________|        |________|      | |
//  |        |      £ |        |      ) |________|                    |________|      - |        |      & |        |
//  |________|        |________|        |      ^ |                    |      _ |        |________|        |________|
//  |      * |________|     [  |________|        |                    |        |________|        |________|      ~ |
//  |        |      $ |        |      ] |________|                    |________|      + |  ****  |      % |        |
//  |________|        |________|        |      @ |                    |      = |        |________|        |________|
//  |      \ |________|        |________|        |                    |        |________|        |________|      # |
//  |        |                 |      ? |________|                    |________|      ! |                 |        |
//  |________|                 |        |      ' |________    ________|      . |        |                 |________|
//                             |________|        |      " |  |      , |        |________|
//                                      |________|        |  |        |________|
//                                               |________|  |________|
//
    [_SYM] = LAYOUT_split_3x5_3(
         KC_LT,   KC_GT,   KC_LCBR, KC_RCBR, KC_GRV,                   XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_NUPI,
         KC_ASTR, KC_HASH, KC_LPRN, KC_RPRN, KC_CIRC,                  KC_UNDS, KC_MINS, XXXXXXX, KC_AMPR, KC_PIPE,
         KC_NUBS, KC_DLR,  KC_LBRC, KC_RBRC, KC_DQUO,                  KC_EQL,  KC_PLUS, _______, KC_PERC, KC_NUHS,
                                    KC_QUES, KC_QUOT, KC_AT,  KC_COMM, KC_DOT,  KC_EXLM
        ),
//    Miscellaneous    ________                                                          ________
//            ________|    {|} |________                                        ________|        |________
//           |   </|> |        |    {|} |________                      ________|        |        |        |
//   ________|        |________|        |        |                    |        |        |________|        |________
//  |    <|> |________|    (|) |________|        |                    |        |________|        |________|        |
//  |        |        |        |    (|) |________|                    |________|        |        |        |        |
//  |________|        |________|        |        |                    |        |        |________|        |________|
//  |        |________|    [|] |________|        |                    |        |________|        |________|        |
//  |        |        |        |    [|] |________|                    |________|        |        |        |        |
//  |________|        |________|        |        |                    |        |        |________|  ****  |________|
//  |        |________|        |________|        |                    |        |________|        |________|        |
//  |        |                 |    ?_^ |________|                    |________|    !_^ |                 |        |
//  |________|                 |        |    '|' |________    ________|    ._^ |        |                 |________|
//                             |________|        |    "|" |  |     ,_ |        |________|
//                                      |________|        |  |        |________|
//                                               |________|  |________|
//
    [_MISC] = LAYOUT_split_3x5_3(
        LTGT,    LTGTC,   CBR,     CBR,     GRV,                        XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
        XXXXXXX, XXXXXXX, PRN,     PRN,     XXXXXXX,                    XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
        XXXXXXX, XXXXXXX, BRC,     BRC,     XXXXXXX,                    XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX,
                                   QUESSPC, QUOT,    DQUOT,    COMMSPC, DOTSPC,  EXLMSPC
        ),
//   Adjust            ________                                                          ________
//            ________|  RESET |________                                        ________|        |________
//           |        | EEPROM |  RESET |________                      ________|        |        |        |
//   ________|        |________|        |        |                    |        |        |________|        |________
//  |        |________| RGB    |________|        |                    |        |________|        |________|        |
//  |        | RGB    | Hue+   | RGB    |________|                    |________|        |        |        |        |
//  |________| Toggle |________| Sat+   | RGB    |                    |        |        |________|        |________|
//  |        |________| RGB    |________| Bri+   |                    |        |________|        |________|        |
//  |        | RGB    | Hue-   | RGB    |________|                    |________|        |        |        |        |
//  |________| Mode   |________| Sat-   | RGB    |                    |        |        |________|        |________|
//  |        |________|        |________| Bri-   |                    |        |________|        |________|        |
//  |        |                 |        |________|                    |________|        |                 |        |
//  |________|                 |        |        |________    ________|        |        |                 |________|
//                             |________|  ****  |        |  |        |  ****  |________|
//                                      |________|        |  |        |________|
//                                               |________|  |________|
    [_ADJUST] = LAYOUT_split_3x5_3(
        XXXXXXX, WOKE,    EEP_RST, RESET,   XXXXXXX,                     XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
        XXXXXXX, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI,                     XXXXXXX, QWERTY,  COLEMAK, XXXXXXX, XXXXXXX,
        XXXXXXX, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD,                     XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
                                   XXXXXXX, XXXXXXX, XXXXXXX,   XXXXXXX, XXXXXXX, XXXXXXX
        ),
};

bool alt_tabbing = false;
bool woke_mode = false;
uint16_t rgb_edit_timer = 0;
uint16_t last_rgb_char = 0;

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    switch (keycode) {
        case QWERTY:
            if (record->event.pressed) {
                set_single_persistent_default_layer(_QWERTY);
            }
            return false;
        case COLEMAK:
            if (record->event.pressed) {
                set_single_persistent_default_layer(_COLMAK);
            }
            return false;
        case SYM:
            if (record->event.pressed) {
                layer_on(_SYM);
            } else {
                layer_off(_SYM);
            }
            return false;
        case MY_SPC:
            if (!record->event.pressed) {
                if(alt_tabbing) {
                    unregister_code(KC_LALT);
                    alt_tabbing = false;
                }
            }
            return true;
        case MISC:
            if (record->event.pressed) {
                layer_on(_MISC);
            } else {
                layer_off(_MISC);
            }
            return false;
        case DOTSPC:
            if (record->event.pressed) {
                tap_code(KC_DOT);
                tap_code(KC_SPC);
                set_oneshot_mods(MOD_LSFT);
            }
            return false;
        case COMMSPC:
            if (record->event.pressed) {
                tap_code(KC_COMM);
                tap_code(KC_SPC);
            }
            return false;
        case EXLMSPC:
            if (record->event.pressed) {
                tap_code16(KC_EXLM);
                tap_code(KC_SPC);
                set_oneshot_mods(MOD_LSFT);
            }
            return false;
        case QUESSPC:
            if (record->event.pressed) {
                tap_code16(KC_QUES);
                tap_code(KC_SPC);
                set_oneshot_mods(MOD_LSFT);
            }
            return false;
        case QUOT:
            if (record->event.pressed) {
                tap_code(KC_QUOT);
                tap_code(KC_QUOT);
                tap_code(KC_LEFT);
            }
            return false;
        case DQUOT:
            if (record->event.pressed) {
                tap_code16(KC_DQUO);
                tap_code16(KC_DQUO);
                tap_code(KC_LEFT);
            }
            return false;
        case PRN:
            if (record->event.pressed) {
                tap_code16(KC_LPRN);
                tap_code16(KC_RPRN);
                tap_code(KC_LEFT);
            }
            return false;
        case BRC:
            if (record->event.pressed) {
                tap_code(KC_LBRC);
                tap_code(KC_RBRC);
                tap_code(KC_LEFT);
            }
            return false;
        case CBR:
            if (record->event.pressed) {
                tap_code16(KC_LCBR);
                tap_code16(KC_RCBR);
                tap_code(KC_LEFT);
            }
            return false;
        case LTGT:
            if (record->event.pressed) {
                tap_code16(KC_LT);
                tap_code16(KC_GT);
                tap_code(KC_LEFT);
            }
            return false;
        case LTGTC:
            if (record->event.pressed) {
                tap_code16(KC_LT);
                tap_code(KC_SLSH);
                tap_code16(KC_GT);
                tap_code(KC_LEFT);
            }
            return false;
        case GRV:
            if (record->event.pressed) {
                tap_code(KC_GRV);
                tap_code(KC_GRV);
                tap_code(KC_LEFT);
            }
            return false;
        case AS_TAB:
            if (record->event.pressed) {
                register_code(KC_LSFT);
            } else {
                unregister_code(KC_LSFT);
            }
        case A_TAB:
            if (record->event.pressed) {
                register_code(KC_LALT);
                register_code(KC_TAB);
                alt_tabbing = true;
            } else {
                unregister_code(KC_TAB);
            }
            return false;
        case WOKE:
            if (!record->event.pressed) {
                woke_mode = !woke_mode;
            }
            return false;
        case RGB_TOG:
        case RGB_MOD:
        case RGB_HUD:
        case RGB_HUI:
        case RGB_SAD:
        case RGB_SAI:
        case RGB_VAI:
        case RGB_VAD:
            rgb_edit_timer = timer_read();
            last_rgb_char = keycode;
            return true;
    }

    if (woke_mode && ((keycode >= KC_A && keycode <= KC_Z) || keycode == MY_BSPC)) {
        if (record->event.pressed) {
            tap_code(KC_CAPS);
        }
    }

    return true;
}

layer_state_t layer_state_set_user(layer_state_t state) {
    state = update_tri_layer_state(state, _NAV, _NUM, _ADJUST);
    return state;
}

#ifdef OLED_ENABLE

#define ANIM_NUM_FRAMES 4
#define ANIM_FRAME_DURATION 100

#ifdef ANIM_REVERSE
#define ANIM_TOTAL_FRAMES (2*((ANIM_NUM_FRAMES)-1))
#else
#define ANIM_TOTAL_FRAMES ANIM_NUM_FRAMES
#endif

uint16_t anim_timer = 0;
uint8_t current_anim_frame = 0;

oled_rotation_t oled_init_user(oled_rotation_t rotation) {
    return OLED_ROTATION_180;
}

void render_default_layer_state(void) {
    oled_write_P(PSTR("Layout: "), false);
    switch (get_highest_layer(default_layer_state)) {
        case _QWERTY:
            if(woke_mode) {
                oled_write_ln_P(PSTR("QwErTy"), false);
            } else {
                oled_write_ln_P(PSTR("Qwerty"), false);
            }
            break;
        case _COLMAK:
            oled_write_ln_P(PSTR("Colemak"), false);
            break;
    }
}

#ifdef RGBLIGHT_ENABLE
bool cleared = false;
void render_rgb_state(void) {
    if(!rgblight_get_mode()) {
        if(!cleared) {
            oled_clear();
            cleared = true;
        }
        return;
    }
    cleared = false;
    uint8_t width = (OLED_DISPLAY_WIDTH/OLED_FONT_WIDTH)-10;
    uint8_t hue = (rgblight_get_hue()*width/255),
        sat = (rgblight_get_sat()*width/255),
        val = (rgblight_get_val()*width/255);
    bool changing_hue = timer_elapsed(rgb_edit_timer) < 1000 && (last_rgb_char == RGB_HUI || last_rgb_char == RGB_HUD);
    bool changing_sat =  timer_elapsed(rgb_edit_timer) < 1000 && (last_rgb_char == RGB_SAI || last_rgb_char == RGB_SAD);
    bool changing_val =  timer_elapsed(rgb_edit_timer) < 1000 && (last_rgb_char == RGB_VAI || last_rgb_char == RGB_VAD);

    uint8_t i;

    oled_write_ln_P(PSTR(""), false);

    oled_write_P(PSTR("Hue:    ["), changing_hue);
    for(i = 0; i < width; ++i) {
        oled_write_P(i<hue?PSTR("-"):i==hue?PSTR("|"):PSTR(" "), changing_hue);
    }
    oled_write_P(PSTR("]"), changing_hue);
    oled_write_P(PSTR("Sat:    ["), changing_sat);
    for(i = 0; i < width; ++i) {
        oled_write_P(i<sat?PSTR("-"):i==sat?PSTR("|"):PSTR(" "), changing_sat);
    }
    oled_write_P(PSTR("]"), changing_sat);
    oled_write_P(PSTR("Bri:    ["), changing_val);
    for(i = 0; i < width; ++i) {
        oled_write_P(i<val?PSTR("-"):i==val?PSTR("|"):PSTR(" "), changing_val);
    }
    oled_write_P(PSTR("]"), changing_val);
}
#endif // RGBLIGHT_ENABLE

void render_layer_state(void) {
    oled_write_P(PSTR("Layer:  "), false);
    switch (get_highest_layer(layer_state)) {
        case _QWERTY:
            oled_write_ln_P(PSTR("Base"), false);
            break;
        case _NAV:
            oled_write_ln_P(PSTR("Navigation"), false);
            break;
        case _NUM:
            oled_write_ln_P(PSTR("Number"), false);
            break;
        case _SYM:
            oled_write_ln_P(PSTR("Symbol"), false);
            break;
        case _MISC:
            oled_write_ln_P(PSTR("Misc"), false);
            break;
        case _ADJUST:
            oled_write_ln_P(PSTR("Adjust"), false);
            break;
        default:
            oled_write_ln_P(PSTR("Unknown"), false);
    }
}

void render_keylock_status(led_t led_state) {
    oled_write_P(PSTR("Lock:   "), false);
    oled_write_P(PSTR("123"), led_state.num_lock);
    oled_write_P(PSTR(" "), false);
    oled_write_ln_P(led_state.caps_lock?PSTR("ABC"):PSTR("abc"), led_state.caps_lock);
}

void render_mod_status(uint8_t modifiers) {
    oled_write_P(PSTR("Mods:   "), false);
    oled_write_P(PSTR("S"), (modifiers & MOD_MASK_SHIFT));
    oled_write_P(PSTR(" "), false);
    oled_write_P(PSTR("C"), (modifiers & MOD_MASK_CTRL));
    oled_write_P(PSTR(" "), false);
    oled_write_P(PSTR("A"), (modifiers & MOD_MASK_ALT));
    oled_write_P(PSTR(" "), false);
    oled_write_ln_P(PSTR("W"), (modifiers & MOD_MASK_GUI));
}

static void render_status(void) {
    // Host Keyboard Layer Status
    render_default_layer_state();
    render_layer_state();
    render_keylock_status(host_keyboard_led_state());
    render_mod_status(get_mods() | get_oneshot_mods());
#ifdef RGBLIGHT_ENABLE
    render_rgb_state();
#endif // RGBLIGHT_ENABLE
}

static void render_logo(void) {
    static const char PROGMEM frame[ANIM_NUM_FRAMES][1024] = {
        {
            // leekspin: frame 0
            0xff, 0xbf, 0xfb, 0x6f, 0xff, 0xdb, 0x7f, 0xf7, 0xde, 0x7c, 0xf1, 0xc6, 0x98, 0x21, 0x66, 0x9a,
            0xc9, 0x24, 0x33, 0xcf, 0x2f, 0xfd, 0xff, 0x6b, 0x7f, 0x9d, 0x81, 0x76, 0x14, 0x81, 0x67, 0x0f,
            0xfb, 0xff, 0xef, 0xbb, 0xff, 0xef, 0xbb, 0xff, 0xef, 0xbb, 0xff, 0xef, 0xbb, 0xff, 0xef, 0xbb,
            0xff, 0x6f, 0xfb, 0xdf, 0x77, 0xff, 0x0d, 0xe0, 0x3f, 0xc0, 0x0d, 0x37, 0xd0, 0x26, 0xa9, 0xd8,
            0xc7, 0x1d, 0xf0, 0xff, 0xff, 0xf0, 0xc7, 0xb1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xf1, 0xc6,
            0xff, 0xf7, 0xf8, 0xf3, 0xcf, 0x90, 0xf7, 0xfc, 0xe3, 0x9b, 0x2e, 0xe2, 0xfc, 0x03, 0xfc, 0x7c,
            0x83, 0x1b, 0x6c, 0xa5, 0xb3, 0x4e, 0x59, 0x64, 0x13, 0xdb, 0xae, 0x20, 0xdf, 0xff, 0xbb, 0xef,
            0xff, 0xbb, 0xef, 0xdf, 0x7b, 0xef, 0xbf, 0xfb, 0x6f, 0xff, 0xdb, 0x7f, 0xf7, 0xdf, 0x7b, 0xef,
            0xff, 0xff, 0xdd, 0x77, 0xff, 0xdd, 0x77, 0xff, 0xdd, 0x77, 0xff, 0xdd, 0x77, 0xfe, 0xdc, 0xf1,
            0xcc, 0x23, 0x99, 0x64, 0x26, 0x98, 0x63, 0x0f, 0x30, 0xcc, 0x33, 0x24, 0xcd, 0x19, 0xe0, 0xff,
            0xff, 0xde, 0x7b, 0xef, 0xbe, 0xfb, 0xef, 0xbe, 0xfb, 0x6f, 0xfe, 0xdb, 0x7f, 0xf6, 0xdf, 0xfd,
            0xb7, 0xff, 0x6d, 0xff, 0xdb, 0xff, 0x00, 0xbd, 0x67, 0x48, 0x13, 0xfc, 0x85, 0xff, 0x5f, 0x3f,
            0xb7, 0x97, 0xcf, 0xcb, 0xeb, 0xcf, 0x97, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
            0xef, 0x9f, 0xd7, 0xcf, 0xcb, 0xdf, 0xd7, 0xcf, 0x8f, 0x3f, 0x1f, 0x7f, 0xff, 0xfe, 0xff, 0xf2,
            0x07, 0xe9, 0x3e, 0x00, 0x35, 0xef, 0xc9, 0x1b, 0xc2, 0xbc, 0x37, 0xc0, 0xff, 0xbf, 0xfb, 0x6e,
            0xef, 0xfb, 0xde, 0xf7, 0xb7, 0xfd, 0xef, 0xbd, 0xf7, 0x77, 0xdd, 0xff, 0xb7, 0xfd, 0xef, 0xbb,
            0xff, 0xff, 0xdd, 0xf7, 0x7f, 0xdd, 0xf7, 0x7f, 0xdd, 0xf7, 0x7f, 0xdd, 0xf7, 0xbf, 0xed, 0xff,
            0xdf, 0xf7, 0xf6, 0x7c, 0xf9, 0xb1, 0xe6, 0xcb, 0x18, 0xa4, 0xb3, 0x09, 0xfc, 0xff, 0xfb, 0x6f,
            0xfe, 0xdf, 0xfb, 0xbf, 0xf7, 0x7e, 0xef, 0xfd, 0xb7, 0xff, 0x6d, 0xff, 0xdb, 0xff, 0xb6, 0xff,
            0x6d, 0xff, 0xdb, 0x7f, 0xf6, 0xdf, 0xf9, 0x21, 0x8e, 0xfb, 0x00, 0x7e, 0xc0, 0xff, 0xfe, 0xff,
            0xf7, 0xff, 0xff, 0xff, 0x3f, 0x3f, 0x7f, 0x7f, 0x3f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
            0x3f, 0x7f, 0x7f, 0x3f, 0x3f, 0x7f, 0x37, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xef, 0x3f, 0xc0,
            0x6e, 0x3b, 0x09, 0xe0, 0x6f, 0x1a, 0x92, 0x64, 0x6d, 0x99, 0xf2, 0x7f, 0xef, 0xfd, 0xb7, 0xff,
            0x7b, 0xde, 0xf7, 0xbf, 0xfb, 0x7e, 0xef, 0xbf, 0xff, 0xfb, 0xef, 0xbe, 0xfb, 0x6f, 0xfe, 0xdb,
            0xff, 0xff, 0xfe, 0xf7, 0xbf, 0xfb, 0xff, 0xbf, 0xef, 0xfd, 0xdf, 0xf7, 0x7d, 0xff, 0xee, 0x7f,
            0xf7, 0xbd, 0xff, 0xef, 0xfb, 0xbf, 0xfd, 0x77, 0xfe, 0xa0, 0xf9, 0xfe, 0xf0, 0xef, 0xbf, 0xf7,
            0x7f, 0xfb, 0xde, 0xff, 0xbb, 0xff, 0xf7, 0xbe, 0xfb, 0xdf, 0xff, 0xfd, 0xb7, 0xfe, 0xef, 0x7f,
            0xfb, 0xbf, 0xed, 0xff, 0xf7, 0xbe, 0xfb, 0xdf, 0xf0, 0x06, 0x98, 0xe7, 0x3c, 0x03, 0xcf, 0x2f,
            0x1f, 0x9f, 0x7f, 0x7f, 0x7e, 0xf8, 0xf1, 0xe6, 0xf8, 0xc9, 0xca, 0xfa, 0xc8, 0xda, 0xf2, 0xcc,
            0xd9, 0xf2, 0xe0, 0xed, 0xf1, 0xfa, 0xfc, 0x7f, 0x7f, 0x3f, 0xbf, 0x9f, 0x0f, 0xe3, 0x34, 0x8d,
            0xe3, 0x18, 0x17, 0x85, 0xa0, 0x38, 0xcf, 0x13, 0xf8, 0xef, 0xdd, 0x7f, 0xff, 0xf7, 0xfd, 0xef,
            0xbb, 0xff, 0x7f, 0xf7, 0xfd, 0xef, 0xbf, 0xfb, 0xee, 0xff, 0xff, 0xbb, 0xef, 0x7f, 0xfb, 0xee,
            0xff, 0xff, 0xde, 0xf7, 0xff, 0xef, 0xbd, 0xff, 0xdb, 0xff, 0xfe, 0x77, 0x7f, 0xf7, 0xfd, 0x7f,
            0xf7, 0xff, 0xdb, 0x7e, 0xff, 0xef, 0xfb, 0xff, 0xb7, 0xff, 0xc8, 0xff, 0xff, 0xff, 0xfc, 0x27,
            0xff, 0xff, 0xff, 0xed, 0xbf, 0xfe, 0xf7, 0x7f, 0xfb, 0xdf, 0xfe, 0xf7, 0xdf, 0xff, 0xfd, 0x6f,
            0xff, 0xbf, 0xfb, 0xff, 0xde, 0xff, 0xf7, 0xfd, 0xbf, 0x00, 0x77, 0x6c, 0x89, 0x11, 0x04, 0xa2,
            0x08, 0x69, 0x46, 0x90, 0x02, 0x64, 0x94, 0x24, 0x09, 0x91, 0x85, 0x21, 0x09, 0xff, 0xf7, 0xdd,
            0x3d, 0x37, 0x1d, 0x1d, 0x06, 0xc6, 0x07, 0x10, 0x20, 0x83, 0x84, 0x30, 0x66, 0x19, 0x92, 0x06,
            0x40, 0x31, 0x0c, 0xc0, 0x14, 0xb7, 0x09, 0xfa, 0xff, 0xdf, 0xfb, 0xbf, 0xfd, 0xf7, 0xef, 0xef,
            0xff, 0xdf, 0xf7, 0xff, 0x6e, 0xff, 0xff, 0xde, 0xf7, 0xff, 0x7e, 0xdb, 0xff, 0xb7, 0xff, 0xee,
            0xff, 0xff, 0x7f, 0xf6, 0xdf, 0xfd, 0xff, 0xff, 0xef, 0xbb, 0xfe, 0x7f, 0xf7, 0xdf, 0xff, 0xf7,
            0xdd, 0xff, 0xff, 0xbf, 0xed, 0xff, 0xfe, 0xef, 0x3f, 0xde, 0xee, 0xc9, 0xff, 0xff, 0xdf, 0xff,
            0xc9, 0xff, 0x9e, 0xdf, 0xdf, 0xb7, 0xfd, 0xff, 0xef, 0xff, 0xfb, 0xef, 0xfd, 0xbf, 0xf7, 0xff,
            0xbb, 0xef, 0xff, 0xfd, 0xff, 0xef, 0x7e, 0xff, 0xb1, 0x06, 0x7b, 0xc9, 0x00, 0x42, 0x98, 0x31,
            0x46, 0x44, 0x38, 0x89, 0xc4, 0x30, 0x00, 0x42, 0x10, 0x84, 0x20, 0x08, 0x81, 0x03, 0x10, 0x80,
            0x24, 0x00, 0x88, 0x21, 0x04, 0xc0, 0x08, 0xa1, 0x34, 0x4c, 0x03, 0x90, 0x46, 0x00, 0x30, 0xd1,
            0x04, 0x69, 0x88, 0x30, 0x22, 0xcb, 0x04, 0x3f, 0xfb, 0xff, 0xfd, 0x6f, 0xfe, 0xf7, 0xbf, 0xfe,
            0xdb, 0xff, 0xee, 0x7f, 0xf7, 0xbf, 0xfd, 0xef, 0x7e, 0xf7, 0xff, 0xdb, 0xff, 0xb7, 0xfe, 0x7b,
            0xff, 0xff, 0xff, 0xbb, 0xef, 0xff, 0xf6, 0xff, 0xbf, 0xef, 0xff, 0xdf, 0xfd, 0x7f, 0xfe, 0xbf,
            0xef, 0xfe, 0xff, 0xdf, 0xff, 0xfe, 0xff, 0xe4, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
            0xff, 0xff, 0xfe, 0xfb, 0x37, 0xfd, 0xfe, 0xff, 0xff, 0x6f, 0xff, 0xf6, 0xff, 0xbf, 0xfb, 0xdf,
            0xff, 0xff, 0x77, 0x7f, 0x9d, 0x9f, 0x27, 0x21, 0xcc, 0x18, 0x63, 0x84, 0x80, 0x2a, 0x29, 0x44,
            0x59, 0x43, 0x94, 0x34, 0x42, 0x49, 0x2c, 0x92, 0x92, 0x64, 0x0c, 0x80, 0xb8, 0x22, 0x86, 0x34,
            0x48, 0x23, 0x34, 0x44, 0xc9, 0x18, 0x46, 0x09, 0x80, 0x72, 0x08, 0x61, 0x80, 0x9b, 0x12, 0x64,
            0x8d, 0x90, 0x23, 0xa8, 0x26, 0x44, 0x59, 0x89, 0x24, 0xd3, 0x1f, 0xff, 0xfd, 0xef, 0xff, 0x7d,
            0xef, 0xfe, 0xf7, 0xbf, 0xfb, 0xdf, 0x7d, 0xff, 0xf7, 0xbf, 0xfe, 0xdb, 0x7f, 0xfd, 0xff, 0xcf,
            0xff, 0xff, 0xfb, 0xff, 0x7f, 0xff, 0xb6, 0xff, 0xff, 0xff, 0xfd, 0xb7, 0xff, 0xfb, 0xbf, 0xff,
            0xef, 0xfb, 0x7e, 0xdf, 0xff, 0xf6, 0xff, 0xdf, 0xff, 0xed, 0xfb, 0xff, 0xef, 0x2f, 0xef, 0xef,
            0xf7, 0xf7, 0x9f, 0xfb, 0xfc, 0xff, 0xf7, 0xdf, 0xbb, 0x7f, 0xff, 0xef, 0xfe, 0xf7, 0x1f, 0x07,
            0xd1, 0x19, 0x22, 0x66, 0x44, 0x98, 0x8b, 0x21, 0x64, 0x1a, 0x42, 0xd4, 0x14, 0x23, 0xa8, 0x4d,
            0x91, 0x92, 0x64, 0x25, 0x99, 0x44, 0x23, 0x88, 0x50, 0x96, 0xa3, 0x18, 0x44, 0x65, 0x99, 0x22,
            0x8a, 0x69, 0x25, 0x86, 0xd8, 0x1d, 0xb7, 0x9a, 0x9e, 0x30, 0x8b, 0xe2, 0xcc, 0xd9, 0xe1, 0xfc,
            0xee, 0xf8, 0xfe, 0xe1, 0xc9, 0x06, 0x98, 0x69, 0x22, 0x92, 0x4c, 0x23, 0xa7, 0x1f, 0x7d, 0xff,
            0xff, 0xbf, 0xef, 0xfb, 0xbe, 0xef, 0x7f, 0xfb, 0xfe, 0x77, 0xff, 0xbf, 0xef, 0xfd, 0xf7, 0xff,

        },
        {
            // leekspin: frame 1
            0xff, 0xbf, 0xfb, 0xcf, 0xff, 0xbb, 0xef, 0xff, 0xbb, 0xef, 0xff, 0xbb, 0xef, 0xff, 0xff, 0xdf,
            0x77, 0xff, 0xdb, 0xff, 0xb7, 0xff, 0xfb, 0x6f, 0xff, 0xff, 0xdd, 0xf7, 0xff, 0xff, 0xff, 0xbb,
            0xef, 0xff, 0xbb, 0xef, 0xff, 0xbb, 0xef, 0xff, 0xbb, 0xef, 0xff, 0xbb, 0x6f, 0xff, 0xbb, 0xef,
            0xff, 0xbb, 0xef, 0x7f, 0xdb, 0xff, 0x27, 0xd0, 0x5f, 0x60, 0x8d, 0x37, 0xe0, 0x8d, 0x31, 0xd8,
            0xc7, 0x1d, 0xf0, 0xff, 0xff, 0xf0, 0xcf, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xf9, 0xc1,
            0xff, 0xfe, 0xf9, 0xe7, 0xcc, 0x91, 0xf7, 0xfc, 0xe3, 0x99, 0x2e, 0xe2, 0xfc, 0x03, 0xfc, 0x7c,
            0x03, 0x3b, 0xec, 0x85, 0x33, 0x76, 0xcd, 0xa8, 0x23, 0x5b, 0xee, 0x20, 0x9f, 0xff, 0x7b, 0xef,
            0xbf, 0xfb, 0xef, 0xbf, 0xfb, 0xef, 0xbf, 0xfb, 0xef, 0xbf, 0xfb, 0x6f, 0xff, 0xdb, 0xff, 0xb7,
            0xff, 0xff, 0x76, 0xdf, 0xfd, 0x77, 0xde, 0xfb, 0xbf, 0xf6, 0xdf, 0xfd, 0xb7, 0xff, 0x6d, 0xff,
            0xfe, 0xfb, 0xdf, 0xf6, 0xbf, 0xed, 0xff, 0xef, 0xbf, 0xf6, 0xff, 0xef, 0xfb, 0xbf, 0xee, 0xfb,
            0xbf, 0xee, 0xfb, 0xbf, 0xee, 0xfb, 0xbf, 0xee, 0xfb, 0xbf,