logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

v1.c (21595B)


  1. // Copyright 2023 Andrian (@PoringH)
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include QMK_KEYBOARD_H
  4. enum { MAIN = 0, SECOND = 1, THIRD = 2, FOURTH = 3 };
  5. #ifdef ENCODER_ENABLE
  6. bool encoder_update_kb(uint8_t index, bool clockwise) {
  7. if (!encoder_update_user(index, clockwise)) {
  8. return false;
  9. }
  10. switch (get_highest_layer(layer_state)) {
  11. default:
  12. if (clockwise) {
  13. tap_code(KC_VOLU);
  14. } else {
  15. tap_code(KC_VOLD);
  16. }
  17. case SECOND:
  18. if (clockwise) {
  19. tap_code(KC_MNXT);
  20. } else {
  21. tap_code(KC_MPRV);
  22. }
  23. break;
  24. case THIRD:
  25. if (clockwise) {
  26. tap_code(KC_MS_R);
  27. } else {
  28. tap_code(KC_MS_L);
  29. }
  30. break;
  31. case FOURTH:
  32. if (clockwise) {
  33. tap_code(KC_MS_U);
  34. } else {
  35. tap_code(KC_MS_D);
  36. }
  37. break;
  38. }
  39. return true;
  40. }
  41. #endif
  42. #ifdef OLED_ENABLE
  43. # define KB_STAT_SIZE 18
  44. # define WIN_STAT_SIZE 12
  45. # define MIN_WALK_SPEED 10
  46. # define MIN_RUN_SPEED 40
  47. # define ANIM_FRAME_DURATION 200
  48. # define ANIM_SIZE 96
  49. uint32_t anim_timer = 0;
  50. uint8_t current_frame = 0;
  51. int current_wpm = 0;
  52. led_t led_usb_state;
  53. bool isguiDisabled = false;
  54. bool isSneaking = false;
  55. bool isJumping = false;
  56. bool showedJump = true;
  57. # ifdef OLED_ENABLE
  58. static void render_animation(int ANIM_X, int ANIM_Y) {
  59. // sit animation 32 X 22
  60. static const char PROGMEM sit[2][3][ANIM_SIZE] = {{
  61. {
  62. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1c, 0x02, 0x05, 0x02, 0x24, 0x04, 0x04, 0x02, 0xa9, 0x1e, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  63. },
  64. {
  65. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x08, 0x68, 0x10, 0x08, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x82, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  66. },
  67. {
  68. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0c, 0x10, 0x10, 0x20, 0x20, 0x20, 0x28, 0x3e, 0x1c, 0x20, 0x20, 0x3e, 0x0f, 0x11, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  69. },
  70. },
  71. {{
  72. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1c, 0x02, 0x05, 0x02, 0x24, 0x04, 0x04, 0x02, 0xa9, 0x1e, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  73. },
  74. {0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x90, 0x08, 0x18, 0x60, 0x10, 0x08, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0e, 0x82, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
  75. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0c, 0x10, 0x10, 0x20, 0x20, 0x20, 0x28, 0x3e, 0x1c, 0x20, 0x20, 0x3e, 0x0f, 0x11, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
  76. }};
  77. // walk animation 32 X 22
  78. static const char PROGMEM walk[2][3][ANIM_SIZE] = {{{
  79. 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x90, 0x90, 0x90, 0xa0, 0xc0, 0x80, 0x80, 0x80, 0x70, 0x08, 0x14, 0x08, 0x90, 0x10, 0x10, 0x08, 0xa4, 0x78, 0x80, 0x00, 0x00, 0x00, 0x00,
  80. },
  81. {
  82. 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x18, 0xea, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00,
  83. },
  84. {
  85. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1c, 0x20, 0x20, 0x3c, 0x0f, 0x11, 0x1f, 0x03, 0x06, 0x18, 0x20, 0x20, 0x3c, 0x0c, 0x12, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  86. }},
  87. {{
  88. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x20, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x28, 0x10, 0x20, 0x20, 0x20, 0x10, 0x48, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
  89. },
  90. {
  91. 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x20, 0xf8, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x30, 0xd5, 0x20, 0x1f, 0x00, 0x00, 0x00, 0x00,
  92. },
  93. {
  94. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x20, 0x30, 0x0c, 0x02, 0x05, 0x09, 0x12, 0x1e, 0x02, 0x1c, 0x14, 0x08, 0x10, 0x20, 0x2c, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  95. }
  96. }};
  97. // run animation 32 X 22
  98. static const char PROGMEM run[2][3][ANIM_SIZE] = {{{
  99. 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x08, 0x08, 0xc8, 0xb0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x3c, 0x14, 0x04, 0x08, 0x90, 0x18, 0x04, 0x08, 0xb0, 0x40, 0x80, 0x00, 0x00,
  100. },
  101. {
  102. 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0xc4, 0xa4, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc8, 0x58, 0x28, 0x2a, 0x10, 0x0f, 0x00, 0x00,
  103. },
  104. {
  105. 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x09, 0x04, 0x04, 0x04, 0x04, 0x02, 0x03, 0x02, 0x01, 0x01, 0x02, 0x02, 0x04, 0x08, 0x10, 0x26, 0x2b, 0x32, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
  106. }},
  107. {{
  108. 0x00, 0x00, 0x00, 0xe0, 0x10, 0x10, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x78, 0x28, 0x08, 0x10, 0x20, 0x30, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00,
  109. },
  110. {
  111. 0x00, 0x00, 0x00, 0x03, 0x04, 0x08, 0x10, 0x11, 0xf9, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0xb0, 0x50, 0x55, 0x20, 0x1f, 0x00, 0x00,
  112. },
  113. {
  114. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0c, 0x10, 0x20, 0x28, 0x37, 0x02, 0x1e, 0x20, 0x20, 0x18, 0x0c, 0x14, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  115. }
  116. }};
  117. // bark animation 32 X 22
  118. static const char PROGMEM bark[2][3][ANIM_SIZE] = {{
  119. {
  120. 0x00, 0xc0, 0x20, 0x10, 0xd0, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, 0x3c, 0x14, 0x04, 0x08, 0x90, 0x18, 0x04, 0x08, 0xb0, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
  121. },
  122. {
  123. 0x00, 0x03, 0x04, 0x08, 0x10, 0x11, 0xf9, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc8, 0x48, 0x28, 0x2a, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
  124. },
  125. {
  126. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0c, 0x10, 0x20, 0x28, 0x37, 0x02, 0x02, 0x04, 0x08, 0x10, 0x26, 0x2b, 0x32, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  127. },
  128. },
  129. {{
  130. 0x00, 0xe0, 0x10, 0x10, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x40, 0x40, 0x2c, 0x14, 0x04, 0x08, 0x90, 0x18, 0x04, 0x08, 0xb0, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00,
  131. },
  132. {
  133. 0x00, 0x03, 0x04, 0x08, 0x10, 0x11, 0xf9, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x48, 0x28, 0x2a, 0x10, 0x0f, 0x20, 0x4a, 0x09, 0x10,
  134. },
  135. {
  136. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x0c, 0x10, 0x20, 0x28, 0x37, 0x02, 0x02, 0x04, 0x08, 0x10, 0x26, 0x2b, 0x32, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  137. }
  138. }};
  139. // sneak animation 32 X 22
  140. static const char PROGMEM sneak[2][3][ANIM_SIZE] = {{
  141. {
  142. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x40, 0x80, 0x00, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  143. },
  144. {
  145. 0x00, 0x00, 0x00, 0x00, 0x1e, 0x21, 0xf0, 0x04, 0x02, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, 0x04, 0x04, 0x04, 0x03, 0x01, 0x00, 0x00, 0x09, 0x01, 0x80, 0x80, 0xab, 0x04, 0xf8, 0x00, 0x00, 0x00,
  146. },
  147. {
  148. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1c, 0x20, 0x20, 0x3c, 0x0f, 0x11, 0x1f, 0x02, 0x06, 0x18, 0x20, 0x20, 0x38, 0x08, 0x10, 0x18, 0x04, 0x04, 0x02, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00,
  149. },
  150. },
  151. {{
  152. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xa0, 0x20, 0x40, 0x80, 0xc0, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
  153. },
  154. {
  155. 0x00, 0x00, 0x00, 0x00, 0x3e, 0x41, 0xf0, 0x04, 0x02, 0x02, 0x02, 0x03, 0x02, 0x02, 0x02, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x40, 0x40, 0x55, 0x82, 0x7c, 0x00, 0x00, 0x00,
  156. },
  157. {
  158. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x20, 0x30, 0x0c, 0x02, 0x05, 0x09, 0x12, 0x1e, 0x04, 0x18, 0x10, 0x08, 0x10, 0x20, 0x28, 0x34, 0x06, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
  159. }
  160. }};
  161. void animate_luna(void) {
  162. int anim_x;
  163. int anim_y;
  164. if (isJumping || !showedJump) {
  165. oled_set_cursor(ANIM_X, ANIM_Y + 2);
  166. oled_write(" ", false);
  167. anim_x = ANIM_X;
  168. anim_y = ANIM_Y - 1;
  169. showedJump = true;
  170. } else {
  171. oled_set_cursor(ANIM_X, ANIM_Y - 1);
  172. oled_write(" ", false);
  173. anim_x = ANIM_X;
  174. anim_y = ANIM_Y;
  175. }
  176. if (led_usb_state.caps_lock) {
  177. oled_set_cursor(anim_x, anim_y);
  178. oled_write_raw_P(bark[current_frame][0], ANIM_SIZE);
  179. oled_set_cursor(anim_x, anim_y + 1);
  180. oled_write_raw_P(bark[current_frame][1], ANIM_SIZE);
  181. oled_set_cursor(anim_x, anim_y + 2);
  182. oled_write_raw_P(bark[current_frame][2], ANIM_SIZE);
  183. } else if (get_mods() & MOD_MASK_CS) {
  184. oled_set_cursor(anim_x, anim_y);
  185. oled_write_raw_P(sneak[current_frame][0], ANIM_SIZE);
  186. oled_set_cursor(anim_x, anim_y + 1);
  187. oled_write_raw_P(sneak[current_frame][1], ANIM_SIZE);
  188. oled_set_cursor(anim_x, anim_y + 2);
  189. oled_write_raw_P(sneak[current_frame][2], ANIM_SIZE);
  190. } else if (current_wpm <= MIN_WALK_SPEED) {
  191. oled_set_cursor(anim_x, anim_y);
  192. oled_write_raw_P(sit[current_frame][0], ANIM_SIZE);
  193. oled_set_cursor(anim_x, anim_y + 1);
  194. oled_write_raw_P(sit[current_frame][1], ANIM_SIZE);
  195. oled_set_cursor(anim_x, anim_y + 2);
  196. oled_write_raw_P(sit[current_frame][2], ANIM_SIZE);
  197. } else if (current_wpm <= MIN_RUN_SPEED) {
  198. oled_set_cursor(anim_x, anim_y);
  199. oled_write_raw_P(walk[current_frame][0], ANIM_SIZE);
  200. oled_set_cursor(anim_x, anim_y + 1);
  201. oled_write_raw_P(walk[current_frame][1], ANIM_SIZE);
  202. oled_set_cursor(anim_x, anim_y + 2);
  203. oled_write_raw_P(walk[current_frame][2], ANIM_SIZE);
  204. } else {
  205. oled_set_cursor(anim_x, anim_y);
  206. oled_write_raw_P(run[current_frame][0], ANIM_SIZE);
  207. oled_set_cursor(anim_x, anim_y + 1);
  208. oled_write_raw_P(run[current_frame][1], ANIM_SIZE);
  209. oled_set_cursor(anim_x, anim_y + 2);
  210. oled_write_raw_P(run[current_frame][2], ANIM_SIZE);
  211. }
  212. }
  213. # if OLED_TIMEOUT > 0
  214. if (last_input_activity_elapsed() > OLED_TIMEOUT && last_led_activity_elapsed() > OLED_TIMEOUT) {
  215. oled_off();
  216. return;
  217. } else {
  218. oled_on();
  219. }
  220. # endif
  221. if (timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) {
  222. anim_timer = timer_read32();
  223. current_frame = (current_frame + 1) % 2;
  224. animate_luna();
  225. }
  226. };
  227. static void render_caps(int CAP_X, int CAP_Y) {
  228. if (led_usb_state.caps_lock == true) {
  229. static const char PROGMEM caps[KB_STAT_SIZE] = {
  230. 0x00, 0xfe, 0xff, 0x07, 0xfb, 0xfb, 0x3b, 0xdb, 0xeb, 0xdb, 0x3b, 0xfb, 0xfb, 0x07, 0xff, 0xfe, 0x00, 0x00,
  231. };
  232. static const char PROGMEM caps2[KB_STAT_SIZE] = {0x00, 0x3f, 0x7f, 0x70, 0x6f, 0x6f, 0x68, 0x6e, 0x6e, 0x6e, 0x68, 0x6f, 0x6f, 0x70, 0x7f, 0x3f, 0x00, 0x00};
  233. oled_set_cursor(CAP_X, CAP_Y);
  234. oled_write_raw_P(caps, KB_STAT_SIZE);
  235. oled_set_cursor(CAP_X, CAP_Y + 1);
  236. oled_write_raw_P(caps2, KB_STAT_SIZE);
  237. } else {
  238. static const char PROGMEM caps[KB_STAT_SIZE] = {
  239. 0x00, 0x00, 0x00, 0xf8, 0x04, 0x04, 0xc4, 0x24, 0x14, 0x24, 0xc4, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00,
  240. };
  241. static const char PROGMEM caps2[KB_STAT_SIZE] = {0x00, 0x00, 0x00, 0x0f, 0x10, 0x10, 0x17, 0x11, 0x11, 0x11, 0x17, 0x10, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00};
  242. oled_set_cursor(CAP_X, CAP_Y);
  243. oled_write_raw_P(caps, KB_STAT_SIZE);
  244. oled_set_cursor(CAP_X, CAP_Y + 1);
  245. oled_write_raw_P(caps2, KB_STAT_SIZE);
  246. }
  247. }
  248. static void render_num(int NUM_X, int NUM_Y) {
  249. if (led_usb_state.num_lock == true) {
  250. static const char PROGMEM num[KB_STAT_SIZE] = {
  251. 0x00, 0xfe, 0xff, 0x07, 0xfb, 0xfb, 0xfb, 0xdb, 0x0b, 0xfb, 0xfb, 0xfb, 0xfb, 0x07, 0xff, 0xfe, 0x00, 0x00,
  252. };
  253. static const char PROGMEM num2[KB_STAT_SIZE] = {0x00, 0x3f, 0x7f, 0x70, 0x6f, 0x6f, 0x6f, 0x6b, 0x68, 0x6b, 0x6f, 0x6f, 0x6f, 0x70, 0x7f, 0x3f, 0x00, 0x00};
  254. oled_set_cursor(NUM_X, NUM_Y);
  255. oled_write_raw_P(num, KB_STAT_SIZE);
  256. oled_set_cursor(NUM_X, NUM_Y + 1);
  257. oled_write_raw_P(num2, KB_STAT_SIZE);
  258. } else {
  259. static const char PROGMEM num[KB_STAT_SIZE] = {
  260. 0x00, 0x00, 0x00, 0xf8, 0x04, 0x04, 0x04, 0x24, 0xf4, 0x04, 0x04, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00,
  261. };
  262. static const char PROGMEM num2[KB_STAT_SIZE] = {0x00, 0x00, 0x00, 0x0f, 0x10, 0x10, 0x10, 0x14, 0x17, 0x14, 0x10, 0x10, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00};
  263. oled_set_cursor(NUM_X, NUM_Y);
  264. oled_write_raw_P(num, KB_STAT_SIZE);
  265. oled_set_cursor(NUM_X, NUM_Y + 1);
  266. oled_write_raw_P(num2, KB_STAT_SIZE);
  267. }
  268. }
  269. static void render_scroll(int SCROLL_X, int SCROLL_Y) {
  270. if (led_usb_state.scroll_lock == true) {
  271. static const char PROGMEM scroll[KB_STAT_SIZE] = {
  272. 0x00, 0xfe, 0xff, 0x07, 0xfb, 0xfb, 0x7b, 0xfb, 0x0b, 0xfb, 0x7b, 0xfb, 0xfb, 0x07, 0xff, 0xfe, 0x00, 0x00,
  273. };
  274. static const char PROGMEM scroll2[KB_STAT_SIZE] = {0x00, 0x3f, 0x7f, 0x70, 0x6f, 0x6b, 0x6b, 0x6a, 0x68, 0x6a, 0x6b, 0x6b, 0x6f, 0x70, 0x7f, 0x3f, 0x00, 0x00};
  275. oled_set_cursor(SCROLL_X, SCROLL_Y);
  276. oled_write_raw_P(scroll, KB_STAT_SIZE);
  277. oled_set_cursor(SCROLL_X, SCROLL_Y + 1);
  278. oled_write_raw_P(scroll2, KB_STAT_SIZE);
  279. } else {
  280. static const char PROGMEM scroll[KB_STAT_SIZE] = {
  281. 0x00, 0x00, 0x00, 0xf8, 0x04, 0x04, 0x84, 0x04, 0xf4, 0x04, 0x84, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00,
  282. };
  283. static const char PROGMEM scroll2[KB_STAT_SIZE] = {0x00, 0x00, 0x00, 0x0f, 0x10, 0x14, 0x14, 0x15, 0x17, 0x15, 0x14, 0x14, 0x10, 0x0f, 0x00, 0x00, 0x00, 0x00};
  284. oled_set_cursor(SCROLL_X, SCROLL_Y);
  285. oled_write_raw_P(scroll, KB_STAT_SIZE);
  286. oled_set_cursor(SCROLL_X, SCROLL_Y + 1);
  287. oled_write_raw_P(scroll2, KB_STAT_SIZE);
  288. }
  289. }
  290. static void render_winstat(int WIN_X, int WIN_Y) {
  291. static const char PROGMEM winlogo[WIN_STAT_SIZE] = {
  292. 0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, 0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00,
  293. };
  294. static const char PROGMEM winlogo2[WIN_STAT_SIZE] = {
  295. 0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00,
  296. };
  297. oled_set_cursor(WIN_X, WIN_Y);
  298. oled_write_raw_P(winlogo, WIN_STAT_SIZE);
  299. oled_set_cursor(WIN_X, WIN_Y + 1);
  300. oled_write_raw_P(winlogo2, WIN_STAT_SIZE);
  301. oled_set_cursor(WIN_X + 2, WIN_Y);
  302. oled_write("WINKEY", false);
  303. oled_set_cursor(WIN_X + 2, WIN_Y + 1);
  304. if (keymap_config.no_gui) {
  305. oled_write("DISABLED", false);
  306. } else {
  307. oled_write("ENABLED ", false);
  308. }
  309. }
  310. bool oled_task_kb(void) {
  311. if (!oled_task_user()) {
  312. return false;
  313. }
  314. current_wpm = get_current_wpm();
  315. led_usb_state = host_keyboard_led_state();
  316. render_animation(13, 3);
  317. oled_set_cursor(0, 0);
  318. // Host Keyboard Layer Status
  319. switch (get_highest_layer(layer_state)) {
  320. case MAIN:
  321. oled_write("MAIN ", false);
  322. break;
  323. case SECOND:
  324. oled_write("SECOND", false);
  325. break;
  326. case THIRD:
  327. oled_write("THIRD ", false);
  328. break;
  329. default:
  330. oled_write("FOURTH", false);
  331. }
  332. render_caps(0, 2);
  333. render_num(3, 2);
  334. render_scroll(6, 2);
  335. render_winstat(1, 5);
  336. oled_set_cursor(12, 0);
  337. oled_write("WPM: ", false);
  338. oled_write(get_u8_str(current_wpm, '0'), false);
  339. return false;
  340. }
  341. # endif
  342. bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
  343. switch (keycode) {
  344. case KC_SPC:
  345. if (record->event.pressed) {
  346. isJumping = true;
  347. showedJump = false;
  348. } else {
  349. isJumping = false;
  350. }
  351. break;
  352. }
  353. return process_record_user(keycode, record);
  354. }
  355. #endif