keymap.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. /* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include "drashna.h"
  17. enum crkbd_keycodes { RGBRST = NEW_SAFE_RANGE };
  18. /*
  19. * The `LAYOUT_crkbd_base` macro is a template to allow the use of identical
  20. * modifiers for the default layouts (eg QWERTY, Colemak, Dvorak, etc), so
  21. * that there is no need to set them up for each layout, and modify all of
  22. * them if I want to change them. This helps to keep consistency and ease
  23. * of use. K## is a placeholder to pass through the individual keycodes
  24. */
  25. #ifdef CONVERT_TO_PROTON_C
  26. # define MID_TMB ET_RAIS
  27. #else
  28. # define MID_TMB KC_ENT
  29. #endif
  30. // clang-format off
  31. #define LAYOUT_split_3x6_3_wrapper(...) LAYOUT_split_3x6_3(__VA_ARGS__)
  32. #define LAYOUT_split_3x6_3_base( \
  33. K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
  34. K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
  35. K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \
  36. ) \
  37. LAYOUT_split_3x6_3_wrapper( \
  38. KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \
  39. ALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \
  40. OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \
  41. OS_LGUI, KC_SPC, BK_LWER, DL_RAIS, MID_TMB, OS_RGUI \
  42. )
  43. #define LAYOUT_base_wrapper(...) LAYOUT_split_3x6_3_base(__VA_ARGS__)
  44. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  45. [_DEFAULT_LAYER_1] = LAYOUT_base_wrapper(
  46. _________________QWERTY_L1_________________, _________________QWERTY_R1_________________,
  47. _________________QWERTY_L2_________________, _________________QWERTY_R2_________________,
  48. _________________QWERTY_L3_________________, _________________QWERTY_R3_________________
  49. ),
  50. [_DEFAULT_LAYER_2] = LAYOUT_base_wrapper(
  51. ______________COLEMAK_MOD_DH_L1____________, ______________COLEMAK_MOD_DH_R1____________,
  52. ______________COLEMAK_MOD_DH_L2____________, ______________COLEMAK_MOD_DH_R2____________,
  53. ______________COLEMAK_MOD_DH_L3____________, ______________COLEMAK_MOD_DH_R3____________
  54. ),
  55. [_DEFAULT_LAYER_3] = LAYOUT_base_wrapper(
  56. _________________COLEMAK_L1________________, _________________COLEMAK_R1________________,
  57. _________________COLEMAK_L2________________, _________________COLEMAK_R2________________,
  58. _________________COLEMAK_L3________________, _________________COLEMAK_R3________________
  59. ),
  60. [_DEFAULT_LAYER_4] = LAYOUT_base_wrapper(
  61. _________________DVORAK_L1_________________, _________________DVORAK_R1_________________,
  62. _________________DVORAK_L2_________________, _________________DVORAK_R2_________________,
  63. _________________DVORAK_L3_________________, _________________DVORAK_R3_________________
  64. ),
  65. [_LOWER] = LAYOUT_split_3x6_3_wrapper(
  66. KC_F11, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_F11,
  67. KC_F12, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE,
  68. _______, _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______,
  69. _______, _______, _______, _______, _______, _______
  70. ),
  71. [_RAISE] = LAYOUT_split_3x6_3_wrapper( \
  72. _______, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______,
  73. _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS,
  74. _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______,
  75. _______, _______, _______, _______, _______, _______
  76. ),
  77. [_ADJUST] = LAYOUT_split_3x6_3_wrapper( \
  78. QK_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, QK_BOOT,
  79. VRSN, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EE_CLR,
  80. KEYLOCK, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, RGB_IDL,
  81. QK_RBT, KC_NUKE, _______, _______, TG_MODS, AUTO_CTN
  82. )
  83. };
  84. // clang-format on
  85. #ifdef OLED_ENABLE
  86. oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return OLED_ROTATION_270; }
  87. # ifdef CONVERT_TO_PROTON_C
  88. // WPM-responsive animation stuff here
  89. # define SLEEP_FRAMES 2
  90. # define SLEEP_SPEED 10 // below this wpm value your animation will idle
  91. # define WAKE_FRAMES 2 // uncomment if >1
  92. # define KAKI_FRAMES 3
  93. # define KAKI_SPEED 40 // above this wpm value typing animation to triggere
  94. # define RTOGI_FRAMES 2
  95. //#define LTOGI_FRAMES 2
  96. //#define ANIM_FRAME_DURATION 500 // how long each frame lasts in ms
  97. // #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing
  98. # define ANIM_SIZE 512 // number of bytes in array, minimize for adequate firmware size, max is 1024
  99. uint32_t anim_timer = 0;
  100. uint32_t anim_frame_duration = 500;
  101. uint8_t current_sleep_frame = 0;
  102. uint8_t current_wake_frame = 0; // uncomment if WAKE_FRAMES >1
  103. uint8_t current_kaki_frame = 0;
  104. #ifdef SWAP_HANDS_ENABLE
  105. uint8_t current_rtogi_frame = 0;
  106. #endif
  107. // uint8_t current_ltogi_frame = 0;
  108. // clang-format off
  109. void render_small_kitty(void) {
  110. // Images credit j-inc(/James Incandenza) and pixelbenny. Credit to obosob for initial animation approach.
  111. static const char PROGMEM sleep[SLEEP_FRAMES][ANIM_SIZE] = {{
  112. // 'sleep1', 32x32px
  113. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xa8, 0x48, 0xa8, 0x18, 0x08, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  114. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x80, 0x44, 0x84, 0x06, 0x05, 0x04, 0x80, 0x40, 0x20, 0x10, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  115. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x18, 0x04, 0x04, 0x02, 0x7a, 0x86, 0x01, 0x80, 0x80, 0x01, 0x03, 0x05, 0x07, 0x01, 0x00, 0x00, 0x80, 0x83, 0x45, 0xfa, 0x3c, 0xe0, 0x00, 0x00,
  116. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x33, 0x24, 0x28, 0x28, 0x29, 0x29, 0x29, 0x3a, 0x18, 0x1c, 0x39, 0x24, 0x24, 0x3a, 0x2d, 0x26, 0x31, 0x1f, 0x00,
  117. },
  118. {// 'sleep2', 32x32px
  119. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  120. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x3a, 0x2a, 0x26, 0x22, 0x80, 0xc0, 0x80, 0x00, 0x24, 0x34, 0x2c, 0xe4, 0x60, 0x10, 0x70, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  121. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x38, 0x04, 0x02, 0x02, 0x01, 0x79, 0x87, 0x01, 0x80, 0x81, 0x83, 0x05, 0x05, 0x03, 0x01, 0x00, 0x00, 0x80, 0x43, 0x05, 0xfa, 0x3c, 0xe0, 0x00, 0x00,
  122. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x33, 0x24, 0x28, 0x28, 0x28, 0x29, 0x29, 0x3a, 0x18, 0x1c, 0x39, 0x24, 0x24, 0x3a, 0x2d, 0x26, 0x31, 0x1f, 0x00
  123. }};
  124. static const char PROGMEM wake[WAKE_FRAMES][ANIM_SIZE] = {{
  125. // 'mati2', 32x32px
  126. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x08, 0x10, 0x60, 0x80, 0x00, 0x80, 0x60, 0x10, 0x08, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  127. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0x40, 0x40, 0x5c, 0x00, 0x01, 0x41, 0x01, 0x00, 0x5c, 0x40, 0x40, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  128. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x80, 0xe1, 0x12, 0x0a, 0x06, 0x00, 0x80, 0x00, 0x06, 0x0a, 0x12, 0xe1, 0x80, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  129. 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x11, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1c, 0x14, 0x14, 0x14, 0x08
  130. },
  131. {// 'mati3', 32x32px
  132. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x08, 0x10, 0x60, 0x80, 0x00, 0x80, 0x60, 0x10, 0x08, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  133. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x90, 0x12, 0x0a, 0x02, 0xf4, 0x09, 0x0d, 0xf1, 0x04, 0x02, 0x0a, 0x12, 0x90, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  134. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x80, 0xe1, 0x12, 0x0a, 0x06, 0x01, 0x81, 0x00, 0x06, 0x0a, 0x12, 0xe1, 0x80, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  135. 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x11, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1c, 0x14, 0x14, 0x14, 0x08
  136. }};
  137. static const char PROGMEM kaki[KAKI_FRAMES][ANIM_SIZE] = {{
  138. // 'jare2', 32x32px
  139. 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x40, 0x80, 0x80, 0x80, 0x00, 0xfc, 0x84, 0x08, 0x08, 0x10, 0x20, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  140. 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1e, 0x60, 0x80, 0x00, 0x00, 0x91, 0xa1, 0x80, 0x00, 0x00, 0x22, 0x84, 0x40, 0x50, 0x48, 0xc1, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  141. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x41, 0x82, 0xe2, 0x12, 0x0a, 0x06, 0x00, 0x80, 0x88, 0x4f, 0x02, 0x22, 0xe2, 0x9f, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  142. 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x14, 0x10, 0x10, 0x10, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1a, 0x0a, 0x0a, 0x04, 0x00
  143. },
  144. {
  145. // 'kaki1', 32x32px
  146. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  147. 0x00, 0x00, 0x06, 0x1a, 0x22, 0xc2, 0x04, 0x04, 0x04, 0x07, 0x00, 0xc0, 0x20, 0x10, 0x80, 0x80, 0x01, 0x01, 0x02, 0xfc, 0xfe, 0x02, 0x3c, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  148. 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x8d, 0x55, 0x50, 0x94, 0xf0, 0x10, 0x09, 0x08, 0x00, 0x80, 0x00, 0x06, 0x09, 0x1b, 0xee, 0x00, 0x00, 0x00, 0x00, 0x81, 0xfe, 0x00, 0x00, 0x00, 0x00,
  149. 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x19, 0x18, 0x1c, 0x14, 0x16, 0x15, 0x14, 0x14, 0x14, 0x14, 0x08
  150. },
  151. {// 'kaki2', 32x32px
  152. 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  153. 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x01, 0x02, 0x04, 0x04, 0x03, 0x80, 0x40, 0x40, 0x20, 0x00, 0x01, 0x02, 0x8c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  154. 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x8d, 0x55, 0x50, 0x94, 0xf0, 0x10, 0x0a, 0x0e, 0x1d, 0x95, 0x24, 0x24, 0x27, 0x13, 0xe1, 0x01, 0x01, 0x01, 0x01, 0x02, 0xfc, 0x00, 0x00, 0x00, 0x00,
  155. 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x19, 0x18, 0x1c, 0x14, 0x14, 0x17, 0x14, 0x14, 0x14, 0x14, 0x08,
  156. }};
  157. #ifdef SWAP_HANDS_ENABLE
  158. static const char PROGMEM rtogi[KAKI_FRAMES][ANIM_SIZE] = {{
  159. // 'rtogi1', 32x32px
  160. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0x0f, 0x90, 0x10, 0x20, 0xf0, 0xf8, 0xf8,
  161. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x48, 0x47, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x88, 0xc7, 0xc4, 0x62, 0x23, 0x11, 0x3f,
  162. 0x80, 0x40, 0x20, 0x10, 0x88, 0xcc, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x80, 0x80, 0xc0, 0xe1, 0xfe, 0xb8, 0x88, 0x0c, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  163. 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  164. },
  165. {// 'rtogi2', 32x32px
  166. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0x1f, 0xa0, 0x20, 0x40, 0x80, 0x00, 0xf0,
  167. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x48, 0x47, 0x88, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x28, 0x6b, 0x40, 0xa0, 0x99, 0x86, 0xff,
  168. 0x0f, 0x11, 0x22, 0x44, 0x48, 0x4c, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x80, 0x80, 0xc0, 0xe1, 0xfe, 0xb8, 0x88, 0x0c, 0x04, 0x06, 0x06, 0x06, 0x0e, 0x0e, 0x06, 0x01,
  169. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  170. }};
  171. #endif
  172. // assumes 1 frame prep stage
  173. #ifdef SWAP_HANDS_ENABLE
  174. extern bool swap_hands;
  175. #endif
  176. void animation_phase(void) {
  177. #ifdef SWAP_HANDS_ENABLE
  178. if (swap_hands) {
  179. anim_frame_duration = 300;
  180. current_rtogi_frame = (current_rtogi_frame + 1) % RTOGI_FRAMES;
  181. oled_write_raw_P(rtogi[abs((RTOGI_FRAMES - 1) - current_rtogi_frame)], ANIM_SIZE);
  182. } else
  183. #endif
  184. {
  185. if (get_current_wpm() <= SLEEP_SPEED) {
  186. anim_frame_duration = 500;
  187. current_sleep_frame = (current_sleep_frame + 1) % SLEEP_FRAMES;
  188. oled_write_raw_P(sleep[abs((SLEEP_FRAMES - 1) - current_sleep_frame)], ANIM_SIZE);
  189. }
  190. // if(get_current_wpm() >IDLE_SPEED && get_current_wpm() <TAP_SPEED){
  191. if (get_current_wpm() > SLEEP_SPEED) {
  192. anim_frame_duration = 800;
  193. current_wake_frame = (current_wake_frame + 1) % WAKE_FRAMES;
  194. oled_write_raw_P(wake[abs((WAKE_FRAMES - 1) - current_wake_frame)], ANIM_SIZE);
  195. // oled_write_raw_P(wake[0], ANIM_SIZE); // remove if IDLE_FRAMES >1
  196. }
  197. if (get_current_wpm() >= KAKI_SPEED) {
  198. anim_frame_duration = 500;
  199. current_kaki_frame = (current_kaki_frame + 1) % KAKI_FRAMES;
  200. oled_write_raw_P(kaki[abs((KAKI_FRAMES - 1) - current_kaki_frame)], ANIM_SIZE);
  201. }
  202. }
  203. }
  204. if (get_current_wpm() != 000) {
  205. // if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
  206. if (timer_elapsed32(anim_timer) > anim_frame_duration) {
  207. anim_timer = timer_read32();
  208. animation_phase();
  209. }
  210. } else {
  211. // if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
  212. if (timer_elapsed32(anim_timer) > anim_frame_duration) {
  213. anim_timer = timer_read32();
  214. animation_phase();
  215. }
  216. }
  217. }
  218. void oled_driver_render_logo_right(void) {
  219. render_small_kitty();
  220. oled_set_cursor(0, 4);
  221. render_default_layer_state();
  222. }
  223. # endif
  224. #endif
  225. #ifdef TAPPING_TERM_PER_KEY
  226. uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
  227. switch (keycode) {
  228. case ALT_T(KC_A):
  229. return TAPPING_TERM + 100;
  230. default:
  231. return TAPPING_TERM;
  232. }
  233. }
  234. #endif
  235. #ifdef RGB_MATRIX_ENABLE
  236. void check_default_layer(uint8_t mode, uint8_t type, uint8_t led_min, uint8_t led_max) {
  237. switch (get_highest_layer(default_layer_state)) {
  238. case _QWERTY:
  239. rgb_matrix_layer_helper(DEFAULT_LAYER_1_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max);
  240. break;
  241. case _COLEMAK_DH:
  242. rgb_matrix_layer_helper(DEFAULT_LAYER_2_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max);
  243. break;
  244. case _COLEMAK:
  245. rgb_matrix_layer_helper(DEFAULT_LAYER_3_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max);
  246. break;
  247. case _DVORAK:
  248. rgb_matrix_layer_helper(DEFAULT_LAYER_4_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max);
  249. break;
  250. }
  251. }
  252. bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
  253. if (userspace_config.rgb_layer_change) {
  254. switch (get_highest_layer(layer_state)) {
  255. case _GAMEPAD:
  256. rgb_matrix_layer_helper(HSV_ORANGE, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
  257. break;
  258. case _DIABLO:
  259. rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
  260. break;
  261. case _RAISE:
  262. rgb_matrix_layer_helper(HSV_YELLOW, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
  263. break;
  264. case _LOWER:
  265. rgb_matrix_layer_helper(HSV_GREEN, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
  266. break;
  267. case _ADJUST:
  268. rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
  269. break;
  270. default:
  271. {
  272. check_default_layer(0, LED_FLAG_UNDERGLOW, led_min, led_max);
  273. break;
  274. }
  275. }
  276. check_default_layer(0, LED_FLAG_MODIFIER, led_min, led_max);
  277. }
  278. return false;
  279. }
  280. #endif