qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

udon13.c (3075B)


      1 // Copyright 2023 The Mad Noodle(@the_mad_noodle)
      2 // SPDX-License-Identifier: GPL-2.0-or-later
      3 
      4 #include "quantum.h"
      5 
      6 #ifdef OLED_ENABLE
      7 
      8 /* OLED Settings */
      9 //------------------------------------------------------------------------------------------------
     10 
     11 static void render_logo(void) { // Render Mad Noodle logo
     12     static const char PROGMEM logo_1[] = {0x00, 0x00, 0x80, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x04, 0x06, 0x82, 0xc3, 0x43, 0x61, 0xa1, 0xa1, 0xa1, 0xa1, 0x61, 0x43, 0xc3, 0x82, 0x06, 0x04, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00};
     13     static const char PROGMEM logo_2[] = {0xf8, 0x1e, 0xc3, 0xf8, 0x5c, 0x76, 0x7b, 0x6d, 0x75, 0x55, 0x55, 0x75, 0x6d, 0x7b, 0x76, 0x5e, 0x7e, 0x77, 0x5b, 0x6d, 0x75, 0x55, 0x55, 0x75, 0x4d, 0x7b, 0x66, 0x5c, 0xf0, 0xc3, 0x3e, 0xf0};
     14     static const char PROGMEM logo_3[] = {0x1f, 0x78, 0xc1, 0x0f, 0x38, 0xe0, 0xc0, 0x00, 0x00, 0x02, 0x0e, 0x0e, 0x8e, 0xc6, 0xc0, 0x40, 0x40, 0xc0, 0xc6, 0x8e, 0x0e, 0x0e, 0x02, 0x00, 0x80, 0xc0, 0x60, 0x38, 0x0f, 0xc0, 0x7c, 0x0f};
     15     static const char PROGMEM logo_4[] = {0x00, 0x00, 0x01, 0x03, 0x06, 0x0c, 0x18, 0x31, 0x23, 0x66, 0x44, 0x44, 0xc4, 0xc4, 0x84, 0x84, 0x84, 0x84, 0xc4, 0xc4, 0x44, 0x46, 0x66, 0x23, 0x11, 0x18, 0x0c, 0x06, 0x03, 0x00, 0x00, 0x00};
     16     oled_set_cursor(0, 0);
     17     oled_write_raw_P(logo_1, sizeof(logo_1));
     18     oled_set_cursor(0, 1);
     19     oled_write_raw_P(logo_2, sizeof(logo_2));
     20     oled_set_cursor(0, 2);
     21     oled_write_raw_P(logo_3, sizeof(logo_3));
     22     oled_set_cursor(0, 3);
     23     oled_write_raw_P(logo_4, sizeof(logo_4));
     24 }
     25 //-----------
     26 
     27 bool oled_task_kb(void) {
     28     if (!oled_task_user()) { return false; }
     29     render_logo();
     30     oled_set_cursor(7, 0);
     31     oled_write_P(PSTR("The Mad Noodle"), false);
     32 
     33     oled_set_cursor(7, 1);
     34     oled_write_P(PSTR("Layer: "), false);
     35 
     36     /*
     37     To change LAYER NAMES displayed on the OLED ensure they are a total of 6 characters, including spaces.
     38     Example:
     39     ---------------------------------------------------
     40     case 0:
     41           oled_write_P(PSTR("Base  "), false);
     42           break;
     43     ---------------------------------------------------
     44     "B A S E *SPACE* *SPACE*" = 6 characters
     45     This would change layer 0 to Base on the OLED
     46     */
     47 
     48     switch (get_highest_layer(layer_state)) {
     49         case 0:
     50             oled_write_P(PSTR("Zero  "), false);
     51             break;
     52         case 1:
     53             oled_write_P(PSTR("One   "), false);
     54             break;
     55         case 2:
     56             oled_write_P(PSTR("Two   "), false);
     57             break;
     58         case 3:
     59             oled_write_P(PSTR("Three "), false);
     60             break;
     61 
     62         default:
     63             oled_write_P(PSTR("N/A   "), false);
     64     }
     65     oled_set_cursor(7, 2);
     66     oled_write_P(PSTR("Status: "), false);
     67     oled_set_cursor(7, 3);
     68     led_t led_state = host_keyboard_led_state();
     69     oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR("   "), false);
     70     oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR("   "), false);
     71     oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR("   "), false);
     72 
     73     return false;
     74 }
     75 
     76 #endif