qmk_firmware

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

sodium62.c (1766B)


      1 /* Copyright 2022 NaCly
      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 #include "quantum.h"
     17 
     18 #ifdef OLED_ENABLE
     19 bool oled_task_kb(void) {
     20     if (!oled_task_user()) {
     21         return false;
     22     }
     23     // Host Keyboard Layer Status
     24     oled_write_P(PSTR("Layer: "), false);
     25 
     26     switch (get_highest_layer(layer_state)) {
     27         case 0:
     28             oled_write_P(PSTR("Base\n"), false);
     29             break;
     30         case 1:
     31             oled_write_P(PSTR("ONE\n"), false);
     32             break;
     33         case 2:
     34             oled_write_P(PSTR("TWO\n"), false);
     35             break;
     36         case 3:
     37             oled_write_P(PSTR("Three\n"), false);
     38             break;
     39         default:
     40             // Or use the write_ln shortcut over adding '\n' to the end of your string
     41             oled_write_ln_P(PSTR("Undefined"), false);
     42     }
     43 
     44     // Host Keyboard LED Status
     45     led_t led_state = host_keyboard_led_state();
     46     oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR("    "), false);
     47     oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR("    "), false);
     48     oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR("    "), false);
     49     
     50     return true;
     51 }
     52 #endif