diff options
Diffstat (limited to 'users/drashna/oled')
-rw-r--r-- | users/drashna/oled/oled_stuff.c | 290 | ||||
-rw-r--r-- | users/drashna/oled/sh110x.c | 86 |
2 files changed, 84 insertions, 292 deletions
diff --git a/users/drashna/oled/oled_stuff.c b/users/drashna/oled/oled_stuff.c index 752829e0fa..2a26b8b638 100644 --- a/users/drashna/oled/oled_stuff.c +++ b/users/drashna/oled/oled_stuff.c @@ -19,6 +19,9 @@ #ifdef UNICODE_COMMON_ENABLE # include "process_unicode_common.h" #endif +# ifdef AUDIO_CLICKY +# include "process_clicky.h" +# endif #include <string.h> extern bool host_driver_disabled; @@ -26,7 +29,9 @@ extern bool host_driver_disabled; uint32_t oled_timer = 0; char keylog_str[OLED_KEYLOGGER_LENGTH] = {0}; static uint16_t log_timer = 0; +#ifdef OLED_DISPLAY_VERBOSE static const char PROGMEM display_border[3] = {0x0, 0xFF, 0x0}; +#endif deferred_token kittoken; @@ -101,12 +106,6 @@ bool process_record_user_oled(uint16_t keycode, keyrecord_t *record) { return true; } -void update_log(void) { - if (timer_elapsed(log_timer) > 750) { - // add_keylog(0); - } -} - /** * @brief Renders keylogger buffer to oled * @@ -448,20 +447,24 @@ void render_bootmagic_status(void) { #endif } -#if defined(POINTING_DEVICE_ENABLE) +#if defined(CUSTOM_POINTING_DEVICE) extern bool tap_toggling; #endif void render_user_status(void) { #ifdef AUDIO_ENABLE - bool is_audio_on = false, is_clicky_on = false; + bool is_audio_on = false, l_is_clicky_on = false; # ifdef SPLIT_KEYBOARD - is_audio_on = user_state.audio_enable; - is_clicky_on = user_state.audio_clicky_enable; + is_audio_on = user_state.audio_enable; +# ifdef AUDIO_CLICKY + l_is_clicky_on = user_state.audio_clicky_enable; +# endif # else is_audio_on = is_audio_on(); - is_clicky_on = is_clicky_on(); +# ifdef AUDIO_CLICKY + l_is_clicky_on = is_clicky_on(); +# endif # endif #endif #if defined(OLED_DISPLAY_VERBOSE) @@ -476,7 +479,7 @@ void render_user_status(void) { # if !defined(OLED_DISPLAY_VERBOSE) oled_write_P(PSTR(" "), false); # endif -#elif defined(POINTING_DEVICE_ENABLE) +#elif defined(CUSTOM_POINTING_DEVICE) static const char PROGMEM mouse_lock[3] = {0xF2, 0xF3, 0}; oled_write_P(mouse_lock, tap_toggling); #endif @@ -486,7 +489,7 @@ void render_user_status(void) { # ifdef AUDIO_CLICKY static const char PROGMEM audio_clicky_status[2][3] = {{0xF4, 0xF5, 0}, {0xF6, 0xF7, 0}}; - oled_write_P(audio_clicky_status[is_clicky_on && is_audio_on], false); + oled_write_P(audio_clicky_status[l_is_clicky_on && is_audio_on], false); # if !defined(OLED_DISPLAY_VERBOSE) oled_write_P(PSTR(" "), false); # endif @@ -540,6 +543,7 @@ void render_wpm(uint8_t padding) { // vertical_offset = 0; void render_wpm_graph(uint8_t max_lines_graph, uint8_t vertical_offset) { +#ifdef WPM_ENABLE static uint16_t timer = 0; static uint8_t x = OLED_DISPLAY_HEIGHT - 1; uint8_t currwpm = get_current_wpm(); @@ -588,6 +592,7 @@ void render_wpm_graph(uint8_t max_lines_graph, uint8_t vertical_offset) { timer = timer_read(); // refresh the timer for the next iteration } +#endif } #if defined(POINTING_DEVICE_ENABLE) @@ -625,7 +630,7 @@ __attribute__((weak)) void oled_driver_render_logo_right(void) { //#define ANIM_FRAME_DURATION 500 // how long each frame lasts in ms // #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing -#define OLED_ANIM_SIZE 32 // number of bytes in array, minimize for adequate firmware size, max is 1024 +#define OLED_ANIM_SIZE 36 #define OLED_ANIM_ROWS 4 #define OLED_ANIM_MAX_FRAMES 3 #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) @@ -645,247 +650,67 @@ void render_kitty(void) { // sleep frames { { - { - 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 - }, - { - 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 - }, - { - 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 - }, - { - 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 - } + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 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, 0x00, 0x00, 0x00, 0x00 - }, - { - 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 - }, - { - 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 - }, - { - 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 - } + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 } } }, // wake frames { { - { - 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 - }, - { - 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 - }, - { - 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 - }, - { - 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 - } + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 } }, { - { - 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 - }, - { - 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 - }, - { - 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 - }, - { - 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 - } + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 } } }, // kaki frames { { - { - 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 - }, - { - 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 - }, - { - 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 - }, - { - 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 - } + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 } }, { - { - 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 - }, - { - 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 - }, - { - 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 - }, - { - 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 - } + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 } }, { - { - 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 - }, - { - 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 - }, - { - 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 - }, - { - 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 - } + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 } } }, // rtogi frames { { - { - 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 - }, - { - 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 - }, - { - 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 - }, - { - 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 - } + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 } }, { - { - 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 - }, - { - 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 - }, - { - 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 - }, - { - 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 - } + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 }, + { 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, 0x00, 0x00, 0x00, 0x00 } } } }; @@ -899,7 +724,7 @@ void render_kitty(void) { uint32_t kitty_animation_phases(uint32_t triger_time, void *cb_arg) { static uint32_t anim_frame_duration = 500; -#ifdef POINTING_DEVICE_ENABLE +#ifdef CUSTOM_POINTING_DEVICE if (tap_toggling) { animation_frame = (animation_frame + 1) % OLED_RTOGI_FRAMES; animation_type = 3; @@ -953,7 +778,7 @@ void oled_driver_render_logo_left(void) { render_matrix_scan_rate(2); # endif oled_set_cursor(7, 2); -# if defined(KEYBOARD_bastardkb_charybdis) || defined(KEYBOARD_handwired_tractyl_manuform) +# if (defined(KEYBOARD_bastardkb_charybdis) || defined(KEYBOARD_handwired_tractyl_manuform)) && defined(POINTING_DEVICE_ENABLE) render_pointing_dpi_status(charybdis_get_pointer_sniping_enabled() ? charybdis_get_pointer_sniping_dpi() : charybdis_get_pointer_default_dpi(), 1); // credit and thanks to jaspertandy on discord for these images @@ -1054,7 +879,6 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) { __attribute__((weak)) bool oled_task_keymap(void) { return true; } bool oled_task_user(void) { - update_log(); if (is_keyboard_master()) { #ifndef OLED_DISPLAY_TEST diff --git a/users/drashna/oled/sh110x.c b/users/drashna/oled/sh110x.c index c850a47538..cfdae1db16 100644 --- a/users/drashna/oled/sh110x.c +++ b/users/drashna/oled/sh110x.c @@ -26,8 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "keyboard.h" -// Used commands from spec sheet: https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf -// for SH1106: https://www.velleman.eu/downloads/29/infosheets/sh1106_datasheet.pdf +// for SH1107: https://www.displayfuture.com/Display/datasheet/controller/SH1107.pdf // Fundamental Commands #define CONTRAST 0x81 @@ -97,17 +96,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define OLED_ALL_BLOCKS_MASK (((((OLED_BLOCK_TYPE)1 << (OLED_BLOCK_COUNT - 1)) - 1) << 1) | 1) -#define OLED_IC_HAS_HORIZONTAL_MODE (OLED_IC == OLED_IC_SSD1306) -#define OLED_IC_COM_PINS_ARE_COLUMNS (OLED_IC == OLED_IC_SH1107) - #ifndef OLED_COM_PIN_COUNT -# if OLED_IC == OLED_IC_SH1106 -# define OLED_COM_PIN_COUNT 64 -# elif OLED_IC == OLED_IC_SH1107 -# define OLED_COM_PIN_COUNT 128 -# else -# error Invalid OLED_IC value -# endif +# define OLED_COM_PIN_COUNT 128 #endif #ifndef OLED_COM_PIN_OFFSET @@ -203,24 +193,12 @@ bool oled_init(oled_rotation_t rotation) { DISPLAY_CLOCK, 0x80, MULTIPLEX_RATIO, -#if OLED_IC_COM_PINS_ARE_COLUMNS OLED_DISPLAY_WIDTH - 1, -#else - OLED_DISPLAY_HEIGHT - 1, -#endif - DISPLAY_OFFSET, + SH1107_DISPLAY_START_LINE, 0x00, - DISPLAY_START_LINE | 0x00, CHARGE_PUMP, 0x14, -#if (OLED_IC != OLED_IC_SH1106) - // MEMORY_MODE is unsupported on SH1106 (Page Addressing only) - MEMORY_MODE, - 0x00, // Horizontal addressing mode -#elif OLED_IC == OLED_IC_SH1107 - // Page addressing mode SH1107_MEMORY_MODE_PAGE, -#endif }; if (I2C_TRANSMIT_P(display_setup1) != I2C_STATUS_SUCCESS) { print("oled_init cmd set 1 failed\n"); @@ -229,7 +207,11 @@ bool oled_init(oled_rotation_t rotation) { if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_180)) { static const uint8_t PROGMEM display_normal[] = { - I2C_CMD, SEGMENT_REMAP_INV, COM_SCAN_DEC, DISPLAY_OFFSET, OLED_COM_PIN_OFFSET, + I2C_CMD, + SEGMENT_REMAP_INV, + COM_SCAN_DEC, + DISPLAY_OFFSET, + OLED_COM_PIN_OFFSET, }; if (I2C_TRANSMIT_P(display_normal) != I2C_STATUS_SUCCESS) { print("oled_init cmd normal rotation failed\n"); @@ -237,7 +219,11 @@ bool oled_init(oled_rotation_t rotation) { } } else { static const uint8_t PROGMEM display_flipped[] = { - I2C_CMD, SEGMENT_REMAP, COM_SCAN_INC, DISPLAY_OFFSET, (OLED_COM_PIN_COUNT - OLED_COM_PIN_OFFSET) % OLED_COM_PIN_COUNT, + I2C_CMD, + SEGMENT_REMAP, + COM_SCAN_INC, + DISPLAY_OFFSET, + (OLED_COM_PIN_COUNT - OLED_COM_PIN_OFFSET) % OLED_COM_PIN_COUNT, }; if (I2C_TRANSMIT_P(display_flipped) != I2C_STATUS_SUCCESS) { print("display_flipped failed\n"); @@ -245,7 +231,18 @@ bool oled_init(oled_rotation_t rotation) { } } - static const uint8_t PROGMEM display_setup2[] = {I2C_CMD, COM_PINS, OLED_COM_PINS, CONTRAST, OLED_BRIGHTNESS, PRE_CHARGE_PERIOD, 0x22, VCOM_DETECT, 0x35, DISPLAY_ALL_ON_RESUME, NORMAL_DISPLAY, DEACTIVATE_SCROLL, DISPLAY_ON}; if (I2C_TRANSMIT_P(display_setup2) != I2C_STATUS_SUCCESS) { + static const uint8_t PROGMEM display_setup2[] = { + I2C_CMD, COM_PINS, + OLED_COM_PINS, + CONTRAST, OLED_BRIGHTNESS, + PRE_CHARGE_PERIOD, 0x22, + VCOM_DETECT, 0x35, + DISPLAY_ALL_ON_RESUME, + NORMAL_DISPLAY, + DEACTIVATE_SCROLL, + DISPLAY_ON + }; + if (I2C_TRANSMIT_P(display_setup2) != I2C_STATUS_SUCCESS) { print("display_setup2 failed\n"); return false; } @@ -277,22 +274,11 @@ static void calc_bounds(uint8_t update_start, uint8_t *cmd_array) { // Calculate commands to set memory addressing bounds. uint8_t start_page = OLED_BLOCK_SIZE * update_start / OLED_DISPLAY_WIDTH; uint8_t start_column = OLED_BLOCK_SIZE * update_start % OLED_DISPLAY_WIDTH; -#if !OLED_IC_HAS_HORIZONTAL_MODE // Commands for Page Addressing Mode. Sets starting page and column; has no end bound. // Column value must be split into high and low nybble and sent as two commands. cmd_array[0] = PAM_PAGE_ADDR | start_page; cmd_array[1] = PAM_SETCOLUMN_LSB | ((OLED_COLUMN_OFFSET + start_column) & 0x0f); cmd_array[2] = PAM_SETCOLUMN_MSB | ((OLED_COLUMN_OFFSET + start_column) >> 4 & 0x0f); - cmd_array[3] = NOP; - cmd_array[4] = NOP; - cmd_array[5] = NOP; -#else - // Commands for use in Horizontal Addressing mode. - cmd_array[1] = start_column + OLED_COLUMN_OFFSET; - cmd_array[4] = start_page; - cmd_array[2] = (OLED_BLOCK_SIZE + OLED_DISPLAY_WIDTH - 1) % OLED_DISPLAY_WIDTH + cmd_array[1]; - cmd_array[5] = (OLED_BLOCK_SIZE + OLED_DISPLAY_WIDTH - 1) / OLED_DISPLAY_WIDTH - 1 + cmd_array[4]; -#endif } static void calc_bounds_90(uint8_t update_start, uint8_t *cmd_array) { @@ -310,19 +296,12 @@ static void calc_bounds_90(uint8_t update_start, uint8_t *cmd_array) { // Top page number for a block which is at the bottom edge of the screen. const uint8_t bottom_block_top_page = (height_in_pages - page_inc_per_block) % height_in_pages; -#if !OLED_IC_HAS_HORIZONTAL_MODE // Only the Page Addressing Mode is supported uint8_t start_page = bottom_block_top_page - (OLED_BLOCK_SIZE * update_start % OLED_DISPLAY_HEIGHT / 8); uint8_t start_column = OLED_BLOCK_SIZE * update_start / OLED_DISPLAY_HEIGHT * 8; cmd_array[0] = PAM_PAGE_ADDR | start_page; cmd_array[1] = PAM_SETCOLUMN_LSB | ((OLED_COLUMN_OFFSET + start_column) & 0x0f); cmd_array[2] = PAM_SETCOLUMN_MSB | ((OLED_COLUMN_OFFSET + start_column) >> 4 & 0x0f); -#else - cmd_array[1] = OLED_BLOCK_SIZE * update_start / OLED_DISPLAY_HEIGHT * 8 + OLED_COLUMN_OFFSET; - cmd_array[4] = bottom_block_top_page - (OLED_BLOCK_SIZE * update_start % OLED_DISPLAY_HEIGHT / 8); - cmd_array[2] = (OLED_BLOCK_SIZE + OLED_DISPLAY_HEIGHT - 1) / OLED_DISPLAY_HEIGHT * 8 - 1 + cmd_array[1]; - cmd_array[5] = (OLED_BLOCK_SIZE + OLED_DISPLAY_HEIGHT - 1) % OLED_DISPLAY_HEIGHT / 8 + cmd_array[4]; -#endif } uint8_t crot(uint8_t a, int8_t n) { @@ -358,11 +337,7 @@ void oled_render(void) { } // Set column & page position -#if OLED_IC_HAS_HORIZONTAL_MODE - static uint8_t display_start[] = {I2C_CMD, COLUMN_ADDR, 0, OLED_DISPLAY_WIDTH - 1, PAGE_ADDR, 0, OLED_DISPLAY_HEIGHT / 8 - 1}; -#else static uint8_t display_start[] = {I2C_CMD, PAM_PAGE_ADDR, PAM_SETCOLUMN_LSB, PAM_SETCOLUMN_MSB}; -#endif if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) { calc_bounds(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start } else { @@ -392,13 +367,6 @@ void oled_render(void) { rotate_90(&oled_buffer[OLED_BLOCK_SIZE * update_start + source_map[i]], &temp_buffer[target_map[i]]); } -#if OLED_IC_HAS_HORIZONTAL_MODE - // Send render data chunk after rotating - if (I2C_WRITE_REG(I2C_DATA, &temp_buffer[0], OLED_BLOCK_SIZE) != I2C_STATUS_SUCCESS) { - print("oled_render90 data failed\n"); - return; - } -#else // For SH1106 or SH1107 the data chunk must be split into separate pieces for each page const uint8_t columns_in_block = (OLED_BLOCK_SIZE + OLED_DISPLAY_HEIGHT - 1) / OLED_DISPLAY_HEIGHT * 8; const uint8_t num_pages = OLED_BLOCK_SIZE / columns_in_block; @@ -417,7 +385,6 @@ void oled_render(void) { return; } } -#endif } // Turn on display if it is off @@ -825,7 +792,7 @@ void oled_task(void) { } #else oled_set_cursor(0, 0); - oled_task_kb(); + oled_task_kbr(); #endif #if OLED_SCROLL_TIMEOUT > 0 @@ -856,5 +823,6 @@ void oled_task(void) { #endif } + __attribute__((weak)) bool oled_task_kb(void) { return oled_task_user(); } __attribute__((weak)) bool oled_task_user(void) { return true; } |