From 20c0533c4c66b9d222b6ced2fad3ec6be6cad76e Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Thu, 25 Jul 2019 13:56:29 -0500 Subject: [User] Xulkal Keymaps Update (#6392) * Xulkal changes Refactor rgb & encoder menu Hadron Keymap Refactor oled menu * Fixing horizontal OLED data display * Reverting changes to take to separate prs --- users/xulkal/custom_oled.c | 207 +++++++++++++++++++++++---------------------- 1 file changed, 105 insertions(+), 102 deletions(-) (limited to 'users/xulkal/custom_oled.c') diff --git a/users/xulkal/custom_oled.c b/users/xulkal/custom_oled.c index 7280ef7019..448e6ca107 100644 --- a/users/xulkal/custom_oled.c +++ b/users/xulkal/custom_oled.c @@ -3,12 +3,15 @@ #include -#ifdef OLED_DRIVER_ENABLE - #ifdef RGBLIGHT_ENABLE rgblight_config_t rgblight_config; #endif +#if KEYBOARD_helix_rev2 +extern uint8_t is_master; +bool is_keyboard_master(void) { return is_master; } +#endif + static void render_logo(void) { static const char PROGMEM font_logo[] = { @@ -18,21 +21,38 @@ static void render_logo(void) oled_write_P(font_logo, false); } -#if defined(OLED_90ROTATION) - -// TODO: Need to define this function / extern only for helix based split common keyboards -extern uint8_t is_master; -bool is_keyboard_master(void) +static void render_icon(void) { - return is_master; +#ifdef OLED_90ROTATION + static const char PROGMEM font_icon[] = { + 0x9b,0x9c,0x9d,0x9e,0x9f, + 0xbb,0xbc,0xbd,0xbe,0xbf, + 0xdb,0xdc,0xdd,0xde,0xdf,0 + }; +#else + static const char PROGMEM font_icon[] = { + // Use \r (0x0d) to jump to the next line without clearing the rest of the current line + 0x9b,0x9c,0x9d,0x9e,0x9f,0x0d, + 0xbb,0xbc,0xbd,0xbe,0xbf,0x0d, + 0xdb,0xdc,0xdd,0xde,0xdf,0 + }; +#endif + oled_write_P(font_icon, false); } -static void render_layer(uint8_t layer) +static void render_layer(void) { + uint8_t layer = layer_state ? biton(layer_state) : biton32(default_layer_state); +#ifdef OLED_90ROTATION + oled_write_P(PSTR("Layer"), false); +#else + oled_write_P(PSTR("Layer: "), false); +#endif + switch (layer) { case _QWERTY: - oled_write_P(PSTR("DFLT "), false); + oled_write_P(PSTR("BASE "), false); break; #ifndef GAMELAYER_DISABLE case _GAME: @@ -53,125 +73,110 @@ static void render_layer(uint8_t layer) } } -static void render_status(void) +static void render_keyboard_leds(void) { - // Render to mode icon - static const char PROGMEM mode_logo[2][4] = { - {0x97,0x98,0x0a,0}, - {0xb7,0xb8,0x0a,0} }; - - oled_write_P(mode_logo[0], false); - oled_write_P(mode_logo[1], false); + // Host Keyboard LED Status + uint8_t led_state = host_keyboard_leds(); +#ifdef OLED_90ROTATION + oled_write_P(IS_LED_ON(led_state, USB_LED_NUM_LOCK) ? PSTR("NUMLK") : PSTR(" "), false); + oled_write_P(IS_LED_ON(led_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLK") : PSTR(" "), false); + oled_write_P(IS_LED_ON(led_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false); +#else + oled_write_P(IS_LED_ON(led_state, USB_LED_NUM_LOCK) ? PSTR("NUM ") : PSTR(" "), false); + oled_write_P(IS_LED_ON(led_state, USB_LED_CAPS_LOCK) ? PSTR("CAPS ") : PSTR(" "), false); + oled_write_P(IS_LED_ON(led_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRL") : PSTR(" "), false); +#endif +} - oled_write_P(PSTR("Layer"), false); - uint8_t layer = biton(layer_state); - if (layer != _QWERTY) - render_layer(layer); - else - render_layer(biton32(default_layer_state)); +#ifdef RGB_OLED_MENU +extern uint8_t rgb_encoder_state; +#endif - // Host Keyboard LED Status - uint8_t led_usb_state = host_keyboard_leds(); - oled_write_P(led_usb_state & (1<