aboutsummaryrefslogtreecommitdiff
path: root/users/drashna/oled/oled_stuff.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/drashna/oled/oled_stuff.c')
-rw-r--r--users/drashna/oled/oled_stuff.c670
1 files changed, 590 insertions, 80 deletions
diff --git a/users/drashna/oled/oled_stuff.c b/users/drashna/oled/oled_stuff.c
index de8476672..eeca010de 100644
--- a/users/drashna/oled/oled_stuff.c
+++ b/users/drashna/oled/oled_stuff.c
@@ -22,17 +22,12 @@
22 22
23extern bool host_driver_disabled; 23extern bool host_driver_disabled;
24 24
25#ifndef KEYLOGGER_LENGTH 25uint32_t oled_timer = 0;
26// # ifdef OLED_DISPLAY_128X64 26char keylog_str[OLED_KEYLOGGER_LENGTH] = {0};
27# define KEYLOGGER_LENGTH ((uint8_t)(OLED_DISPLAY_HEIGHT / OLED_FONT_WIDTH)) 27static uint16_t log_timer = 0;
28// # else 28static const char PROGMEM display_border[3] = {0x0, 0xFF, 0x0};
29// # define KEYLOGGER_LENGTH (uint8_t *(OLED_DISPLAY_WIDTH / OLED_FONT_HEIGHT))
30// # endif
31#endif
32 29
33uint32_t oled_timer = 0; 30deferred_token kittoken;
34static char keylog_str[KEYLOGGER_LENGTH + 1] = {0};
35static uint16_t log_timer = 0;
36 31
37// clang-format off 32// clang-format off
38static const char PROGMEM code_to_name[256] = { 33static const char PROGMEM code_to_name[256] = {
@@ -56,10 +51,16 @@ static const char PROGMEM code_to_name[256] = {
56}; 51};
57// clang-format on 52// clang-format on
58 53
54/**
55 * @brief parses pressed keycodes and saves to buffer
56 *
57 * @param keycode Keycode pressed from switch matrix
58 * @param record keyrecord_t data structure
59 */
59void add_keylog(uint16_t keycode, keyrecord_t *record) { 60void add_keylog(uint16_t keycode, keyrecord_t *record) {
60 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)) { 61 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)) {
61 if (((keycode & 0xFF) == KC_BSPC) && mod_config(get_mods() | get_oneshot_mods()) & MOD_MASK_CTRL) { 62 if (((keycode & 0xFF) == KC_BSPC) && mod_config(get_mods() | get_oneshot_mods()) & MOD_MASK_CTRL) {
62 memset(keylog_str, ' ', sizeof(keylog_str) - 1); 63 memset(keylog_str, ' ', OLED_KEYLOGGER_LENGTH);
63 return; 64 return;
64 } 65 }
65 if (record->tap.count) { 66 if (record->tap.count) {
@@ -72,23 +73,29 @@ void add_keylog(uint16_t keycode, keyrecord_t *record) {
72 return; 73 return;
73 } 74 }
74 75
75 for (uint8_t i = 1; i < KEYLOGGER_LENGTH; i++) { 76 memmove(keylog_str, keylog_str + 1, OLED_KEYLOGGER_LENGTH - 1);
76 keylog_str[i - 1] = keylog_str[i];
77 }
78 77
79 if (keycode < (sizeof(code_to_name) / sizeof(char))) { 78 if (keycode < (sizeof(code_to_name) / sizeof(char))) {
80 keylog_str[(KEYLOGGER_LENGTH - 1)] = pgm_read_byte(&code_to_name[keycode]); 79 keylog_str[(OLED_KEYLOGGER_LENGTH - 1)] = pgm_read_byte(&code_to_name[keycode]);
81 } 80 }
82 81
83 log_timer = timer_read(); 82 log_timer = timer_read();
84} 83}
85 84
85/**
86 * @brief Keycode handler for oled display.
87 *
88 * This adds pressed keys to buffer, but also resets the oled timer
89 *
90 * @param keycode Keycode from matrix
91 * @param record keyrecord data struture
92 * @return true
93 * @return false
94 */
86bool process_record_user_oled(uint16_t keycode, keyrecord_t *record) { 95bool process_record_user_oled(uint16_t keycode, keyrecord_t *record) {
87 if (record->event.pressed) { 96 if (record->event.pressed) {
88#ifdef OLED_ENABLE
89 oled_timer = timer_read32(); 97 oled_timer = timer_read32();
90 add_keylog(keycode, record); 98 add_keylog(keycode, record);
91#endif
92 } 99 }
93 return true; 100 return true;
94} 101}
@@ -99,12 +106,29 @@ void update_log(void) {
99 } 106 }
100} 107}
101 108
109/**
110 * @brief Renders keylogger buffer to oled
111 *
112 */
102void render_keylogger_status(void) { 113void render_keylogger_status(void) {
114#ifdef OLED_DISPLAY_VERBOSE
115 oled_set_cursor(1, 7);
116#endif
103 oled_write_P(PSTR(OLED_RENDER_KEYLOGGER), false); 117 oled_write_P(PSTR(OLED_RENDER_KEYLOGGER), false);
104 oled_write(keylog_str, false); 118 oled_write(keylog_str, false);
119#ifdef OLED_DISPLAY_VERBOSE
120 oled_advance_page(true);
121#endif
105} 122}
106 123
124/**
125 * @brief Renders default layer state (aka layout) to oled
126 *
127 */
107void render_default_layer_state(void) { 128void render_default_layer_state(void) {
129#ifdef OLED_DISPLAY_VERBOSE
130 oled_set_cursor(5, 2);
131#endif
108 oled_write_P(PSTR(OLED_RENDER_LAYOUT_NAME), false); 132 oled_write_P(PSTR(OLED_RENDER_LAYOUT_NAME), false);
109 switch (get_highest_layer(default_layer_state)) { 133 switch (get_highest_layer(default_layer_state)) {
110 case _QWERTY: 134 case _QWERTY:
@@ -120,46 +144,150 @@ void render_default_layer_state(void) {
120 oled_write_P(PSTR(OLED_RENDER_LAYOUT_DVORAK), false); 144 oled_write_P(PSTR(OLED_RENDER_LAYOUT_DVORAK), false);
121 break; 145 break;
122 } 146 }
123#ifdef OLED_DISPLAY_128X64 147#ifdef OLED_DISPLAY_VERBOSE
124 oled_advance_page(true); 148 oled_advance_page(true);
125#endif 149#endif
126} 150}
127 151
152/**
153 * @brief Renders the active layers to the OLED
154 *
155 */
128void render_layer_state(void) { 156void render_layer_state(void) {
129 oled_write_P(PSTR(OLED_RENDER_LAYER_NAME), false); 157#ifdef OLED_DISPLAY_VERBOSE
130#ifdef OLED_DISPLAY_128X64 158 static const char PROGMEM tri_layer_image[4][3][18] = {
131 oled_write_P(PSTR(" "), false); 159 {
132#endif 160 {
133 oled_write_P(PSTR(OLED_RENDER_LAYER_LOWER), layer_state_is(_LOWER)); 161 0x80, 0x80, 0x40, 0x40, 0x20, 0x20,
134#ifdef OLED_DISPLAY_128X64 162 0x10, 0x10, 0x08, 0x08, 0x10, 0x10,
163 0x20, 0x20, 0x40, 0x40, 0x80, 0x80
164 },
165 {
166 0x88, 0x88, 0x5D, 0x5D, 0x3E, 0x3E,
167 0x7C, 0x7C, 0xF8, 0xF8, 0x7C, 0x7C,
168 0x3E, 0x3E, 0x5D, 0x5D, 0x88, 0x88
169 },
170 {
171 0x00, 0x00, 0x01, 0x01, 0x02, 0x02,
172 0x04, 0x04, 0x08, 0x08, 0x04, 0x04,
173 0x02, 0x02, 0x01, 0x01, 0x00, 0x00
174 }
175 },
176 {
177 {
178 0x80, 0x80, 0xC0, 0xC0, 0xE0, 0xE0,
179 0xF0, 0xF0, 0xF8, 0xF8, 0xF0, 0xF0,
180 0xE0, 0xE0, 0xC0, 0xC0, 0x80, 0x80
181 },
182 {
183 0x88, 0x88, 0x55, 0x55, 0x23, 0x23,
184 0x47, 0x47, 0x8F, 0x8F, 0x47, 0x47,
185 0x23, 0x23, 0x55, 0x55, 0x88, 0x88
186 },
187 {
188 0x00, 0x00, 0x01, 0x01, 0x02, 0x02,
189 0x04, 0x04, 0x08, 0x08, 0x04, 0x04,
190 0x02, 0x02, 0x01, 0x01, 0x00, 0x00
191 }
192 },
193 {
194 {
195 0x80, 0x80, 0x40, 0x40, 0x20, 0x20,
196 0x10, 0x10, 0x08, 0x08, 0x10, 0x10,
197 0x20, 0x20, 0x40, 0x40, 0x80, 0x80
198 },
199 {
200 0x88, 0x88, 0xD5, 0xD5, 0xE2, 0xE2,
201 0xC4, 0xC4, 0x88, 0x88, 0xC4, 0xC4,
202 0xE2, 0xE2, 0xD5, 0xD5, 0x88, 0x88
203 },
204 {
205 0x00, 0x00, 0x01, 0x01, 0x03, 0x03,
206 0x07, 0x07, 0x0F, 0x0F, 0x07, 0x07,
207 0x03, 0x03, 0x01, 0x01, 0x00, 0x00
208 }
209 },
210 {
211 {
212 0x80, 0x80, 0x40, 0xC0, 0x60, 0xA0,
213 0x50, 0xB0, 0x58, 0xA8, 0x50, 0xB0,
214 0x60, 0xA0, 0x40, 0xC0, 0x80, 0x80
215 },
216 {
217 0x88, 0x88, 0x5D, 0xD5, 0x6B, 0xB6,
218 0x6D, 0xD6, 0xAD, 0xDA, 0x6D, 0xD6,
219 0x6B, 0xB6, 0x5D, 0xD5, 0x88, 0x88
220 },
221 {
222 0x00, 0x00, 0x01, 0x01, 0x03, 0x02,
223 0x05, 0x06, 0x0D, 0x0A, 0x05, 0x06,
224 0x03, 0x02, 0x01, 0x01, 0x00, 0x00
225 }
226 }
227 };
228
229 uint8_t layer_is = 0;
230 if (layer_state_is(_ADJUST)) {
231 layer_is = 3;
232 } else if (layer_state_is(_RAISE)) {
233 layer_is = 1;
234 } else if (layer_state_is(_LOWER)) {
235 layer_is = 2;
236 }
237
238 oled_set_cursor(1, 2);
239 oled_write_raw_P(tri_layer_image[layer_is][0], sizeof(tri_layer_image[0][0]));
240 oled_set_cursor(5, 3);
241 oled_write_P(PSTR("Diablo2"), layer_state_is(_DIABLOII));
135 oled_write_P(PSTR(" "), false); 242 oled_write_P(PSTR(" "), false);
136#endif 243 oled_write_P(PSTR("Diablo3"), layer_state_is(_DIABLO));
137 oled_write_P(PSTR(OLED_RENDER_LAYER_RAISE), layer_state_is(_RAISE));
138#ifdef OLED_DISPLAY_128X64
139 oled_advance_page(true); 244 oled_advance_page(true);
140 oled_write_P(PSTR(" "), false); 245
246 oled_set_cursor(1, 3);
247 oled_write_raw_P(tri_layer_image[layer_is][1], sizeof(tri_layer_image[0][0]));
248 oled_set_cursor(5, 4);
141 oled_write_P(PSTR("GamePad"), layer_state_is(_GAMEPAD)); 249 oled_write_P(PSTR("GamePad"), layer_state_is(_GAMEPAD));
142 oled_write_P(PSTR(" "), false); 250 oled_write_P(PSTR(" "), false);
143 oled_write_P(PSTR("Diablo"), layer_state_is(_DIABLO));
144 oled_write_P(PSTR(" "), false);
145 oled_write_P(PSTR("Mouse"), layer_state_is(_MOUSE)); 251 oled_write_P(PSTR("Mouse"), layer_state_is(_MOUSE));
252 oled_advance_page(true);
253
254 oled_set_cursor(1, 4);
255 oled_write_raw_P(tri_layer_image[layer_is][2], sizeof(tri_layer_image[0][0]));
256
257#else
258 oled_write_P(PSTR(OLED_RENDER_LAYER_NAME), false);
259 oled_write_P(PSTR(OLED_RENDER_LAYER_LOWER), layer_state_is(_LOWER));
260 oled_write_P(PSTR(OLED_RENDER_LAYER_RAISE), layer_state_is(_RAISE));
261 oled_advance_page(true);
146#endif 262#endif
147} 263}
148 264
265/**
266 * @brief Renders the current lock status to oled
267 *
268 * @param led_usb_state Current keyboard led state
269 */
149void render_keylock_status(uint8_t led_usb_state) { 270void render_keylock_status(uint8_t led_usb_state) {
271#if defined(OLED_DISPLAY_VERBOSE)
272 oled_set_cursor(1, 6);
273#endif
150 oled_write_P(PSTR(OLED_RENDER_LOCK_NAME), false); 274 oled_write_P(PSTR(OLED_RENDER_LOCK_NAME), false);
151#if !defined(OLED_DISPLAY_128X64) 275#if !defined(OLED_DISPLAY_VERBOSE)
152 oled_write_P(PSTR(" "), false); 276 oled_write_P(PSTR(" "), false);
153#endif 277#endif
154 oled_write_P(PSTR(OLED_RENDER_LOCK_NUML), led_usb_state & (1 << USB_LED_NUM_LOCK)); 278 oled_write_P(PSTR(OLED_RENDER_LOCK_NUML), led_usb_state & (1 << USB_LED_NUM_LOCK));
155 oled_write_P(PSTR(" "), false); 279 oled_write_P(PSTR(" "), false);
156 oled_write_P(PSTR(OLED_RENDER_LOCK_CAPS), led_usb_state & (1 << USB_LED_CAPS_LOCK)); 280 oled_write_P(PSTR(OLED_RENDER_LOCK_CAPS), led_usb_state & (1 << USB_LED_CAPS_LOCK));
157#if defined(OLED_DISPLAY_128X64) 281#if defined(OLED_DISPLAY_VERBOSE)
158 oled_write_P(PSTR(" "), false); 282 oled_write_P(PSTR(" "), false);
159 oled_write_P(PSTR(OLED_RENDER_LOCK_SCLK), led_usb_state & (1 << USB_LED_SCROLL_LOCK)); 283 oled_write_P(PSTR(OLED_RENDER_LOCK_SCLK), led_usb_state & (1 << USB_LED_SCROLL_LOCK));
160#endif 284#endif
161} 285}
162 286
287/**
288 * @brief Renders the matrix scan rate to the host system
289 *
290 */
163void render_matrix_scan_rate(void) { 291void render_matrix_scan_rate(void) {
164#ifdef DEBUG_MATRIX_SCAN_RATE 292#ifdef DEBUG_MATRIX_SCAN_RATE
165 oled_write_P(PSTR("MS:"), false); 293 oled_write_P(PSTR("MS:"), false);
@@ -167,10 +295,18 @@ void render_matrix_scan_rate(void) {
167#endif 295#endif
168} 296}
169 297
298/**
299 * @brief Renders the modifier state
300 *
301 * @param modifiers Modifiers to check against (real, weak, onesheot, etc;)
302 */
170void render_mod_status(uint8_t modifiers) { 303void render_mod_status(uint8_t modifiers) {
171 static const char PROGMEM mod_status[5][3] = {{0xE8, 0xE9, 0}, {0xE4, 0xE5, 0}, {0xE6, 0xE7, 0}, {0xEA, 0xEB, 0}, {0xEC, 0xED, 0}}; 304 static const char PROGMEM mod_status[5][3] = {{0xE8, 0xE9, 0}, {0xE4, 0xE5, 0}, {0xE6, 0xE7, 0}, {0xEA, 0xEB, 0}, {0xEC, 0xED, 0}};
305#if defined(OLED_DISPLAY_VERBOSE)
306 oled_set_cursor(1, 5);
307#endif
172 oled_write_P(PSTR(OLED_RENDER_MODS_NAME), false); 308 oled_write_P(PSTR(OLED_RENDER_MODS_NAME), false);
173#if defined(OLED_DISPLAY_128X64) 309#if defined(OLED_DISPLAY_VERBOSE)
174 oled_write_P(mod_status[0], (modifiers & MOD_BIT(KC_LSHIFT))); 310 oled_write_P(mod_status[0], (modifiers & MOD_BIT(KC_LSHIFT)));
175 oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_BIT(KC_LGUI))); 311 oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_BIT(KC_LGUI)));
176 oled_write_P(mod_status[2], (modifiers & MOD_BIT(KC_LALT))); 312 oled_write_P(mod_status[2], (modifiers & MOD_BIT(KC_LALT)));
@@ -200,26 +336,27 @@ void render_bootmagic_status(void) {
200 }; 336 };
201 337
202 bool is_bootmagic_on; 338 bool is_bootmagic_on;
203#ifdef OLED_DISPLAY_128X64 339#ifdef OLED_DISPLAY_VERBOSE
340 oled_set_cursor(7, 4);
204 is_bootmagic_on = !keymap_config.swap_lctl_lgui; 341 is_bootmagic_on = !keymap_config.swap_lctl_lgui;
205#else 342#else
206 is_bootmagic_on = keymap_config.swap_lctl_lgui; 343 is_bootmagic_on = keymap_config.swap_lctl_lgui;
207#endif 344#endif
208 345
209 oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NAME), false); 346#ifdef OLED_DISPLAY_VERBOSE
210#ifdef OLED_DISPLAY_128X64
211 if (keymap_config.swap_lctl_lgui) 347 if (keymap_config.swap_lctl_lgui)
212#else 348#else
349 oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NAME), false);
213 oled_write_P(PSTR(" "), false); 350 oled_write_P(PSTR(" "), false);
214#endif 351#endif
215 { 352 {
216 oled_write_P(logo[1][0], is_bootmagic_on); 353 oled_write_P(logo[1][0], is_bootmagic_on);
217#ifdef OLED_DISPLAY_128X64 354#ifdef OLED_DISPLAY_VERBOSE
218 } else { 355 } else {
219#endif 356#endif
220 oled_write_P(logo[0][0], !is_bootmagic_on); 357 oled_write_P(logo[0][0], !is_bootmagic_on);
221 } 358 }
222#ifndef OLED_DISPLAY_128X64 359#ifndef OLED_DISPLAY_VERBOSE
223 oled_write_P(PSTR(" "), false); 360 oled_write_P(PSTR(" "), false);
224 oled_write_P(logo[1][1], is_bootmagic_on); 361 oled_write_P(logo[1][1], is_bootmagic_on);
225 oled_write_P(logo[0][1], !is_bootmagic_on); 362 oled_write_P(logo[0][1], !is_bootmagic_on);
@@ -232,10 +369,8 @@ void render_bootmagic_status(void) {
232#else 369#else
233 oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NOGUI), keymap_config.no_gui); 370 oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NOGUI), keymap_config.no_gui);
234#endif 371#endif
235#ifdef OLED_DISPLAY_128X64 372#ifdef OLED_DISPLAY_VERBOSE
236 oled_advance_page(true); 373 oled_set_cursor(7, 5);
237 oled_write_P(PSTR("Magic"), false);
238 oled_write_P(PSTR(" "), false);
239 if (keymap_config.swap_lctl_lgui) { 374 if (keymap_config.swap_lctl_lgui) {
240 oled_write_P(logo[1][1], is_bootmagic_on); 375 oled_write_P(logo[1][1], is_bootmagic_on);
241 } else { 376 } else {
@@ -248,9 +383,6 @@ void render_bootmagic_status(void) {
248 oled_write_P(PSTR(" "), false); 383 oled_write_P(PSTR(" "), false);
249 oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_SWAP), swap_hands); 384 oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_SWAP), swap_hands);
250#endif 385#endif
251#ifdef OLED_DISPLAY_128X64
252 oled_advance_page(true);
253#endif
254} 386}
255 387
256#if defined(POINTING_DEVICE_ENABLE) 388#if defined(POINTING_DEVICE_ENABLE)
@@ -269,13 +401,16 @@ void render_user_status(void) {
269 is_clicky_on = is_clicky_on(); 401 is_clicky_on = is_clicky_on();
270# endif 402# endif
271#endif 403#endif
404#if defined(OLED_DISPLAY_VERBOSE)
405 oled_set_cursor(1, 6);
406#endif
272 oled_write_P(PSTR(OLED_RENDER_USER_NAME), false); 407 oled_write_P(PSTR(OLED_RENDER_USER_NAME), false);
273#if !defined(OLED_DISPLAY_128X64) 408#if !defined(OLED_DISPLAY_VERBOSE)
274 oled_write_P(PSTR(" "), false); 409 oled_write_P(PSTR(" "), false);
275#endif 410#endif
276#if defined(RGB_MATRIX_ENABLE) 411#if defined(RGB_MATRIX_ENABLE)
277 oled_write_P(PSTR(OLED_RENDER_USER_ANIM), userspace_config.rgb_matrix_idle_anim); 412 oled_write_P(PSTR(OLED_RENDER_USER_ANIM), userspace_config.rgb_matrix_idle_anim);
278# if !defined(OLED_DISPLAY_128X64) 413# if !defined(OLED_DISPLAY_VERBOSE)
279 oled_write_P(PSTR(" "), false); 414 oled_write_P(PSTR(" "), false);
280# endif 415# endif
281#elif defined(POINTING_DEVICE_ENABLE) 416#elif defined(POINTING_DEVICE_ENABLE)
@@ -289,7 +424,7 @@ void render_user_status(void) {
289# ifdef AUDIO_CLICKY 424# ifdef AUDIO_CLICKY
290 static const char PROGMEM audio_clicky_status[2][3] = {{0xF4, 0xF5, 0}, {0xF6, 0xF7, 0}}; 425 static const char PROGMEM audio_clicky_status[2][3] = {{0xF4, 0xF5, 0}, {0xF6, 0xF7, 0}};
291 oled_write_P(audio_clicky_status[is_clicky_on && is_audio_on], false); 426 oled_write_P(audio_clicky_status[is_clicky_on && is_audio_on], false);
292# if !defined(OLED_DISPLAY_128X64) 427# if !defined(OLED_DISPLAY_VERBOSE)
293 oled_write_P(PSTR(" "), false); 428 oled_write_P(PSTR(" "), false);
294# endif 429# endif
295# endif 430# endif
@@ -304,30 +439,20 @@ void render_user_status(void) {
304 oled_write_P(uc_mod_status[get_unicode_input_mode() == UC_MAC], false); 439 oled_write_P(uc_mod_status[get_unicode_input_mode() == UC_MAC], false);
305#endif 440#endif
306 if (userspace_config.nuke_switch) { 441 if (userspace_config.nuke_switch) {
307#if !defined(OLED_DISPLAY_128X64) 442#if !defined(OLED_DISPLAY_VERBOSE)
308 oled_write_P(PSTR(" "), false); 443 oled_write_P(PSTR(" "), false);
309#endif 444#endif
310 static const char PROGMEM nukem_good[2] = {0xFA, 0}; 445 static const char PROGMEM nukem_good[2] = {0xFA, 0};
311 oled_write_P(nukem_good, false); 446 oled_write_P(nukem_good, false);
312#if !defined(OLED_DISPLAY_128X64) 447#if !defined(OLED_DISPLAY_VERBOSE)
313 oled_advance_page(true); 448 oled_advance_page(true);
314#endif 449#endif
315 } 450 }
316#if defined(OLED_DISPLAY_128X64) 451#if defined(OLED_DISPLAY_VERBOSE)
317 oled_advance_page(true); 452 oled_advance_page(true);
318#endif 453#endif
319} 454}
320 455
321void oled_driver_render_logo(void) {
322 // clang-format off
323 static const char PROGMEM qmk_logo[] = {
324 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
325 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
326 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0};
327 // clang-format on
328 oled_write_P(qmk_logo, false);
329}
330
331void render_wpm(uint8_t padding) { 456void render_wpm(uint8_t padding) {
332#ifdef WPM_ENABLE 457#ifdef WPM_ENABLE
333 458
@@ -356,49 +481,389 @@ void render_pointing_dpi_status(uint8_t padding) {
356#endif 481#endif
357 482
358__attribute__((weak)) void oled_driver_render_logo_right(void) { 483__attribute__((weak)) void oled_driver_render_logo_right(void) {
359#if defined(OLED_DISPLAY_128X64) 484#if defined(OLED_DISPLAY_VERBOSE)
360 oled_driver_render_logo(); 485 oled_set_cursor(0, 2);
361 render_default_layer_state(); 486 render_default_layer_state();
362 oled_set_cursor(0, 4);
363#else 487#else
364 render_default_layer_state(); 488 render_default_layer_state();
365#endif 489#endif
366} 490}
367 491
368__attribute__((weak)) void oled_driver_render_logo_left(void) { 492// WPM-responsive animation stuff here
369#if defined(OLED_DISPLAY_128X64) 493#define OLED_SLEEP_FRAMES 2
370 oled_driver_render_logo(); 494#define OLED_SLEEP_SPEED 10 // below this wpm value your animation will idle
371# ifdef DEBUG_MATRIX_SCAN_RATE 495
496#define OLED_WAKE_FRAMES 2 // uncomment if >1
497#define OLED_WAKE_SPEED OLED_SLEEP_SPEED // below this wpm value your animation will idle
498
499#define OLED_KAKI_FRAMES 3
500#define OLED_KAKI_SPEED 40 // above this wpm value typing animation to triggere
501
502#define OLED_RTOGI_FRAMES 2
503//#define OLED_LTOGI_FRAMES 2
504
505//#define ANIM_FRAME_DURATION 500 // how long each frame lasts in ms
506// #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing
507#define OLED_ANIM_SIZE 32 // number of bytes in array, minimize for adequate firmware size, max is 1024
508#define OLED_ANIM_ROWS 4
509#define OLED_ANIM_MAX_FRAMES 3
510#if (OLED_SLEEP_FRAMES > OLED_ANIM_MAX_FRAMES) || (OLED_WAKE_FRAMES > OLED_ANIM_MAX_FRAMES) || (OLED_KAKI_FRAMES > OLED_ANIM_MAX_FRAMES) || (OLED_RTOGI_FRAMES > OLED_ANIM_MAX_FRAMES)
511# error frame size too large
512#endif
513
514static uint8_t animation_frame = 0;
515static uint8_t animation_type = 0;
516
517void render_kitty(void) {
518 // Images credit j-inc(/James Incandenza) and pixelbenny.
519 // Credit to obosob for initial animation approach.
520 // heavily modified by drashna because he's a glutton for punishment
521
522 // clang-format off
523 static const char PROGMEM animation[4][OLED_ANIM_MAX_FRAMES][OLED_ANIM_ROWS][OLED_ANIM_SIZE] = {
524 // sleep frames
525 {
526 {
527 {
528 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08,
529 0xa8, 0x48, 0xa8, 0x18, 0x08, 0x00, 0x00, 0x00,
530 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
531 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
532 },
533 {
534 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03,
535 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x80,
536 0x44, 0x84, 0x06, 0x05, 0x04, 0x80, 0x40, 0x20,
537 0x10, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
538 },
539 {
540 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20,
541 0x18, 0x04, 0x04, 0x02, 0x7a, 0x86, 0x01, 0x80,
542 0x80, 0x01, 0x03, 0x05, 0x07, 0x01, 0x00, 0x00,
543 0x80, 0x83, 0x45, 0xfa, 0x3c, 0xe0, 0x00, 0x00
544 },
545 {
546 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08,
547 0x10, 0x10, 0x10, 0x10, 0x10, 0x33, 0x24, 0x28,
548 0x28, 0x29, 0x29, 0x29, 0x3a, 0x18, 0x1c, 0x39,
549 0x24, 0x24, 0x3a, 0x2d, 0x26, 0x31, 0x1f, 0x00
550 }
551 },
552 {
553 {
554 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
555 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
556 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
557 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
558 },
559 {
560 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
561 0x22, 0x22, 0x3a, 0x2a, 0x26, 0x22, 0x80, 0xc0,
562 0x80, 0x00, 0x24, 0x34, 0x2c, 0xe4, 0x60, 0x10,
563 0x70, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
564 },
565 {
566 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x38,
567 0x04, 0x02, 0x02, 0x01, 0x79, 0x87, 0x01, 0x80,
568 0x81, 0x83, 0x05, 0x05, 0x03, 0x01, 0x00, 0x00,
569 0x80, 0x43, 0x05, 0xfa, 0x3c, 0xe0, 0x00, 0x00
570 },
571 {
572 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08,
573 0x10, 0x10, 0x10, 0x10, 0x10, 0x33, 0x24, 0x28,
574 0x28, 0x28, 0x29, 0x29, 0x3a, 0x18, 0x1c, 0x39,
575 0x24, 0x24, 0x3a, 0x2d, 0x26, 0x31, 0x1f, 0x00
576 }
577 }
578 },
579 // wake frames
580 {
581 {
582 {
583 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
584 0x00, 0x00, 0xc0, 0x30, 0x08, 0x10, 0x60, 0x80,
585 0x00, 0x80, 0x60, 0x10, 0x08, 0x30, 0xc0, 0x00,
586 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
587 },
588 {
589 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
590 0x00, 0x7f, 0x80, 0x40, 0x40, 0x5c, 0x00, 0x01,
591 0x41, 0x01, 0x00, 0x5c, 0x40, 0x40, 0x80, 0x7f,
592 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
593 },
594 {
595 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
596 0x40, 0x40, 0x80, 0xe1, 0x12, 0x0a, 0x06, 0x00,
597 0x80, 0x00, 0x06, 0x0a, 0x12, 0xe1, 0x80, 0x40,
598 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
599 },
600 {
601 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14,
602 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18,
603 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x11, 0x10, 0x10,
604 0x14, 0x14, 0x1f, 0x1c, 0x14, 0x14, 0x14, 0x08
605 }
606 },
607 {
608 {
609 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
610 0x00, 0x00, 0xc0, 0x30, 0x08, 0x10, 0x60, 0x80,
611 0x00, 0x80, 0x60, 0x10, 0x08, 0x30, 0xc0, 0x00,
612 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
613 },
614 {
615 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
616 0x00, 0x7f, 0x90, 0x12, 0x0a, 0x02, 0xf4, 0x09,
617 0x0d, 0xf1, 0x04, 0x02, 0x0a, 0x12, 0x90, 0x7f,
618 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
619 },
620 {
621 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
622 0x40, 0x40, 0x80, 0xe1, 0x12, 0x0a, 0x06, 0x01,
623 0x81, 0x00, 0x06, 0x0a, 0x12, 0xe1, 0x80, 0x40,
624 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
625 },
626 {
627 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14,
628 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18,
629 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x11, 0x10, 0x10,
630 0x14, 0x14, 0x1f, 0x1c, 0x14, 0x14, 0x14, 0x08
631 }
632 }
633 },
634 // kaki frames
635 {
636 {
637 {
638 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x40,
639 0x80, 0x80, 0x80, 0x00, 0xfc, 0x84, 0x08, 0x08,
640 0x10, 0x20, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00,
641 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
642 },
643 {
644 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1e, 0x60,
645 0x80, 0x00, 0x00, 0x91, 0xa1, 0x80, 0x00, 0x00,
646 0x22, 0x84, 0x40, 0x50, 0x48, 0xc1, 0x3e, 0x00,
647 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
648 },
649 {
650 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
651 0x40, 0x41, 0x82, 0xe2, 0x12, 0x0a, 0x06, 0x00,
652 0x80, 0x88, 0x4f, 0x02, 0x22, 0xe2, 0x9f, 0x40,
653 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
654 },
655 {
656 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14,
657 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18,
658 0x0f, 0x18, 0x14, 0x10, 0x10, 0x10, 0x10, 0x10,
659 0x14, 0x14, 0x1f, 0x1a, 0x0a, 0x0a, 0x04, 0x00
660 }
661 },
662 {
663 {
664 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
665 0x00, 0xf0, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80,
666 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
667 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
668 },
669 {
670 0x00, 0x00, 0x06, 0x1a, 0x22, 0xc2, 0x04, 0x04,
671 0x04, 0x07, 0x00, 0xc0, 0x20, 0x10, 0x80, 0x80,
672 0x01, 0x01, 0x02, 0xfc, 0xfe, 0x02, 0x3c, 0x20,
673 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
674 },
675 {
676 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x8d,
677 0x55, 0x50, 0x94, 0xf0, 0x10, 0x09, 0x08, 0x00,
678 0x80, 0x00, 0x06, 0x09, 0x1b, 0xee, 0x00, 0x00,
679 0x00, 0x00, 0x81, 0xfe, 0x00, 0x00, 0x00, 0x00
680 },
681 {
682 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14,
683 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18,
684 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x19, 0x18, 0x1c,
685 0x14, 0x16, 0x15, 0x14, 0x14, 0x14, 0x14, 0x08
686 }
687 },
688 {
689 {
690 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x80, 0x00,
691 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x20, 0x40,
692 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
693 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
694 },
695 {
696 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x01,
697 0x02, 0x04, 0x04, 0x03, 0x80, 0x40, 0x40, 0x20,
698 0x00, 0x01, 0x02, 0x8c, 0x70, 0x00, 0x00, 0x00,
699 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
700 },
701 {
702 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x8d,
703 0x55, 0x50, 0x94, 0xf0, 0x10, 0x0a, 0x0e, 0x1d,
704 0x95, 0x24, 0x24, 0x27, 0x13, 0xe1, 0x01, 0x01,
705 0x01, 0x01, 0x02, 0xfc, 0x00, 0x00, 0x00, 0x00
706 },
707 {
708 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14,
709 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18,
710 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x19, 0x18, 0x1c,
711 0x14, 0x14, 0x17, 0x14, 0x14, 0x14, 0x14, 0x08
712 }
713 }
714 },
715 // rtogi frames
716 {
717 {
718 {
719 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
720 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
721 0x00, 0xc0, 0x20, 0x10, 0x10, 0x08, 0x04, 0x02,
722 0x01, 0x0f, 0x90, 0x10, 0x20, 0xf0, 0xf8, 0xf8
723 },
724 {
725 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
726 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08,
727 0x48, 0x47, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00,
728 0x08, 0x88, 0xc7, 0xc4, 0x62, 0x23, 0x11, 0x3f
729 },
730 {
731 0x80, 0x40, 0x20, 0x10, 0x88, 0xcc, 0x43, 0x80,
732 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0,
733 0x80, 0x80, 0xc0, 0xe1, 0xfe, 0xb8, 0x88, 0x0c,
734 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
735 },
736 {
737 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
738 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04,
739 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03,
740 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
741 }
742 },
743 {
744 {
745 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
746 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
747 0x00, 0xc0, 0x20, 0x10, 0x10, 0x08, 0x04, 0x02,
748 0x01, 0x1f, 0xa0, 0x20, 0x40, 0x80, 0x00, 0xf0
749 },
750 {
751 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
752 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08,
753 0x48, 0x47, 0x88, 0x00, 0x00, 0x00, 0x00, 0x24,
754 0x24, 0x28, 0x6b, 0x40, 0xa0, 0x99, 0x86, 0xff
755 },
756 {
757 0x0f, 0x11, 0x22, 0x44, 0x48, 0x4c, 0x43, 0x80,
758 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0,
759 0x80, 0x80, 0xc0, 0xe1, 0xfe, 0xb8, 0x88, 0x0c,
760 0x04, 0x06, 0x06, 0x06, 0x0e, 0x0e, 0x06, 0x01
761 },
762 {
763 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
764 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04,
765 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03,
766 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
767 }
768 }
769 }
770 };
771 // clang-format on
772
773 for (uint8_t i = 0; i < 4; i++) {
774 oled_set_cursor(1, i + 2);
775 oled_write_raw_P(animation[animation_type][animation_frame][i], OLED_ANIM_SIZE);
776 }
777}
778
779uint32_t kitty_animation_phases(uint32_t triger_time, void *cb_arg) {
780 uint32_t anim_frame_duration = 500;
781 // can't change animation frame duration here, otherwise, it gets stuck.
782 // weirdly, it seems to work fine if it's in keymap.c but not here.
783 // Should move this block to the deferred execution?
784#ifdef POINTING_DEVICE_ENABLE
785 if (tap_toggling) {
786 animation_frame = (animation_frame + 1) % OLED_RTOGI_FRAMES;
787 animation_type = 3;
788 anim_frame_duration = 300;
789 } else
790#endif
791 {
792 if (get_current_wpm() <= OLED_SLEEP_SPEED) {
793 animation_frame = (animation_frame + 1) % OLED_SLEEP_FRAMES;
794 animation_type = 0;
795 anim_frame_duration = 500;
796 } else if (get_current_wpm() > OLED_WAKE_SPEED) {
797 animation_frame = (animation_frame + 1) % OLED_WAKE_FRAMES;
798 animation_type = 1;
799 anim_frame_duration = 800;
800 } else if (get_current_wpm() >= OLED_KAKI_SPEED) {
801 animation_frame = (animation_frame + 1) % OLED_KAKI_FRAMES;
802 animation_type = 2;
803 anim_frame_duration = 500;
804 }
805 }
806 return anim_frame_duration;
807}
808
809void oled_driver_render_logo_left(void) {
810#if defined(OLED_DISPLAY_VERBOSE)
811 oled_set_cursor(0, 2);
812 render_kitty();
813
814# if defined(KEYBOARD_handwired_tractyl_manuform)
815 oled_set_cursor(7, 0);
816 oled_write_P(PSTR("Tractyl"), true);
817# elif defined(KEYBOARD_bastardkb_charybdis)
818 oled_set_cursor(6, 0);
819 oled_write_P(PSTR("Charybdis"), true);
820# else
821 oled_set_cursor(8, 0);
822 oled_write_P(PSTR("Left"), true);
823# endif
824 oled_set_cursor(7, 2);
825# if defined(DEBUG_MATRIX_SCAN_RATE)
372 render_matrix_scan_rate(); 826 render_matrix_scan_rate();
373# elif defined(WPM_ENABLE) 827# elif defined(WPM_ENABLE)
374 render_wpm(0); 828 render_wpm(1);
375# endif 829# endif
376 oled_write_P(PSTR(" "), false); 830 oled_set_cursor(7, 3);
377# if defined(KEYBOARD_handwired_tractyl_manuform) || defined(KEYBOARD_bastardkb_charybdis) 831# if defined(KEYBOARD_handwired_tractyl_manuform)
832 render_pointing_dpi_status(0);
833# elif defined(KEYBOARD_bastardkb_charybdis)
378 render_pointing_dpi_status(1); 834 render_pointing_dpi_status(1);
379# endif 835# endif
380 oled_set_cursor(0, 4); 836 oled_set_cursor(0, 6);
381#else 837#else
382 render_default_layer_state(); 838 render_default_layer_state();
383#endif 839#endif
384} 840}
385 841
386void render_status_secondary(void) { 842void render_status_secondary(void) {
843# if defined(KEYBOARD_handwired_tractyl_manuform)
844 oled_set_cursor(7, 0);
845 oled_write_P(PSTR("Manuform"), true);
846# elif defined(KEYBOARD_bastardkb_charybdis)
847 oled_set_cursor(6, 0);
848 oled_write_P(PSTR("Charybdis"), true);
849# else
850 oled_set_cursor(8, 0);
851 oled_write_P(PSTR("Right"), true);
852# endif
387 oled_driver_render_logo_right(); 853 oled_driver_render_logo_right();
388 /* Show Keyboard Layout */ 854 /* Show Keyboard Layout */
389 render_layer_state(); 855 render_layer_state();
390 render_mod_status(get_mods() | get_oneshot_mods()); 856 render_mod_status(get_mods() | get_oneshot_mods());
391#if !defined(OLED_DISPLAY_128X64) && defined(WPM_ENABLE) && !defined(CONVERT_TO_PROTON_C) 857#if !defined(OLED_DISPLAY_VERBOSE) && defined(WPM_ENABLE) && !defined(CONVERT_TO_PROTON_C)
392 render_wpm(2); 858 render_wpm(2);
393#endif 859#endif
394 // render_keylock_status(host_keyboard_leds()); 860 render_keylock_status(host_keyboard_leds());
395} 861}
396 862
397void render_status_main(void) { 863void render_status_main(void) {
398 oled_driver_render_logo_left(); 864 oled_driver_render_logo_left();
399 865
400 /* Show Keyboard Layout */ 866 /* Show Keyboard Layout */
401 // render_keylock_status(host_keyboard_leds());
402 render_bootmagic_status(); 867 render_bootmagic_status();
403 render_user_status(); 868 render_user_status();
404 869
@@ -408,8 +873,14 @@ void render_status_main(void) {
408__attribute__((weak)) oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return rotation; } 873__attribute__((weak)) oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return rotation; }
409 874
410oled_rotation_t oled_init_user(oled_rotation_t rotation) { 875oled_rotation_t oled_init_user(oled_rotation_t rotation) {
411 memset(keylog_str, ' ', sizeof(keylog_str) - 1); 876 if (is_keyboard_master()) {
877 memset(keylog_str, ' ', OLED_KEYLOGGER_LENGTH);
878 }
879
880 kittoken = defer_exec(3000, kitty_animation_phases, NULL);
412 881
882 oled_clear();
883 oled_render();
413 return oled_init_keymap(rotation); 884 return oled_init_keymap(rotation);
414} 885}
415 886
@@ -417,22 +888,61 @@ bool oled_task_user(void) {
417 update_log(); 888 update_log();
418 889
419 if (is_keyboard_master()) { 890 if (is_keyboard_master()) {
891#ifndef OLED_DISPLAY_TEST
420 if (timer_elapsed32(oled_timer) > 30000) { 892 if (timer_elapsed32(oled_timer) > 30000) {
421 oled_off(); 893 oled_off();
422 return false; 894 return false;
423 } else { 895 } else
896#endif
897 {
424 oled_on(); 898 oled_on();
425 } 899 }
426 } 900 }
901#if defined(OLED_DISPLAY_VERBOSE)
902 static const char PROGMEM header_image[] = {
903 0,192, 32, 16, 8, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 7, 15, 31, 63,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,127, 63, 31, 15, 7, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 8, 16, 32,192, 0,
904 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 7, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 7, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, 0
905 };
906 static const char PROGMEM footer_image[] = {
907 0, 3, 4, 8, 16, 32, 64,128,128,128,128,128,128,128,192,224,240,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,240,224,192,128,128,128,128,128,128,128, 64, 32, 16, 8, 4, 3, 0
908 };
909 oled_write_raw_P(header_image, sizeof(header_image));
910 oled_set_cursor(0, 1);
911#endif
912
913#ifndef OLED_DISPLAY_TEST
427 if (is_keyboard_left()) { 914 if (is_keyboard_left()) {
915#endif
428 render_status_main(); // Renders the current keyboard state (layer, lock, caps, scroll, etc) 916 render_status_main(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
917#ifndef OLED_DISPLAY_TEST
429 } else { 918 } else {
430 render_status_secondary(); 919 render_status_secondary();
431 } 920 }
432 if (is_keyboard_master()) { 921#endif
922
923#if defined(OLED_DISPLAY_128X128)
924 if (is_keyboard_left()) {
433 render_keylogger_status(); 925 render_keylogger_status();
434 } else {
435 render_keylock_status(host_keyboard_leds());
436 } 926 }
927#endif
928
929#if defined(OLED_DISPLAY_VERBOSE)
930 uint8_t num_of_rows;
931# if defined(OLED_DISPLAY_128X128)
932 num_of_rows = 15;
933# else
934 num_of_rows = 7;
935# endif
936 for (uint8_t i= 1; i < num_of_rows; i++) {
937 oled_set_cursor(0, i);
938 oled_write_raw_P(display_border, sizeof(display_border));
939 oled_set_cursor(21, i);
940 oled_write_raw_P(display_border, sizeof(display_border));
941 }
942
943 oled_set_cursor(0, num_of_rows);
944 oled_write_raw_P(footer_image, sizeof(footer_image));
945#endif
946
437 return false; 947 return false;
438} 948}