diff options
Diffstat (limited to 'users/drashna/oled')
-rw-r--r-- | users/drashna/oled/oled_config.h | 63 | ||||
-rw-r--r-- | users/drashna/oled/oled_stuff.c | 24 | ||||
-rw-r--r-- | users/drashna/oled/oled_stuff.h | 2 |
3 files changed, 80 insertions, 9 deletions
diff --git a/users/drashna/oled/oled_config.h b/users/drashna/oled/oled_config.h new file mode 100644 index 0000000000..c46c0c39ce --- /dev/null +++ b/users/drashna/oled/oled_config.h @@ -0,0 +1,63 @@ +// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#ifndef OLED_UPDATE_INTERVAL +# ifdef OLED_DRIVER_SH1107 +# define OLED_UPDATE_INTERVAL 75 +# else +# ifdef SPLIT_KEYBOARD +# define OLED_UPDATE_INTERVAL 60 +# else +# define OLED_UPDATE_INTERVAL 15 +# endif +# endif +#endif +#define OLED_DISABLE_TIMEOUT +#ifdef OLED_FONT_H +# undef OLED_FONT_H +#endif +#define OLED_FONT_H "oled/drashna_font.h" +#define OLED_FONT_END 255 +// # define OLED_FONT_5X5 +// # define OLED_FONT_AZTECH +// # define OLED_FONT_BMPLAIN +// # define OLED_FONT_CRACKERS +#define OLED_FONT_DEAD_MEAL +// # define OLED_FONT_EIN +// # define OLED_FONT_HISKYF21 +// # define OLED_FONT_SQUASH +// # define OLED_FONT_ZXPIX +// # define OLED_FONT_SUPER_DIGG + +// # define OLED_LOGO_BEBOP +// # define OLED_LOGO_CORNE +// # define OLED_LOGO_GMK_BAD +// # define OLED_LOGO_GOTHAM +// # define OLED_LOGO_HUE_MANITEE +// # define OLED_LOGO_LOOSE +#define OLED_LOGO_SCIFI +// # define OLED_LOGO_SETS3N +// # define OLED_LOGO_SKEEB + +#ifdef OLED_DRIVER_SH1107 +# define OLED_DISPLAY_CUSTOM +# define OLED_IC_SH1107 2 +# define OLED_DISPLAY_128X128 +# define OLED_DISPLAY_WIDTH 128 +# define OLED_DISPLAY_HEIGHT 128 +# define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) +# define OLED_BLOCK_TYPE uint32_t +# define OLED_SOURCE_MAP \ + { 0, 8, 16, 24, 32, 40, 48, 56 } +# define OLED_TARGET_MAP \ + { 56, 48, 40, 32, 24, 16, 8, 0 } +# define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) +# define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) +# define OLED_COM_PINS COM_PINS_ALT +# define OLED_IC OLED_IC_SH1107 +# ifndef OLED_BRIGHTNESS +# define OLED_BRIGHTNESS 50 +# endif +#endif diff --git a/users/drashna/oled/oled_stuff.c b/users/drashna/oled/oled_stuff.c index 5baf5b558b..e082f8ab3e 100644 --- a/users/drashna/oled/oled_stuff.c +++ b/users/drashna/oled/oled_stuff.c @@ -28,6 +28,8 @@ #endif #include <string.h> +bool is_oled_enabled = true; + extern bool host_driver_disabled; uint32_t oled_timer = 0; @@ -850,7 +852,7 @@ void render_status_right(void) { render_layer_state(1, 2); render_mod_status(get_mods() | get_oneshot_mods(), 1, 5); #if !defined(OLED_DISPLAY_VERBOSE) && defined(WPM_ENABLE) && !defined(STM32F303xC) - render_wpm(2); + render_wpm(2, 7, 1); #endif render_keylock_status(host_keyboard_led_state(), 1, 6); } @@ -929,16 +931,14 @@ __attribute__((weak)) bool oled_task_keymap(void) { } bool oled_task_user(void) { - if (is_keyboard_master()) { #ifndef OLED_DISPLAY_TEST - if (timer_elapsed32(oled_timer) > 60000) { - oled_off(); - return false; - } else + if (!is_oled_enabled) { + oled_off(); + return false; + } else #endif - { - oled_on(); - } + { + oled_on(); } if (!oled_task_keymap()) { @@ -990,3 +990,9 @@ bool oled_task_user(void) { return false; } + +extern bool oled_initialized; + +__attribute__((weak)) void matrix_scan_oled(void) { + is_oled_enabled = !(timer_elapsed32(oled_timer) > 60000); +} diff --git a/users/drashna/oled/oled_stuff.h b/users/drashna/oled/oled_stuff.h index 17bd9319d1..df1a6d1805 100644 --- a/users/drashna/oled/oled_stuff.h +++ b/users/drashna/oled/oled_stuff.h @@ -44,6 +44,8 @@ void render_wpm_graph(uint8_t max_lines_graph, uint8_t vertical_offse void render_kitty(uint8_t col, uint8_t line); void render_unicode_mode(uint8_t col, uint8_t line); void render_rgb_hsv(uint8_t col, uint8_t line); +void render_mouse_mode(uint8_t col, uint8_t line); +void matrix_scan_oled(void); void oled_pan_section(bool left, uint16_t y_start, uint16_t y_end, uint16_t x_start, uint16_t x_end); |