keymap.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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 {
  18. RGBRST = USER_SAFE_RANGE,
  19. };
  20. /*
  21. * The `LAYOUT_crkbd_base` macro is a template to allow the use of identical
  22. * modifiers for the default layouts (eg QWERTY, Colemak, Dvorak, etc), so
  23. * that there is no need to set them up for each layout, and modify all of
  24. * them if I want to change them. This helps to keep consistency and ease
  25. * of use. K## is a placeholder to pass through the individual keycodes
  26. */
  27. #ifdef CONVERT_TO_PROTON_C
  28. # define MID_TMB ET_RAIS
  29. #else
  30. # define MID_TMB KC_ENT
  31. #endif
  32. // clang-format off
  33. #define LAYOUT_split_3x6_3_wrapper(...) LAYOUT_split_3x6_3(__VA_ARGS__)
  34. #define LAYOUT_split_3x6_3_base( \
  35. K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
  36. K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
  37. K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A \
  38. ) \
  39. LAYOUT_split_3x6_3_wrapper( \
  40. KC_ESC, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, KC_MINS, \
  41. ALT_T(KC_TAB), K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, RALT_T(K1B), \
  42. OS_LSFT, CTL_T(K21), K22, K23, K24, K25, K26, K27, K28, K29, RCTL_T(K2A), OS_RSFT, \
  43. OS_LGUI, KC_SPC, BK_LWER, DL_RAIS, MID_TMB, OS_RGUI \
  44. )
  45. #define LAYOUT_base_wrapper(...) LAYOUT_split_3x6_3_base(__VA_ARGS__)
  46. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  47. [_DEFAULT_LAYER_1] = LAYOUT_base_wrapper(
  48. _________________QWERTY_L1_________________, _________________QWERTY_R1_________________,
  49. _________________QWERTY_L2_________________, _________________QWERTY_R2_________________,
  50. _________________QWERTY_L3_________________, _________________QWERTY_R3_________________
  51. ),
  52. [_DEFAULT_LAYER_2] = LAYOUT_base_wrapper(
  53. ______________COLEMAK_MOD_DH_L1____________, ______________COLEMAK_MOD_DH_R1____________,
  54. ______________COLEMAK_MOD_DH_L2____________, ______________COLEMAK_MOD_DH_R2____________,
  55. ______________COLEMAK_MOD_DH_L3____________, ______________COLEMAK_MOD_DH_R3____________
  56. ),
  57. [_DEFAULT_LAYER_3] = LAYOUT_base_wrapper(
  58. _________________COLEMAK_L1________________, _________________COLEMAK_R1________________,
  59. _________________COLEMAK_L2________________, _________________COLEMAK_R2________________,
  60. _________________COLEMAK_L3________________, _________________COLEMAK_R3________________
  61. ),
  62. [_DEFAULT_LAYER_4] = LAYOUT_base_wrapper(
  63. _________________DVORAK_L1_________________, _________________DVORAK_R1_________________,
  64. _________________DVORAK_L2_________________, _________________DVORAK_R2_________________,
  65. _________________DVORAK_L3_________________, _________________DVORAK_R3_________________
  66. ),
  67. [_LOWER] = LAYOUT_split_3x6_3_wrapper(
  68. KC_F11, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_F11,
  69. KC_F12, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE,
  70. _______, _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______,
  71. _______, _______, _______, _______, _______, _______
  72. ),
  73. [_RAISE] = LAYOUT_split_3x6_3_wrapper(
  74. _______, _________________RAISE_L1__________________, _________________RAISE_R1__________________, _______,
  75. _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS,
  76. _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______,
  77. _______, _______, _______, _______, _______, _______
  78. ),
  79. [_ADJUST] = LAYOUT_split_3x6_3_wrapper(
  80. QK_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, QK_BOOT,
  81. VRSN, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EE_CLR,
  82. KEYLOCK, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, RGB_IDL,
  83. QK_RBT, KC_NUKE, _______, _______, TG_MODS, AUTO_CTN
  84. )
  85. };
  86. // clang-format on
  87. #ifdef OLED_ENABLE
  88. oled_rotation_t oled_init_keymap(oled_rotation_t rotation) {
  89. return OLED_ROTATION_270;
  90. }
  91. # ifdef CONVERT_TO_PROTON_C
  92. // WPM-responsive animation stuff here
  93. # define SLEEP_FRAMES 2
  94. # define SLEEP_SPEED 10 // below this wpm value your animation will idle
  95. # define WAKE_FRAMES 2 // uncomment if >1
  96. # define KAKI_FRAMES 3
  97. # define KAKI_SPEED 40 // above this wpm value typing animation to triggere
  98. # define RTOGI_FRAMES 2
  99. // #define LTOGI_FRAMES 2
  100. // #define ANIM_FRAME_DURATION 500 // how long each frame lasts in ms
  101. // #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing
  102. # define ANIM_SIZE 512 // number of bytes in array, minimize for adequate firmware size, max is 1024
  103. uint32_t anim_timer = 0;
  104. uint32_t anim_frame_duration = 500;
  105. uint8_t current_sleep_frame = 0;
  106. uint8_t current_wake_frame = 0; // uncomment if WAKE_FRAMES >1
  107. uint8_t current_kaki_frame = 0;
  108. # ifdef SWAP_HANDS_ENABLE
  109. uint8_t current_rtogi_frame = 0;
  110. # endif
  111. // uint8_t current_ltogi_frame = 0;
  112. // clang-format off
  113. void render_small_kitty(void) {
  114. // Images credit j-inc(/James Incandenza) and pixelbenny. Credit to obosob for initial animation approach.
  115. static const char PROGMEM sleep[SLEEP_FRAMES][ANIM_SIZE] = {{
  116. // 'sleep1', 32x32px
  117. 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,
  118. 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,
  119. 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,
  120. 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,
  121. },
  122. {// 'sleep2', 32x32px
  123. 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,
  124. 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,
  125. 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,
  126. 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
  127. }};
  128. static const char PROGMEM wake[WAKE_FRAMES][ANIM_SIZE] = {{
  129. // 'mati2', 32x32px
  130. 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,
  131. 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,
  132. 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,
  133. 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
  134. },
  135. {// 'mati3', 32x32px
  136. 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,
  137. 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,
  138. 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,
  139. 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
  140. }};
  141. static const char PROGMEM kaki[KAKI_FRAMES][ANIM_SIZE] = {{
  142. // 'jare2', 32x32px
  143. 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,
  144. 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,
  145. 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,
  146. 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
  147. },
  148. {
  149. // 'kaki1', 32x32px
  150. 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,
  151. 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,
  152. 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,
  153. 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
  154. },
  155. {// 'kaki2', 32x32px
  156. 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,
  157. 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,
  158. 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,
  159. 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,
  160. }};
  161. #ifdef SWAP_HANDS_ENABLE
  162. static const char PROGMEM rtogi[KAKI_FRAMES][ANIM_SIZE] = {{
  163. // 'rtogi1', 32x32px
  164. 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,
  165. 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,
  166. 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,
  167. 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
  168. },
  169. {// 'rtogi2', 32x32px
  170. 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,
  171. 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,
  172. 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,
  173. 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
  174. }};
  175. #endif
  176. // assumes 1 frame prep stage
  177. #ifdef SWAP_HANDS_ENABLE
  178. extern bool swap_hands;
  179. #endif
  180. void animation_phase(void) {
  181. #ifdef SWAP_HANDS_ENABLE
  182. if (swap_hands) {
  183. anim_frame_duration = 300;
  184. current_rtogi_frame = (current_rtogi_frame + 1) % RTOGI_FRAMES;
  185. oled_write_raw_P(rtogi[abs((RTOGI_FRAMES - 1) - current_rtogi_frame)], ANIM_SIZE);
  186. } else
  187. #endif
  188. {
  189. if (get_current_wpm() <= SLEEP_SPEED) {
  190. anim_frame_duration = 500;
  191. current_sleep_frame = (current_sleep_frame + 1) % SLEEP_FRAMES;
  192. oled_write_raw_P(sleep[abs((SLEEP_FRAMES - 1) - current_sleep_frame)], ANIM_SIZE);
  193. }
  194. // if(get_current_wpm() >IDLE_SPEED && get_current_wpm() <TAP_SPEED){
  195. if (get_current_wpm() > SLEEP_SPEED) {
  196. anim_frame_duration = 800;
  197. current_wake_frame = (current_wake_frame + 1) % WAKE_FRAMES;
  198. oled_write_raw_P(wake[abs((WAKE_FRAMES - 1) - current_wake_frame)], ANIM_SIZE);
  199. // oled_write_raw_P(wake[0], ANIM_SIZE); // remove if IDLE_FRAMES >1
  200. }
  201. if (get_current_wpm() >= KAKI_SPEED) {
  202. anim_frame_duration = 500;
  203. current_kaki_frame = (current_kaki_frame + 1) % KAKI_FRAMES;
  204. oled_write_raw_P(kaki[abs((KAKI_FRAMES - 1) - current_kaki_frame)], ANIM_SIZE);
  205. }
  206. }
  207. }
  208. if (get_current_wpm() != 000) {
  209. // if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
  210. if (timer_elapsed32(anim_timer) > anim_frame_duration) {
  211. anim_timer = timer_read32();
  212. animation_phase();
  213. }
  214. } else {
  215. // if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
  216. if (timer_elapsed32(anim_timer) > anim_frame_duration) {
  217. anim_timer = timer_read32();
  218. animation_phase();
  219. }
  220. }
  221. }
  222. void oled_driver_render_logo_right(void) {
  223. render_small_kitty();
  224. render_default_layer_state(0, 4);
  225. }
  226. # endif
  227. #endif
  228. #ifdef TAPPING_TERM_PER_KEY
  229. uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
  230. switch (keycode) {
  231. case ALT_T(KC_A):
  232. return TAPPING_TERM + 100;
  233. default:
  234. return TAPPING_TERM;
  235. }
  236. }
  237. #endif
  238. #ifdef RGB_MATRIX_ENABLE
  239. void check_default_layer(uint8_t mode, uint8_t type, uint8_t led_min, uint8_t led_max) {
  240. switch (get_highest_layer(default_layer_state)) {
  241. case _QWERTY:
  242. rgb_matrix_layer_helper(DEFAULT_LAYER_1_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max);
  243. break;
  244. case _COLEMAK_DH:
  245. rgb_matrix_layer_helper(DEFAULT_LAYER_2_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max);
  246. break;
  247. case _COLEMAK:
  248. rgb_matrix_layer_helper(DEFAULT_LAYER_3_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max);
  249. break;
  250. case _DVORAK:
  251. rgb_matrix_layer_helper(DEFAULT_LAYER_4_HSV, mode, rgb_matrix_config.speed, type, led_min, led_max);
  252. break;
  253. }
  254. }
  255. bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
  256. if (userspace_config.rgb_layer_change) {
  257. switch (get_highest_layer(layer_state)) {
  258. case _GAMEPAD:
  259. rgb_matrix_layer_helper(HSV_ORANGE, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
  260. break;
  261. case _DIABLO:
  262. rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
  263. break;
  264. case _RAISE:
  265. rgb_matrix_layer_helper(HSV_YELLOW, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
  266. break;
  267. case _LOWER:
  268. rgb_matrix_layer_helper(HSV_GREEN, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
  269. break;
  270. case _ADJUST:
  271. rgb_matrix_layer_helper(HSV_RED, 0, rgb_matrix_config.speed, LED_FLAG_UNDERGLOW, led_min, led_max);
  272. break;
  273. default:
  274. {
  275. check_default_layer(0, LED_FLAG_UNDERGLOW, led_min, led_max);
  276. break;
  277. }
  278. }
  279. check_default_layer(0, LED_FLAG_MODIFIER, led_min, led_max);
  280. }
  281. return false;
  282. }
  283. #endif