qmk_firmware

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

rev2.c (2100B)


      1 /* Copyright 2022 Kyle McCreery
      2  *
      3  * This program is free software: you can redistribute it and/or modify
      4  * it under the terms of the GNU General Public License as published by
      5  * the Free Software Foundation, either version 2 of the License, or
      6  * (at your option) any later version.
      7  *
      8  * This program is distributed in the hope that it will be useful,
      9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11  * GNU General Public License for more details.
     12  *
     13  * You should have received a copy of the GNU General Public License
     14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     15  */
     16 
     17 #include "quantum.h"
     18 
     19 #ifdef OLED_ENABLE
     20 static const char PROGMEM mw_logo[] = {
     21     0x8A, 0x8B, 0x8C, 0x8D, '\r',
     22     0xAA, 0xAB, 0xAC, 0xAD, 0xAE,
     23     0xCA, 0xCB, 0xCC, 0xCD, '\r',
     24     0x20, 0x8E, 0x8F, 0x90, 0x00};
     25 
     26 oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
     27     return OLED_ROTATION_270;       // flips the display 270 degrees
     28 }
     29 
     30 bool oled_task_kb(void) {
     31     if (!oled_task_user()) {
     32         return false;
     33     }
     34 
     35     oled_write_P(mw_logo, false);     // Render MechWild "MW" Logo
     36     oled_set_cursor(0,6);
     37 
     38     oled_write_ln_P(PSTR("Layer"), false);
     39 
     40     switch (get_highest_layer(layer_state)) {
     41         case 0:
     42             oled_write_ln_P(PSTR("Base"), false);
     43             break;
     44         case 1:
     45             oled_write_ln_P(PSTR("FN 1"), false);
     46             break;
     47         case 2:
     48             oled_write_ln_P(PSTR("FN 2"), false);
     49             break;
     50         case 3:
     51             oled_write_ln_P(PSTR("FN 3"), false);
     52             break;
     53         default:
     54             oled_write_ln_P(PSTR("Undef"), false);
     55     }
     56     oled_write_ln_P(PSTR(""), false);
     57     // Host Keyboard LED Status
     58     led_t led_state = host_keyboard_led_state();
     59     oled_write_ln_P(led_state.num_lock ? PSTR("NUM ") : PSTR("    "), false);
     60     oled_write_ln_P(led_state.caps_lock ? PSTR("CAP ") : PSTR("    "), false);
     61     oled_write_ln_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR("    "), false);
     62 
     63     return true;
     64 }
     65 #endif