You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

392 lines
14 KiB

[Keymap] Cleanup and updating of drashna keymap code (#11516) * Update other keyboards for rgb matrix changes * Remove customized bootmagic code * Fix corne layout compilation error * Fix compiler errors with all keymaps * Add Simple Visualizer for ergodox infinity * Fix compile issue with Corne * Fix keymap stuff * Add alias for mouse layer * Add Halmak Keyboard layout * Updates for Kyria * Add support for oled interval * Change RGB stuff [CHANGE] Fix coexistence issues * Fix rgb_stuff * Add custom ploopyco mouse keymap * Decrease default dwell time * Updates based on last breaking changes update * Disable command on dactyl * Update ergodox to use proper commands for rgb matrix indicators * Update all rgb matrix indicator functions * Update rules for dactyl-manuform * Reduce wait time for mouse layer off event * Add more info to logger * Add wrappers for get_tapping term * Move version.h include into only file that actually needs it * Update rgb sleep stuff * Update key print function * Change DM keymap settings * Change pin for DM Manuform * Add Proton C stuff for Corne keymap * more arm corne tinkering * Even more arm stuff for corne * Cleanup corne stuff * redirect default keymap to drashna because I am a very bad man * change corne rgb priority * Update tractyl manuform to not conflict * Add more secret stuff * more dactyl tweaks * Add more options to split transport * Changes of oled support * Change split settings * Improve keylogger formatting more * tweak oled stuff * Oled and such tweaks * Reduce brightness due to leds * Decrease brightness more * Only run layer code if master
3 years ago
[Keymap] Cleanup and updating of drashna keymap code (#11516) * Update other keyboards for rgb matrix changes * Remove customized bootmagic code * Fix corne layout compilation error * Fix compiler errors with all keymaps * Add Simple Visualizer for ergodox infinity * Fix compile issue with Corne * Fix keymap stuff * Add alias for mouse layer * Add Halmak Keyboard layout * Updates for Kyria * Add support for oled interval * Change RGB stuff [CHANGE] Fix coexistence issues * Fix rgb_stuff * Add custom ploopyco mouse keymap * Decrease default dwell time * Updates based on last breaking changes update * Disable command on dactyl * Update ergodox to use proper commands for rgb matrix indicators * Update all rgb matrix indicator functions * Update rules for dactyl-manuform * Reduce wait time for mouse layer off event * Add more info to logger * Add wrappers for get_tapping term * Move version.h include into only file that actually needs it * Update rgb sleep stuff * Update key print function * Change DM keymap settings * Change pin for DM Manuform * Add Proton C stuff for Corne keymap * more arm corne tinkering * Even more arm stuff for corne * Cleanup corne stuff * redirect default keymap to drashna because I am a very bad man * change corne rgb priority * Update tractyl manuform to not conflict * Add more secret stuff * more dactyl tweaks * Add more options to split transport * Changes of oled support * Change split settings * Improve keylogger formatting more * tweak oled stuff * Oled and such tweaks * Reduce brightness due to leds * Decrease brightness more * Only run layer code if master
3 years ago
[Keymap] Cleanup and updating of drashna keymap code (#11516) * Update other keyboards for rgb matrix changes * Remove customized bootmagic code * Fix corne layout compilation error * Fix compiler errors with all keymaps * Add Simple Visualizer for ergodox infinity * Fix compile issue with Corne * Fix keymap stuff * Add alias for mouse layer * Add Halmak Keyboard layout * Updates for Kyria * Add support for oled interval * Change RGB stuff [CHANGE] Fix coexistence issues * Fix rgb_stuff * Add custom ploopyco mouse keymap * Decrease default dwell time * Updates based on last breaking changes update * Disable command on dactyl * Update ergodox to use proper commands for rgb matrix indicators * Update all rgb matrix indicator functions * Update rules for dactyl-manuform * Reduce wait time for mouse layer off event * Add more info to logger * Add wrappers for get_tapping term * Move version.h include into only file that actually needs it * Update rgb sleep stuff * Update key print function * Change DM keymap settings * Change pin for DM Manuform * Add Proton C stuff for Corne keymap * more arm corne tinkering * Even more arm stuff for corne * Cleanup corne stuff * redirect default keymap to drashna because I am a very bad man * change corne rgb priority * Update tractyl manuform to not conflict * Add more secret stuff * more dactyl tweaks * Add more options to split transport * Changes of oled support * Change split settings * Improve keylogger formatting more * tweak oled stuff * Oled and such tweaks * Reduce brightness due to leds * Decrease brightness more * Only run layer code if master
3 years ago
[Keymap] Cleanup and updating of drashna keymap code (#11516) * Update other keyboards for rgb matrix changes * Remove customized bootmagic code * Fix corne layout compilation error * Fix compiler errors with all keymaps * Add Simple Visualizer for ergodox infinity * Fix compile issue with Corne * Fix keymap stuff * Add alias for mouse layer * Add Halmak Keyboard layout * Updates for Kyria * Add support for oled interval * Change RGB stuff [CHANGE] Fix coexistence issues * Fix rgb_stuff * Add custom ploopyco mouse keymap * Decrease default dwell time * Updates based on last breaking changes update * Disable command on dactyl * Update ergodox to use proper commands for rgb matrix indicators * Update all rgb matrix indicator functions * Update rules for dactyl-manuform * Reduce wait time for mouse layer off event * Add more info to logger * Add wrappers for get_tapping term * Move version.h include into only file that actually needs it * Update rgb sleep stuff * Update key print function * Change DM keymap settings * Change pin for DM Manuform * Add Proton C stuff for Corne keymap * more arm corne tinkering * Even more arm stuff for corne * Cleanup corne stuff * redirect default keymap to drashna because I am a very bad man * change corne rgb priority * Update tractyl manuform to not conflict * Add more secret stuff * more dactyl tweaks * Add more options to split transport * Changes of oled support * Change split settings * Improve keylogger formatting more * tweak oled stuff * Oled and such tweaks * Reduce brightness due to leds * Decrease brightness more * Only run layer code if master
3 years ago
[Keymap] Cleanup and updating of drashna keymap code (#11516) * Update other keyboards for rgb matrix changes * Remove customized bootmagic code * Fix corne layout compilation error * Fix compiler errors with all keymaps * Add Simple Visualizer for ergodox infinity * Fix compile issue with Corne * Fix keymap stuff * Add alias for mouse layer * Add Halmak Keyboard layout * Updates for Kyria * Add support for oled interval * Change RGB stuff [CHANGE] Fix coexistence issues * Fix rgb_stuff * Add custom ploopyco mouse keymap * Decrease default dwell time * Updates based on last breaking changes update * Disable command on dactyl * Update ergodox to use proper commands for rgb matrix indicators * Update all rgb matrix indicator functions * Update rules for dactyl-manuform * Reduce wait time for mouse layer off event * Add more info to logger * Add wrappers for get_tapping term * Move version.h include into only file that actually needs it * Update rgb sleep stuff * Update key print function * Change DM keymap settings * Change pin for DM Manuform * Add Proton C stuff for Corne keymap * more arm corne tinkering * Even more arm stuff for corne * Cleanup corne stuff * redirect default keymap to drashna because I am a very bad man * change corne rgb priority * Update tractyl manuform to not conflict * Add more secret stuff * more dactyl tweaks * Add more options to split transport * Changes of oled support * Change split settings * Improve keylogger formatting more * tweak oled stuff * Oled and such tweaks * Reduce brightness due to leds * Decrease brightness more * Only run layer code if master
3 years ago
[Keymap] Cleanup and updating of drashna keymap code (#11516) * Update other keyboards for rgb matrix changes * Remove customized bootmagic code * Fix corne layout compilation error * Fix compiler errors with all keymaps * Add Simple Visualizer for ergodox infinity * Fix compile issue with Corne * Fix keymap stuff * Add alias for mouse layer * Add Halmak Keyboard layout * Updates for Kyria * Add support for oled interval * Change RGB stuff [CHANGE] Fix coexistence issues * Fix rgb_stuff * Add custom ploopyco mouse keymap * Decrease default dwell time * Updates based on last breaking changes update * Disable command on dactyl * Update ergodox to use proper commands for rgb matrix indicators * Update all rgb matrix indicator functions * Update rules for dactyl-manuform * Reduce wait time for mouse layer off event * Add more info to logger * Add wrappers for get_tapping term * Move version.h include into only file that actually needs it * Update rgb sleep stuff * Update key print function * Change DM keymap settings * Change pin for DM Manuform * Add Proton C stuff for Corne keymap * more arm corne tinkering * Even more arm stuff for corne * Cleanup corne stuff * redirect default keymap to drashna because I am a very bad man * change corne rgb priority * Update tractyl manuform to not conflict * Add more secret stuff * more dactyl tweaks * Add more options to split transport * Changes of oled support * Change split settings * Improve keylogger formatting more * tweak oled stuff * Oled and such tweaks * Reduce brightness due to leds * Decrease brightness more * Only run layer code if master
3 years ago
  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. #ifndef KEYLOGGER_LENGTH
  18. // # ifdef OLED_DISPLAY_128X64
  19. # define KEYLOGGER_LENGTH ((int)(OLED_DISPLAY_HEIGHT / OLED_FONT_WIDTH))
  20. // # else
  21. // # define KEYLOGGER_LENGTH (uint8_t *(OLED_DISPLAY_WIDTH / OLED_FONT_HEIGHT))
  22. // # endif
  23. #endif
  24. uint32_t oled_timer = 0;
  25. static char keylog_str[KEYLOGGER_LENGTH + 1] = {"\n"};
  26. static uint16_t log_timer = 0;
  27. // clang-format off
  28. static const char PROGMEM code_to_name[0xFF] = {
  29. // 0 1 2 3 4 5 6 7 8 9 A B c D E F
  30. ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', // 0x
  31. 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', // 1x
  32. '3', '4', '5', '6', '7', '8', '9', '0', 20, 19, 27, 26, 22, '-', '=', '[', // 2x
  33. ']','\\', '#', ';','\'', '`', ',', '.', '/', 128, ' ', ' ', ' ', ' ', ' ', ' ', // 3x
  34. ' ', ' ', ' ', ' ', ' ', ' ', 'P', 'S', ' ', ' ', ' ', ' ', 16, ' ', ' ', ' ', // 4x
  35. ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 5x
  36. ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 6x
  37. ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 7x
  38. ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 8x
  39. ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 9x
  40. ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ax
  41. ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Bx
  42. ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Cx
  43. ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Dx
  44. 'C', 'S', 'A', 'C', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ex
  45. ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' // Fx
  46. };
  47. // clang-format on
  48. void add_keylog(uint16_t keycode) {
  49. if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) || (keycode >= QK_MODS && keycode <= QK_MODS_MAX)) {
  50. keycode = keycode & 0xFF;
  51. } else if (keycode > 0xFF) {
  52. keycode = 0;
  53. }
  54. for (uint8_t i = (KEYLOGGER_LENGTH - 1); i > 0; --i) {
  55. keylog_str[i] = keylog_str[i - 1];
  56. }
  57. if (keycode < (sizeof(code_to_name) / sizeof(char))) {
  58. keylog_str[0] = pgm_read_byte(&code_to_name[keycode]);
  59. }
  60. log_timer = timer_read();
  61. }
  62. bool process_record_user_oled(uint16_t keycode, keyrecord_t *record) {
  63. if (record->event.pressed) {
  64. #ifdef OLED_DRIVER_ENABLE
  65. oled_timer = timer_read32();
  66. add_keylog(keycode);
  67. #endif
  68. }
  69. return true;
  70. }
  71. void update_log(void) {
  72. if (timer_elapsed(log_timer) > 750) {
  73. // add_keylog(0);
  74. }
  75. }
  76. void render_keylogger_status(void) {
  77. oled_write_P(PSTR(OLED_RENDER_KEYLOGGER), false);
  78. oled_write(keylog_str, false);
  79. }
  80. void render_default_layer_state(void) {
  81. oled_write_P(PSTR(OLED_RENDER_LAYOUT_NAME), false);
  82. switch (get_highest_layer(default_layer_state)) {
  83. case _QWERTY:
  84. oled_write_P(PSTR(OLED_RENDER_LAYOUT_QWERTY), false);
  85. break;
  86. case _COLEMAK:
  87. oled_write_P(PSTR(OLED_RENDER_LAYOUT_COLEMAK), false);
  88. break;
  89. case _DVORAK:
  90. oled_write_P(PSTR(OLED_RENDER_LAYOUT_DVORAK), false);
  91. break;
  92. case _WORKMAN:
  93. oled_write_P(PSTR(OLED_RENDER_LAYOUT_WORKMAN), false);
  94. break;
  95. case _NORMAN:
  96. oled_write_P(PSTR(OLED_RENDER_LAYOUT_NORMAN), false);
  97. break;
  98. case _MALTRON:
  99. oled_write_P(PSTR(OLED_RENDER_LAYOUT_MALTRON), false);
  100. break;
  101. case _EUCALYN:
  102. oled_write_P(PSTR(OLED_RENDER_LAYOUT_EUCALYN), false);
  103. break;
  104. case _CARPLAX:
  105. oled_write_P(PSTR(OLED_RENDER_LAYOUT_CARPLAX), false);
  106. break;
  107. }
  108. #ifdef OLED_DISPLAY_128X64
  109. oled_advance_page(true);
  110. #endif
  111. }
  112. void render_layer_state(void) {
  113. oled_write_P(PSTR(OLED_RENDER_LAYER_NAME), false);
  114. #ifdef OLED_DISPLAY_128X64
  115. oled_write_P(PSTR(" "), false);
  116. #endif
  117. oled_write_P(PSTR(OLED_RENDER_LAYER_LOWER), layer_state_is(_LOWER));
  118. #ifdef OLED_DISPLAY_128X64
  119. oled_write_P(PSTR(" "), false);
  120. #endif
  121. oled_write_P(PSTR(OLED_RENDER_LAYER_RAISE), layer_state_is(_RAISE));
  122. #ifdef OLED_DISPLAY_128X64
  123. oled_advance_page(true);
  124. oled_write_P(PSTR(" "), false);
  125. oled_write_P(PSTR("GamePad"), layer_state_is(_GAMEPAD));
  126. oled_write_P(PSTR(" "), false);
  127. oled_write_P(PSTR("Diablo"), layer_state_is(_DIABLO));
  128. oled_write_P(PSTR(" "), false);
  129. oled_write_P(PSTR("Mouse"), layer_state_is(_MOUSE));
  130. #endif
  131. }
  132. void render_keylock_status(uint8_t led_usb_state) {
  133. oled_write_P(PSTR(OLED_RENDER_LOCK_NAME), false);
  134. #if !defined(OLED_DISPLAY_128X64)
  135. oled_write_P(PSTR(" "), false);
  136. #endif
  137. oled_write_P(PSTR(OLED_RENDER_LOCK_NUML), led_usb_state & (1 << USB_LED_NUM_LOCK));
  138. oled_write_P(PSTR(" "), false);
  139. oled_write_P(PSTR(OLED_RENDER_LOCK_CAPS), led_usb_state & (1 << USB_LED_CAPS_LOCK));
  140. oled_write_P(PSTR(" "), false);
  141. oled_write_P(PSTR(OLED_RENDER_LOCK_SCLK), led_usb_state & (1 << USB_LED_SCROLL_LOCK));
  142. #ifndef OLED_DISPLAY_128X64
  143. oled_advance_page(true);
  144. #endif
  145. }
  146. void render_matrix_scan_rate(void) {
  147. #ifdef DEBUG_MATRIX_SCAN_RATE
  148. char matrix_rate[5];
  149. uint16_t n = get_matrix_scan_rate();
  150. matrix_rate[4] = '\0';
  151. matrix_rate[3] = '0' + n % 10;
  152. matrix_rate[2] = ( n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
  153. matrix_rate[1] = n / 10 ? '0' + n / 10 : ' ';
  154. matrix_rate[0] = ' ';
  155. oled_write_P(PSTR("MS:"), false);
  156. oled_write(matrix_rate, false);
  157. #endif
  158. }
  159. void render_mod_status(uint8_t modifiers) {
  160. static const char PROGMEM mod_status[5][3] = {{0xE8, 0xE9, 0}, {0xE4, 0xE5, 0}, {0xE6, 0xE7, 0}, {0xEA, 0xEB, 0}, {0xEC, 0xED, 0}};
  161. oled_write_P(PSTR(OLED_RENDER_MODS_NAME), false);
  162. oled_write_P(mod_status[0], (modifiers & MOD_MASK_SHIFT));
  163. oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_MASK_GUI));
  164. #if !defined(OLED_DISPLAY_128X64)
  165. oled_write_P(PSTR(" "), false);
  166. #endif
  167. oled_write_P(mod_status[2], (modifiers & MOD_MASK_ALT));
  168. oled_write_P(mod_status[1], (modifiers & MOD_MASK_CTRL));
  169. render_matrix_scan_rate();
  170. #if defined(OLED_DISPLAY_128X64)
  171. oled_advance_page(true);
  172. #endif
  173. }
  174. #ifdef SWAP_HANDS_ENABLE
  175. extern bool swap_hands;
  176. #endif
  177. void render_bootmagic_status(void) {
  178. /* Show Ctrl-Gui Swap options */
  179. static const char PROGMEM logo[][2][3] = {
  180. {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
  181. {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}},
  182. };
  183. bool is_bootmagic_on;
  184. #ifdef OLED_DISPLAY_128X64
  185. is_bootmagic_on = !keymap_config.swap_lctl_lgui;
  186. #else
  187. is_bootmagic_on = keymap_config.swap_lctl_lgui;
  188. #endif
  189. oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NAME), false);
  190. #ifdef OLED_DISPLAY_128X64
  191. if (keymap_config.swap_lctl_lgui)
  192. #else
  193. oled_write_P(PSTR(" "), false);
  194. #endif
  195. {
  196. oled_write_P(logo[1][0], is_bootmagic_on);
  197. #ifdef OLED_DISPLAY_128X64
  198. } else {
  199. #endif
  200. oled_write_P(logo[0][0], !is_bootmagic_on);
  201. }
  202. #ifndef OLED_DISPLAY_128X64
  203. oled_write_P(PSTR(" "), false);
  204. oled_write_P(logo[1][1], is_bootmagic_on);
  205. oled_write_P(logo[0][1], !is_bootmagic_on);
  206. #endif
  207. oled_write_P(PSTR(" "), false);
  208. oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NKRO), keymap_config.nkro);
  209. oled_write_P(PSTR(" "), false);
  210. oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NOGUI), keymap_config.no_gui);
  211. #ifdef OLED_DISPLAY_128X64
  212. oled_advance_page(true);
  213. oled_write_P(PSTR("Magic"), false);
  214. oled_write_P(PSTR(" "), false);
  215. if (keymap_config.swap_lctl_lgui) {
  216. oled_write_P(logo[1][1], is_bootmagic_on);
  217. } else {
  218. oled_write_P(logo[0][1], !is_bootmagic_on);
  219. }
  220. #endif
  221. oled_write_P(PSTR(" "), false);
  222. oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_ONESHOT), !is_oneshot_enabled());
  223. #ifdef SWAP_HANDS_ENABLE
  224. oled_write_P(PSTR(" "), false);
  225. oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_SWAP), swap_hands);
  226. #endif
  227. #ifdef OLED_DISPLAY_128X64
  228. oled_advance_page(true);
  229. #endif
  230. }
  231. #if defined(POINTING_DEVICE_ENABLE)
  232. extern bool tap_toggling;
  233. #endif
  234. void render_user_status(void) {
  235. oled_write_P(PSTR(OLED_RENDER_USER_NAME), false);
  236. #if !defined(OLED_DISPLAY_128X64)
  237. oled_write_P(PSTR(" "), false);
  238. #endif
  239. #if defined(RGB_MATRIX_ENABLE)
  240. oled_write_P(PSTR(OLED_RENDER_USER_ANIM), userspace_config.rgb_matrix_idle_anim);
  241. # if !defined(OLED_DISPLAY_128X64)
  242. oled_write_P(PSTR(" "), false);
  243. # endif
  244. #elif defined(POINTING_DEVICE_ENABLE)
  245. static const char PROGMEM mouse_lock[3] = {0xF2, 0xF3, 0};
  246. oled_write_P(mouse_lock, tap_toggling);
  247. #endif
  248. #ifdef AUDIO_ENABLE
  249. static const char PROGMEM audio_status[2][3] = {{0xE0, 0xE1, 0}, {0xE2, 0xE3, 0}};
  250. oled_write_P(audio_status[is_audio_on()], false);
  251. # ifdef AUDIO_CLICKY
  252. static const char PROGMEM audio_clicky_status[2][3] = {{0xF4, 0xF5, 0}, {0xF6, 0xF7, 0}};
  253. oled_write_P(audio_clicky_status[is_clicky_on() && is_audio_on()], false);
  254. # if !defined(OLED_DISPLAY_128X64)
  255. oled_write_P(PSTR(" "), false);
  256. # endif
  257. # endif
  258. #endif
  259. static const char PROGMEM rgb_layer_status[2][3] = {{0xEE, 0xEF, 0}, {0xF0, 0xF1, 0}};
  260. oled_write_P(rgb_layer_status[userspace_config.rgb_layer_change], false);
  261. static const char PROGMEM nukem_good[2][3] = {{0xF8, 0xF9, 0}, {0xF6, 0xF7, 0}};
  262. oled_write_P(nukem_good[0], userspace_config.nuke_switch);
  263. #if defined(OLED_DISPLAY_128X64)
  264. oled_advance_page(true);
  265. #endif
  266. }
  267. __attribute__((weak)) void oled_driver_render_logo(void) {
  268. // clang-format off
  269. static const char PROGMEM qmk_logo[] = {
  270. 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
  271. 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
  272. 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0};
  273. // clang-format on
  274. oled_write_P(qmk_logo, false);
  275. }
  276. void render_wpm(void) {
  277. #ifdef WPM_ENABLE
  278. uint8_t n = get_current_wpm();
  279. # ifdef OLED_DISPLAY_128X64
  280. char wpm_counter[4];
  281. wpm_counter[3] = '\0';
  282. wpm_counter[2] = '0' + n % 10;
  283. wpm_counter[1] = ( n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
  284. wpm_counter[0] = n / 10 ? '0' + n / 10 : ' ';
  285. # else
  286. char wpm_counter[6];
  287. wpm_counter[5] = '\0';
  288. wpm_counter[4] = '0' + n % 10;
  289. wpm_counter[3] = ( n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
  290. wpm_counter[2] = n / 10 ? '0' + n / 10 : ' ';
  291. wpm_counter[1] = ' ';
  292. wpm_counter[0] = ' ';
  293. # endif
  294. oled_write_P(PSTR(OLED_RENDER_WPM_COUNTER), false);
  295. oled_write(wpm_counter, false);
  296. #endif
  297. }
  298. #ifdef KEYBOARD_handwired_dactyl_manuform_5x6_right_trackball
  299. extern keyboard_config_t keyboard_config;
  300. extern uint16_t dpi_array[];
  301. void render_pointing_dpi_status(void) {
  302. char dpi_status[6];
  303. uint16_t n = dpi_array[keyboard_config.dpi_config];
  304. dpi_status[5] = '\0';
  305. dpi_status[4] = '0' + n % 10;
  306. dpi_status[3] = ( n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
  307. dpi_status[2] = ( n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
  308. dpi_status[1] = n / 10 ? '0' + n / 10 : ' ';
  309. dpi_status[0] = ' ';
  310. oled_write_P(PSTR(" DPI: "), false);
  311. oled_write(dpi_status, false);
  312. }
  313. #endif
  314. void render_status_secondary(void) {
  315. #if defined(OLED_DISPLAY_128X64)
  316. oled_driver_render_logo();
  317. #endif
  318. /* Show Keyboard Layout */
  319. render_default_layer_state();
  320. render_layer_state();
  321. render_mod_status(get_mods() | get_oneshot_mods());
  322. // render_keylogger_status();
  323. render_keylock_status(host_keyboard_leds());
  324. }
  325. void render_status_main(void) {
  326. #if defined(OLED_DISPLAY_128X64)
  327. oled_driver_render_logo();
  328. # ifdef DEBUG_MATRIX_SCAN_RATE
  329. render_matrix_scan_rate();
  330. # else
  331. render_wpm();
  332. # endif
  333. # ifdef KEYBOARD_handwired_dactyl_manuform_5x6_right_trackball
  334. render_pointing_dpi_status();
  335. # endif
  336. oled_write_P(PSTR("\n"), false);
  337. #else
  338. render_default_layer_state();
  339. #endif
  340. /* Show Keyboard Layout */
  341. // render_keylock_status(host_keyboard_leds());
  342. render_bootmagic_status();
  343. render_user_status();
  344. render_keylogger_status();
  345. }
  346. void oled_task_user(void) {
  347. update_log();
  348. if (is_keyboard_master()) {
  349. if (timer_elapsed32(oled_timer) > 30000) {
  350. oled_off();
  351. return;
  352. } else {
  353. oled_on();
  354. }
  355. render_status_main(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
  356. } else {
  357. render_status_secondary();
  358. }
  359. }