summaryrefslogtreecommitdiff
path: root/users/drashna/oled
diff options
context:
space:
mode:
Diffstat (limited to 'users/drashna/oled')
-rw-r--r--users/drashna/oled/oled_stuff.c245
-rw-r--r--users/drashna/oled/oled_stuff.h191
-rw-r--r--users/drashna/oled/sh110x.c58
3 files changed, 286 insertions, 208 deletions
diff --git a/users/drashna/oled/oled_stuff.c b/users/drashna/oled/oled_stuff.c
index 8c76897fba..5baf5b558b 100644
--- a/users/drashna/oled/oled_stuff.c
+++ b/users/drashna/oled/oled_stuff.c
@@ -34,7 +34,7 @@ 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};
+const char PROGMEM display_border[3] = {0x0, 0xFF, 0x0};
#endif
deferred_token kittoken;
@@ -117,9 +117,9 @@ void oled_timer_reset(void) {
* @brief Renders keylogger buffer to oled
*
*/
-void render_keylogger_status(void) {
+void render_keylogger_status(uint8_t col, uint8_t line) {
#ifdef OLED_DISPLAY_VERBOSE
- oled_set_cursor(1, 6);
+ oled_set_cursor(col, line);
#endif
oled_write_P(PSTR(OLED_RENDER_KEYLOGGER), false);
oled_write(keylog_str, false);
@@ -132,9 +132,9 @@ void render_keylogger_status(void) {
* @brief Renders default layer state (aka layout) to oled
*
*/
-void render_default_layer_state(void) {
+void render_default_layer_state(uint8_t col, uint8_t line) {
#ifdef OLED_DISPLAY_VERBOSE
- oled_set_cursor(1, 1);
+ oled_set_cursor(col, line);
#endif
oled_write_P(PSTR(OLED_RENDER_LAYOUT_NAME), false);
switch (get_highest_layer(default_layer_state)) {
@@ -160,7 +160,7 @@ void render_default_layer_state(void) {
* @brief Renders the active layers to the OLED
*
*/
-void render_layer_state(void) {
+void render_layer_state(uint8_t col, uint8_t line) {
#ifdef OLED_DISPLAY_VERBOSE
// clang-format off
static const char PROGMEM tri_layer_image[][3][24] = {
@@ -286,33 +286,33 @@ void render_layer_state(void) {
layer_is[2] = 5;
}
- oled_set_cursor(1, 2);
+ oled_set_cursor(col, line);
oled_write_raw_P(tri_layer_image[layer_is[0]][0], sizeof(tri_layer_image[0][0]));
- oled_set_cursor(5, 2);
+ oled_set_cursor(col + 4, line);
oled_write_raw_P(tri_layer_image[layer_is[1]][0], sizeof(tri_layer_image[0][0]));
- oled_set_cursor(9, 2);
+ oled_set_cursor(col + 8, line);
oled_write_raw_P(tri_layer_image[layer_is[2]][0], sizeof(tri_layer_image[0][0]));
- oled_set_cursor(14, 2);
+ oled_set_cursor(col + 13, line);
oled_write_P(PSTR("Diablo2"), layer_state_is(_DIABLOII));
oled_advance_page(true);
- oled_set_cursor(1, 3);
+ oled_set_cursor(col, line + 1);
oled_write_raw_P(tri_layer_image[layer_is[0]][1], sizeof(tri_layer_image[0][0]));
- oled_set_cursor(5, 3);
+ oled_set_cursor(col + 4, line + 1);
oled_write_raw_P(tri_layer_image[layer_is[1]][1], sizeof(tri_layer_image[0][0]));
- oled_set_cursor(9, 3);
+ oled_set_cursor(col + 8, line + 1);
oled_write_raw_P(tri_layer_image[layer_is[2]][1], sizeof(tri_layer_image[0][0]));
- oled_set_cursor(14, 3);
+ oled_set_cursor(col + 13, line + 1);
oled_write_P(PSTR("Diablo3"), layer_state_is(_DIABLO));
oled_advance_page(true);
- oled_set_cursor(1, 4);
+ oled_set_cursor(col, line + 2);
oled_write_raw_P(tri_layer_image[layer_is[0]][2], sizeof(tri_layer_image[0][0]));
- oled_set_cursor(5, 4);
+ oled_set_cursor(col + 4, line + 2);
oled_write_raw_P(tri_layer_image[layer_is[1]][2], sizeof(tri_layer_image[0][0]));
- oled_set_cursor(9, 4);
+ oled_set_cursor(col + 8, line + 2);
oled_write_raw_P(tri_layer_image[layer_is[2]][2], sizeof(tri_layer_image[0][0]));
- oled_set_cursor(14, 4);
+ oled_set_cursor(col + 13, line + 2);
oled_write_P(PSTR("Media"), layer_state_is(_MEDIA));
#else
oled_write_P(PSTR(OLED_RENDER_LAYER_NAME), false);
@@ -327,9 +327,12 @@ void render_layer_state(void) {
*
* @param led_usb_state Current keyboard led state
*/
-void render_keylock_status(led_t led_usb_state) {
+void render_keylock_status(led_t led_usb_state, uint8_t col, uint8_t line) {
#if defined(OLED_DISPLAY_VERBOSE)
- oled_set_cursor(1, 6);
+ oled_set_cursor(col, line);
+#endif
+#ifdef CAPS_WORD_ENABLE
+ led_usb_state.caps_lock |= is_caps_word_on();
#endif
oled_write_P(PSTR(OLED_RENDER_LOCK_NAME), false);
#if !defined(OLED_DISPLAY_VERBOSE)
@@ -348,8 +351,9 @@ void render_keylock_status(led_t led_usb_state) {
* @brief Renders the matrix scan rate to the host system
*
*/
-void render_matrix_scan_rate(uint8_t padding) {
+void render_matrix_scan_rate(uint8_t padding, uint8_t col, uint8_t line) {
#ifdef DEBUG_MATRIX_SCAN_RATE
+ oled_set_cursor(col, line);
oled_write_P(PSTR("MS:"), false);
if (padding) {
for (uint8_t n = padding; n > 0; n--) {
@@ -365,10 +369,10 @@ void render_matrix_scan_rate(uint8_t padding) {
*
* @param modifiers Modifiers to check against (real, weak, onesheot, etc;)
*/
-void render_mod_status(uint8_t modifiers) {
+void render_mod_status(uint8_t modifiers, uint8_t col, uint8_t line) {
static const char PROGMEM mod_status[5][3] = {{0xE8, 0xE9, 0}, {0xE4, 0xE5, 0}, {0xE6, 0xE7, 0}, {0xEA, 0xEB, 0}, {0xEC, 0xED, 0}};
#if defined(OLED_DISPLAY_VERBOSE)
- oled_set_cursor(1, 5);
+ oled_set_cursor(col, line);
#endif
oled_write_P(PSTR(OLED_RENDER_MODS_NAME), false);
#if defined(OLED_DISPLAY_VERBOSE)
@@ -393,7 +397,7 @@ void render_mod_status(uint8_t modifiers) {
extern bool swap_hands;
#endif
-void render_bootmagic_status(void) {
+void render_bootmagic_status(uint8_t col, uint8_t line) {
/* Show Ctrl-Gui Swap options */
static const char PROGMEM logo[][2][3] = {
{{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
@@ -402,7 +406,8 @@ void render_bootmagic_status(void) {
bool is_bootmagic_on;
#ifdef OLED_DISPLAY_VERBOSE
- oled_set_cursor(7, 3);
+ oled_set_cursor(col, line);
+ // oled_set_cursor(7, 3);
is_bootmagic_on = !keymap_config.swap_lctl_lgui;
#else
is_bootmagic_on = keymap_config.swap_lctl_lgui;
@@ -435,7 +440,7 @@ void render_bootmagic_status(void) {
oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NOGUI), keymap_config.no_gui);
#endif
#ifdef OLED_DISPLAY_VERBOSE
- oled_set_cursor(7, 4);
+ oled_set_cursor(col, line + 1);
if (keymap_config.swap_lctl_lgui) {
oled_write_P(logo[1][1], is_bootmagic_on);
} else {
@@ -455,7 +460,7 @@ void render_bootmagic_status(void) {
extern bool tap_toggling;
#endif
-void render_user_status(void) {
+void render_user_status(uint8_t col, uint8_t line) {
#ifdef AUDIO_ENABLE
bool is_audio_on = false, l_is_clicky_on = false;
# ifdef SPLIT_KEYBOARD
@@ -472,7 +477,7 @@ void render_user_status(void) {
# endif
#endif
#if defined(OLED_DISPLAY_VERBOSE)
- oled_set_cursor(1, 5);
+ oled_set_cursor(col, line);
#endif
oled_write_P(PSTR(OLED_RENDER_USER_NAME), false);
#if !defined(OLED_DISPLAY_VERBOSE)
@@ -523,9 +528,27 @@ void render_user_status(void) {
#endif
}
-void render_wpm(uint8_t padding) {
-#ifdef WPM_ENABLE
+void render_rgb_hsv(uint8_t col, uint8_t line) {
+ oled_set_cursor(col, line);
+ oled_write_P(PSTR("HSV: "), false);
+#ifdef RGB_MATRIX_ENABLE
+ oled_write(get_u8_str(rgb_matrix_get_hue(), ' '), false);
+ oled_write_P(PSTR(", "), false);
+ oled_write(get_u8_str(rgb_matrix_get_sat(), ' '), false);
+ oled_write_P(PSTR(", "), false);
+ oled_write(get_u8_str(rgb_matrix_get_val(), ' '), false);
+#elif RGBLIGHT_ENABLE
+ oled_write(get_u8_str(rgblight_get_hue(), ' '), false);
+ oled_write_P(PSTR(", "), false);
+ oled_write(get_u8_str(rgblight_get_sat(), ' '), false);
+ oled_write_P(PSTR(", "), false);
+ oled_write(get_u8_str(rgblight_get_val(), ' '), false);
+#endif
+}
+void render_wpm(uint8_t padding, uint8_t col, uint8_t line) {
+#ifdef WPM_ENABLE
+ oled_set_cursor(col, line);
oled_write_P(PSTR(OLED_RENDER_WPM_COUNTER), false);
if (padding) {
for (uint8_t n = padding; n > 0; n--) {
@@ -591,7 +614,8 @@ void render_wpm_graph(uint8_t max_lines_graph, uint8_t vertical_offset) {
}
#if defined(POINTING_DEVICE_ENABLE)
-void render_pointing_dpi_status(uint16_t cpi, uint8_t padding) {
+void render_pointing_dpi_status(uint16_t cpi, uint8_t padding, uint8_t col, uint8_t line) {
+ oled_set_cursor(col, line);
oled_write_P(PSTR("CPI:"), false);
if (padding) {
for (uint8_t n = padding - 1; n > 0; n--) {
@@ -603,13 +627,6 @@ void render_pointing_dpi_status(uint16_t cpi, uint8_t padding) {
}
#endif
-__attribute__((weak)) void oled_driver_render_logo_right(void) {
-#if defined(OLED_DISPLAY_VERBOSE)
- oled_set_cursor(0, 1);
-#endif
- render_default_layer_state();
-}
-
// WPM-responsive animation stuff here
#define OLED_SLEEP_FRAMES 2
#define OLED_SLEEP_SPEED 10 // below this wpm value your animation will idle
@@ -635,7 +652,7 @@ __attribute__((weak)) void oled_driver_render_logo_right(void) {
static uint8_t animation_frame = 0;
static uint8_t animation_type = 0;
-void render_kitty(void) {
+void render_kitty(uint8_t col, uint8_t line) {
// Images credit j-inc(/James Incandenza) and pixelbenny.
// Credit to obosob for initial animation approach.
// heavily modified by drashna because he's a glutton for punishment
@@ -712,11 +729,44 @@ void render_kitty(void) {
// clang-format on
for (uint8_t i = 0; i < 4; i++) {
- oled_set_cursor(1, i + 1);
+ oled_set_cursor(col, line + i);
oled_write_raw_P(animation[animation_type][animation_frame][i], OLED_ANIM_SIZE);
}
}
+void render_unicode_mode(uint8_t col, uint8_t line) {
+#ifdef CUSTOM_UNICODE_ENABLE
+ oled_set_cursor(col, line);
+ oled_write_ln_P(PSTR("Unicode:"), false);
+ switch (typing_mode) {
+ case UCTM_WIDE:
+ oled_write_P(PSTR(" Wide"), false);
+ break;
+ case UCTM_SCRIPT:
+ oled_write_P(PSTR(" Script"), false);
+ break;
+ case UCTM_BLOCKS:
+ oled_write_P(PSTR(" Blocks"), false);
+ break;
+ case UCTM_REGIONAL:
+ oled_write_P(PSTR(" Regional"), false);
+ break;
+ case UCTM_AUSSIE:
+ oled_write_P(PSTR(" Aussie"), false);
+ break;
+ case UCTM_ZALGO:
+ oled_write_P(PSTR(" Zalgo"), false);
+ break;
+ case UCTM_NO_MODE:
+ oled_write_P(PSTR(" Normal"), false);
+ break;
+ default:
+ oled_write_P(PSTR(" Unknown"), false);
+ break;
+ }
+#endif
+}
+
uint32_t kitty_animation_phases(uint32_t triger_time, void *cb_arg) {
static uint32_t anim_frame_duration = 500;
#ifdef CUSTOM_POINTING_DEVICE
@@ -748,34 +798,8 @@ uint32_t kitty_animation_phases(uint32_t triger_time, void *cb_arg) {
return anim_frame_duration;
}
-void oled_driver_render_logo_left(void) {
-#if defined(OLED_DISPLAY_VERBOSE)
- oled_set_cursor(0, 1);
- render_kitty();
-
-# if defined(KEYBOARD_handwired_tractyl_manuform)
- oled_set_cursor(7, 0);
- oled_write_P(PSTR("Tractyl"), true);
-# elif defined(KEYBOARD_bastardkb_charybdis)
- oled_set_cursor(6, 0);
- oled_write_P(PSTR("Charybdis"), true);
-# elif defined(KEYBOARD_splitkb_kyria)
- oled_set_cursor(7, 0);
- oled_write_P(PSTR("SplitKB"), true);
-# else
- oled_set_cursor(8, 0);
- oled_write_P(PSTR("Left"), true);
-# endif
- oled_set_cursor(7, 1);
-# if defined(WPM_ENABLE)
- render_wpm(1);
-# elif defined(DEBUG_MATRIX_SCAN_RATE)
- render_matrix_scan_rate(2);
-# endif
- oled_set_cursor(7, 2);
-# 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);
-
+void render_mouse_mode(uint8_t col, uint8_t line) {
+#if (defined(KEYBOARD_bastardkb_charybdis) || defined(KEYBOARD_handwired_tractyl_manuform)) && defined(POINTING_DEVICE_ENABLE)
// credit and thanks to jaspertandy on discord for these images
static const char PROGMEM mouse_logo[3][2][16] = {// mouse icon
{{0, 0, 0, 252, 2, 2, 2, 58, 2, 2, 2, 252, 0, 0, 0, 0}, {0, 0, 63, 96, 64, 64, 64, 64, 64, 64, 64, 96, 63, 0, 0, 0}},
@@ -785,27 +809,20 @@ void oled_driver_render_logo_left(void) {
{{0, 0, 112, 136, 156, 2, 15, 1, 15, 2, 140, 68, 56, 0, 0, 0}, {0, 0, 2, 6, 15, 28, 60, 124, 60, 28, 15, 6, 2, 0, 0, 0}}};
uint8_t image_index = 0;
-# ifdef OLED_DISPLAY_TEST
+# ifdef OLED_DISPLAY_TEST
image_index = animation_frame;
-# else
+# else
if (charybdis_get_pointer_sniping_enabled()) {
image_index = 1;
} else if (charybdis_get_pointer_dragscroll_enabled()) {
image_index = 2;
}
-# endif
+# endif
- oled_set_cursor(17, 1);
+ oled_set_cursor(col, line);
oled_write_raw_P(mouse_logo[image_index][0], 16);
- oled_set_cursor(17, 2);
+ oled_set_cursor(col, line + 1);
oled_write_raw_P(mouse_logo[image_index][1], 16);
-# elif defined(WPM_ENABLE) && defined(DEBUG_MATRIX_SCAN_RATE)
- render_matrix_scan_rate(2);
-# endif
-
- oled_set_cursor(0, 5);
-#else
- render_default_layer_state();
#endif
}
@@ -823,27 +840,73 @@ void render_status_right(void) {
oled_set_cursor(8, 0);
oled_write_P(PSTR("Right"), true);
#endif
- oled_driver_render_logo_right();
+#if defined(OLED_DISPLAY_VERBOSE)
+ render_default_layer_state(1, 1);
+#else
+ render_default_layer_state(0, 0);
+#endif
+
/* Show Keyboard Layout */
- render_layer_state();
- render_mod_status(get_mods() | get_oneshot_mods());
-#if !defined(OLED_DISPLAY_VERBOSE) && defined(WPM_ENABLE) && !defined(CONVERT_TO_PROTON_C)
+ 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);
#endif
- render_keylock_status(host_keyboard_led_state());
+ render_keylock_status(host_keyboard_led_state(), 1, 6);
}
void render_status_left(void) {
- oled_driver_render_logo_left();
+#if defined(OLED_DISPLAY_VERBOSE)
+ render_kitty(0, 1);
+
+# if defined(KEYBOARD_handwired_tractyl_manuform)
+ oled_set_cursor(7, 0);
+ oled_write_P(PSTR("Tractyl"), true);
+# elif defined(KEYBOARD_bastardkb_charybdis)
+ oled_set_cursor(6, 0);
+ oled_write_P(PSTR("Charybdis"), true);
+# elif defined(KEYBOARD_splitkb_kyria)
+ oled_set_cursor(7, 0);
+ oled_write_P(PSTR("SplitKB"), true);
+# elif defined(KEYBOARD_handwired_fingerpunch_rockon)
+ oled_set_cursor(7, 0);
+ oled_write_P(PSTR("Rock On"), true);
+# else
+ oled_set_cursor(8, 0);
+ oled_write_P(PSTR("Left"), true);
+# endif
+
+# if defined(WPM_ENABLE)
+ render_wpm(1, 7, 1);
+# elif defined(DEBUG_MATRIX_SCAN_RATE)
+ render_matrix_scan_rate(1, 7, 1);
+# endif
+# 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, 7, 2);
+ render_mouse_mode(17, 1);
+# elif defined(WPM_ENABLE) && defined(DEBUG_MATRIX_SCAN_RATE)
+ render_matrix_scan_rate(1, 7, 2);
+# endif
+ /* Show Keyboard Layout */
+ render_bootmagic_status(7, 3);
+ render_user_status(1, 5);
+ render_keylogger_status(1, 6);
+#else
+ render_default_layer_state(0, 0);
/* Show Keyboard Layout */
- render_bootmagic_status();
- render_user_status();
+ render_bootmagic_status(7, 3);
+ render_user_status(1, 5);
- render_keylogger_status();
+ render_keylogger_status(1, 6);
+#endif
}
-__attribute__((weak)) void oled_render_large_display(bool side) {}
+__attribute__((weak)) void oled_render_large_display(bool side) {
+ if (!side) {
+ render_unicode_mode(1, 14);
+ }
+}
__attribute__((weak)) oled_rotation_t oled_init_keymap(oled_rotation_t rotation) {
return rotation;
@@ -895,14 +958,12 @@ bool oled_task_user(void) {
#endif
render_status_left();
#if defined(OLED_DISPLAY_128X128)
- oled_set_cursor(0, 7);
oled_render_large_display(true);
#endif
#ifndef OLED_DISPLAY_TEST
} else {
render_status_right();
# if defined(OLED_DISPLAY_128X128)
- oled_set_cursor(0, 7);
oled_render_large_display(false);
# endif
}
diff --git a/users/drashna/oled/oled_stuff.h b/users/drashna/oled/oled_stuff.h
index 4dea4b7be4..17bd9319d1 100644
--- a/users/drashna/oled/oled_stuff.h
+++ b/users/drashna/oled/oled_stuff.h
@@ -18,132 +18,135 @@
#include "quantum.h"
#include "oled_driver.h"
+#ifdef DEFFERED_EXEC_ENABLE
extern deferred_token kittoken;
+#endif
void oled_driver_render_logo(void);
bool process_record_user_oled(uint16_t keycode, keyrecord_t *record);
oled_rotation_t oled_init_keymap(oled_rotation_t rotation);
void oled_timer_reset(void);
-void render_keylogger_status(void);
-void render_default_layer_state(void);
-void render_layer_state(void);
-void render_keylock_status(led_t led_usb_state);
-void render_matrix_scan_rate(uint8_t padding);
-void render_mod_status(uint8_t modifiers);
-void render_bootmagic_status(void);
-void render_user_status(void);
+void render_keylogger_status(uint8_t col, uint8_t line);
+void render_default_layer_state(uint8_t col, uint8_t line);
+void render_layer_state(uint8_t col, uint8_t line);
+void render_keylock_status(led_t led_usb_state, uint8_t col, uint8_t line);
+void render_matrix_scan_rate(uint8_t padding, uint8_t col, uint8_t line);
+void render_mod_status(uint8_t modifiers, uint8_t col, uint8_t line);
+void render_bootmagic_status(uint8_t col, uint8_t line);
+void render_user_status(uint8_t col, uint8_t line);
void oled_driver_render_logo(void);
-void render_wpm(uint8_t padding);
-void render_pointing_dpi_status(uint16_t cpi, uint8_t padding);
+void render_wpm(uint8_t padding, uint8_t col, uint8_t line);
+void render_pointing_dpi_status(uint16_t cpi, uint8_t padding, uint8_t col, uint8_t line);
void oled_driver_render_logo_left(void);
void oled_driver_render_logo_right(void);
void oled_render_large_display(bool side);
-void render_wpm_graph(uint8_t max_lines_graph, uint8_t vertical_offset);
+void render_wpm_graph(uint8_t max_lines_graph, uint8_t vertical_offset);
+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 oled_pan_section(bool left, uint16_t y_start, uint16_t y_end, uint16_t x_start, uint16_t x_end);
-
#if defined(OLED_DISPLAY_128X128) || defined(OLED_DISPLAY_128X64)
# define OLED_DISPLAY_VERBOSE
-# define OLED_RENDER_KEYLOGGER "Keylogger: "
+# define OLED_RENDER_KEYLOGGER "Keylogger: "
# ifndef OLED_KEYLOGGER_LENGTH
-# define OLED_KEYLOGGER_LENGTH 9
+# define OLED_KEYLOGGER_LENGTH 9
# endif
-# define OLED_RENDER_LAYOUT_NAME "Layout: "
-# define OLED_RENDER_LAYOUT_QWERTY "Qwerty"
+# define OLED_RENDER_LAYOUT_NAME "Layout: "
+# define OLED_RENDER_LAYOUT_QWERTY "Qwerty"
# define OLED_RENDER_LAYOUT_COLEMAK_DH "Colemak DH"
-# define OLED_RENDER_LAYOUT_COLEMAK "Colemak"
-# define OLED_RENDER_LAYOUT_DVORAK "Dvorak"
-# define OLED_RENDER_LAYOUT_WORKMAN "Workman"
-# define OLED_RENDER_LAYOUT_NORMAN "Norman"
-# define OLED_RENDER_LAYOUT_MALTRON "Matron"
-# define OLED_RENDER_LAYOUT_EUCALYN "Eucalyn"
-# define OLED_RENDER_LAYOUT_CARPLAX "Carplax"
-
-# define OLED_RENDER_LAYER_NAME "Layer:"
-# define OLED_RENDER_LAYER_LOWER "Lower"
-# define OLED_RENDER_LAYER_RAISE "Raise"
-# define OLED_RENDER_LAYER_ADJUST "Adjust"
-# define OLED_RENDER_LAYER_MODS "Mods"
-
-# define OLED_RENDER_LOCK_NAME "Lock: "
-# define OLED_RENDER_LOCK_NUML "NUM"
-# define OLED_RENDER_LOCK_CAPS "CAPS"
-# define OLED_RENDER_LOCK_SCLK "SCLK"
-
-# define OLED_RENDER_MODS_NAME "Mods"
-# define OLED_RENDER_MODS_SFT "Sft"
-# define OLED_RENDER_MODS_CTL "Ctl"
-# define OLED_RENDER_MODS_ALT "Alt"
-# define OLED_RENDER_MODS_GUI "GUI"
-
-# define OLED_RENDER_BOOTMAGIC_NAME "Boot "
-# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO"
-# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI"
-# define OLED_RENDER_BOOTMAGIC_GRV "GRV"
+# define OLED_RENDER_LAYOUT_COLEMAK "Colemak"
+# define OLED_RENDER_LAYOUT_DVORAK "Dvorak"
+# define OLED_RENDER_LAYOUT_WORKMAN "Workman"
+# define OLED_RENDER_LAYOUT_NORMAN "Norman"
+# define OLED_RENDER_LAYOUT_MALTRON "Matron"
+# define OLED_RENDER_LAYOUT_EUCALYN "Eucalyn"
+# define OLED_RENDER_LAYOUT_CARPLAX "Carplax"
+
+# define OLED_RENDER_LAYER_NAME "Layer:"
+# define OLED_RENDER_LAYER_LOWER "Lower"
+# define OLED_RENDER_LAYER_RAISE "Raise"
+# define OLED_RENDER_LAYER_ADJUST "Adjust"
+# define OLED_RENDER_LAYER_MODS "Mods"
+
+# define OLED_RENDER_LOCK_NAME "Lock: "
+# define OLED_RENDER_LOCK_NUML "NUM"
+# define OLED_RENDER_LOCK_CAPS "CAPS"
+# define OLED_RENDER_LOCK_SCLK "SCLK"
+
+# define OLED_RENDER_MODS_NAME "Mods"
+# define OLED_RENDER_MODS_SFT "Sft"
+# define OLED_RENDER_MODS_CTL "Ctl"
+# define OLED_RENDER_MODS_ALT "Alt"
+# define OLED_RENDER_MODS_GUI "GUI"
+
+# define OLED_RENDER_BOOTMAGIC_NAME "Boot "
+# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO"
+# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI"
+# define OLED_RENDER_BOOTMAGIC_GRV "GRV"
# define OLED_RENDER_BOOTMAGIC_ONESHOT "1SHT"
-# define OLED_RENDER_BOOTMAGIC_SWAP "SWAP"
-# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS"
+# define OLED_RENDER_BOOTMAGIC_SWAP "SWAP"
+# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS"
-# define OLED_RENDER_USER_NAME "USER:"
-# define OLED_RENDER_USER_ANIM "Anim"
-# define OLED_RENDER_USER_LAYR "Layr"
-# define OLED_RENDER_USER_NUKE "Nuke"
+# define OLED_RENDER_USER_NAME "USER:"
+# define OLED_RENDER_USER_ANIM "Anim"
+# define OLED_RENDER_USER_LAYR "Layr"
+# define OLED_RENDER_USER_NUKE "Nuke"
-# define OLED_RENDER_WPM_COUNTER "WPM: "
+# define OLED_RENDER_WPM_COUNTER "WPM: "
#else
-# define OLED_RENDER_KEYLOGGER "KLogr"
+# define OLED_RENDER_KEYLOGGER "KLogr"
# ifndef OLED_KEYLOGGER_LENGTH
-# define OLED_KEYLOGGER_LENGTH 5
+# define OLED_KEYLOGGER_LENGTH 5
# endif
-# define OLED_RENDER_LAYOUT_NAME "Lyout"
-# define OLED_RENDER_LAYOUT_QWERTY " QRTY"
+# define OLED_RENDER_LAYOUT_NAME "Lyout"
+# define OLED_RENDER_LAYOUT_QWERTY " QRTY"
# define OLED_RENDER_LAYOUT_COLEMAK_DH " cmDH"
-# define OLED_RENDER_LAYOUT_COLEMAK " COLE"
-# define OLED_RENDER_LAYOUT_DVORAK " DVRK"
-# define OLED_RENDER_LAYOUT_WORKMAN " WKMN"
-# define OLED_RENDER_LAYOUT_NORMAN " NORM"
-# define OLED_RENDER_LAYOUT_MALTRON " MLTN"
-# define OLED_RENDER_LAYOUT_EUCALYN " ECLN"
-# define OLED_RENDER_LAYOUT_CARPLAX " CRPX"
-
-# define OLED_RENDER_LAYER_NAME "LAYER"
-# define OLED_RENDER_LAYER_LOWER "Lower"
-# define OLED_RENDER_LAYER_RAISE "Raise"
-# define OLED_RENDER_LAYER_ADJUST "Adjst"
-# define OLED_RENDER_LAYER_MODS " Mods"
-
-# define OLED_RENDER_LOCK_NAME "Lock:"
-# define OLED_RENDER_LOCK_NUML "NumL"
-# define OLED_RENDER_LOCK_CAPS "CapL"
-# define OLED_RENDER_LOCK_SCLK "ScrL"
-
-# define OLED_RENDER_MODS_NAME "Mods: "
-# define OLED_RENDER_MODS_SFT "Shft"
-# define OLED_RENDER_MODS_CTL "Ctrl"
-# define OLED_RENDER_MODS_ALT "Alt\n"
-# define OLED_RENDER_MODS_GUI "GUI\n"
-
-# define OLED_RENDER_BOOTMAGIC_NAME "BTMGK"
-# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO"
-# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI"
-# define OLED_RENDER_BOOTMAGIC_GRV "GRV"
+# define OLED_RENDER_LAYOUT_COLEMAK " COLE"
+# define OLED_RENDER_LAYOUT_DVORAK " DVRK"
+# define OLED_RENDER_LAYOUT_WORKMAN " WKMN"
+# define OLED_RENDER_LAYOUT_NORMAN " NORM"
+# define OLED_RENDER_LAYOUT_MALTRON " MLTN"
+# define OLED_RENDER_LAYOUT_EUCALYN " ECLN"
+# define OLED_RENDER_LAYOUT_CARPLAX " CRPX"
+
+# define OLED_RENDER_LAYER_NAME "LAYER"
+# define OLED_RENDER_LAYER_LOWER "Lower"
+# define OLED_RENDER_LAYER_RAISE "Raise"
+# define OLED_RENDER_LAYER_ADJUST "Adjst"
+# define OLED_RENDER_LAYER_MODS " Mods"
+
+# define OLED_RENDER_LOCK_NAME "Lock:"
+# define OLED_RENDER_LOCK_NUML "NumL"
+# define OLED_RENDER_LOCK_CAPS "CapL"
+# define OLED_RENDER_LOCK_SCLK "ScrL"
+
+# define OLED_RENDER_MODS_NAME "Mods: "
+# define OLED_RENDER_MODS_SFT "Shft"
+# define OLED_RENDER_MODS_CTL "Ctrl"
+# define OLED_RENDER_MODS_ALT "Alt\n"
+# define OLED_RENDER_MODS_GUI "GUI\n"
+
+# define OLED_RENDER_BOOTMAGIC_NAME "BTMGK"
+# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO"
+# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI"
+# define OLED_RENDER_BOOTMAGIC_GRV "GRV"
# define OLED_RENDER_BOOTMAGIC_ONESHOT "1SHT"
-# define OLED_RENDER_BOOTMAGIC_SWAP "SWAP"
-# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS"
+# define OLED_RENDER_BOOTMAGIC_SWAP "SWAP"
+# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS"
-# define OLED_RENDER_USER_NAME "USER:"
-# define OLED_RENDER_USER_ANIM "Anim"
-# define OLED_RENDER_USER_LAYR "Layr"
-# define OLED_RENDER_USER_NUKE "Nuke"
+# define OLED_RENDER_USER_NAME "USER:"
+# define OLED_RENDER_USER_ANIM "Anim"
+# define OLED_RENDER_USER_LAYR "Layr"
+# define OLED_RENDER_USER_NUKE "Nuke"
-# define OLED_RENDER_WPM_COUNTER "WPM: "
+# define OLED_RENDER_WPM_COUNTER "WPM: "
#endif
-
-extern char keylog_str[OLED_KEYLOGGER_LENGTH];
+extern char keylog_str[OLED_KEYLOGGER_LENGTH];
#ifndef OLED_WPM_GRAPH_MAX_WPM
# define OLED_WPM_GRAPH_MAX_WPM 120
diff --git a/users/drashna/oled/sh110x.c b/users/drashna/oled/sh110x.c
index aa081ca732..9fed5a9d1a 100644
--- a/users/drashna/oled/sh110x.c
+++ b/users/drashna/oled/sh110x.c
@@ -52,7 +52,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define PAGE_ADDR 0x22
#define PAM_SETCOLUMN_LSB 0x00
#define PAM_SETCOLUMN_MSB 0x10
-#define PAM_PAGE_ADDR 0xB0 // 0xb0 -- 0xb7
+#define PAM_PAGE_ADDR 0xB0 // 0xb0 -- 0xb7
// Hardware Configuration Commands
#define DISPLAY_START_LINE 0x40
@@ -109,9 +109,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define I2C_DATA 0x40
#if defined(__AVR__)
# define I2C_TRANSMIT_P(data) i2c_transmit_P((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), OLED_I2C_TIMEOUT)
-#else // defined(__AVR__)
+#else // defined(__AVR__)
# define I2C_TRANSMIT_P(data) i2c_transmit((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), OLED_I2C_TIMEOUT)
-#endif // defined(__AVR__)
+#endif // defined(__AVR__)
#define I2C_TRANSMIT(data) i2c_transmit((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), OLED_I2C_TIMEOUT)
#define I2C_WRITE_REG(mode, data, size) i2c_writeReg((OLED_DISPLAY_ADDRESS << 1), mode, data, size, OLED_I2C_TIMEOUT)
@@ -122,7 +122,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// parts of the display unusable or don't get cleared correctly
// and also allows for drawing & inverting
uint8_t oled_buffer[OLED_MATRIX_SIZE];
-uint8_t * oled_cursor;
+uint8_t *oled_cursor;
OLED_BLOCK_TYPE oled_dirty = 0;
bool oled_initialized = false;
bool oled_active = false;
@@ -131,7 +131,7 @@ bool oled_inverted = false;
uint8_t oled_brightness = OLED_BRIGHTNESS;
oled_rotation_t oled_rotation = 0;
uint8_t oled_rotation_width = 0;
-uint8_t oled_scroll_speed = 0; // this holds the speed after being remapped to ssd1306 internal values
+uint8_t oled_scroll_speed = 0; // this holds the speed after being remapped to ssd1306 internal values
uint8_t oled_scroll_start = 0;
uint8_t oled_scroll_end = 7;
#if OLED_TIMEOUT > 0
@@ -261,8 +261,12 @@ bool oled_init(oled_rotation_t rotation) {
return true;
}
-__attribute__((weak)) oled_rotation_t oled_init_kb(oled_rotation_t rotation) { return rotation; }
-__attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) { return rotation; }
+__attribute__((weak)) oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
+ return rotation;
+}
+__attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) {
+ return rotation;
+}
void oled_clear(void) {
memset(oled_buffer, 0, sizeof(oled_buffer));
@@ -299,9 +303,9 @@ static void calc_bounds_90(uint8_t update_start, uint8_t *cmd_array) {
// 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);
+ 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);
}
uint8_t crot(uint8_t a, int8_t n) {
@@ -339,9 +343,9 @@ void oled_render(void) {
// Set column & page position
static uint8_t display_start[] = {I2C_CMD, PAM_PAGE_ADDR, PAM_SETCOLUMN_LSB, PAM_SETCOLUMN_MSB};
if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) {
- calc_bounds(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start
+ calc_bounds(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start
} else {
- calc_bounds_90(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start
+ calc_bounds_90(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start
}
// Send column & page position
@@ -369,7 +373,7 @@ void oled_render(void) {
// 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;
+ const uint8_t num_pages = OLED_BLOCK_SIZE / columns_in_block;
for (uint8_t i = 0; i < num_pages; ++i) {
// Send column & page position for all pages except the first one
if (i > 0) {
@@ -414,7 +418,8 @@ void oled_advance_page(bool clearPageRemainder) {
remaining = remaining / OLED_FONT_WIDTH;
// Write empty character until next line
- while (remaining--) oled_write_char(' ', false);
+ while (remaining--)
+ oled_write_char(' ', false);
} else {
// Next page index out of bounds?
if (index + remaining >= OLED_MATRIX_SIZE) {
@@ -465,7 +470,7 @@ void oled_write_char(const char data, bool invert) {
_Static_assert(sizeof(font) >= ((OLED_FONT_END + 1 - OLED_FONT_START) * OLED_FONT_WIDTH), "OLED_FONT_END references outside array");
// set the reder buffer data
- uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index
+ uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index
if (cast_data < OLED_FONT_START || cast_data > OLED_FONT_END) {
memset(oled_cursor, 0x00, OLED_FONT_WIDTH);
} else {
@@ -610,7 +615,7 @@ void oled_write_raw_P(const char *data, uint16_t size) {
oled_dirty |= ((OLED_BLOCK_TYPE)1 << (i / OLED_BLOCK_SIZE));
}
}
-#endif // defined(__AVR__)
+#endif // defined(__AVR__)
bool oled_on(void) {
if (!oled_initialized) {
@@ -660,7 +665,9 @@ bool oled_off(void) {
return !oled_active;
}
-bool is_oled_on(void) { return oled_active; }
+bool is_oled_on(void) {
+ return oled_active;
+}
uint8_t oled_set_brightness(uint8_t level) {
if (!oled_initialized) {
@@ -678,7 +685,9 @@ uint8_t oled_set_brightness(uint8_t level) {
return oled_brightness;
}
-uint8_t oled_get_brightness(void) { return oled_brightness; }
+uint8_t oled_get_brightness(void) {
+ return oled_brightness;
+}
// Set the specific 8 lines rows of the screen to scroll.
// 0 is the default for start, and 7 for end, which is the entire
@@ -758,7 +767,9 @@ bool oled_scroll_off(void) {
return !oled_scrolling;
}
-bool is_oled_scrolling(void) { return oled_scrolling; }
+bool is_oled_scrolling(void) {
+ return oled_scrolling;
+}
bool oled_invert(bool invert) {
if (!oled_initialized) {
@@ -842,6 +853,9 @@ 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; }
+__attribute__((weak)) bool oled_task_kb(void) {
+ return oled_task_user();
+}
+__attribute__((weak)) bool oled_task_user(void) {
+ return true;
+}