qmk_firmware

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

oled.c (2258B)


      1 /* Copyright 2021 Yang Hu
      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 #ifdef OLED_ENABLE
     17 #    include QMK_KEYBOARD_H
     18 #    include "layers.h"
     19 
     20 // Some characters position:
     21 // alt: 84 85 86/a..../c...
     22 // shift:87 88 89/a.../c...
     23 // ctrl: b6 b6/d.../
     24 // capslock: 9c-9f/b.../d...
     25 // numlock: 98-9b/b.../d...
     26 // navigation logo: 92-95/b2.../d2...
     27 // symbol logo: 8a-8d/aa..../ca....
     28 // qmk logos; 8e-91/ae..../ce....
     29 void oled_render_layer(void) {
     30     /* static const char PROGMEM cmd_logo[] = { */
     31     /*   0x80, 0x81, 0x82, 0x83, 10, */
     32     /*   0xa0, 0xa1, 0xa2, 0xa3, 10, */
     33     /*   0xc0, 0xc1, 0xc2, 0xc3, 10, */
     34     /*   0}; */
     35     // clang-format off
     36     static const char PROGMEM numlock_logo[] = {
     37       0x98, 0x99, 0x9a, 0x9b, 10,
     38       0xb8, 0xb9, 0xba, 0xbb, 10,
     39       0xd8, 0xd9, 0xda, 0xdb, 10, 0};
     40     static const char PROGMEM symbol_logo[] = {
     41       0x8a, 0x8b, 0x8c, 0x8d, 10,
     42       0xaa, 0xab, 0xac, 0xad, 10,
     43       0xca, 0xcb, 0xcc, 0xcd, 10, 0};
     44     static const char PROGMEM qmk_logo[] = {
     45       0x8e, 0x8f, 0x90, 0x91, 10,
     46       0xae, 0xaf, 0xb0, 0xb1, 10,
     47       0xce, 0xcf, 0xd0, 0xd1, 10, 0};
     48     // clang-format on
     49     if (IS_LAYER_ON(_LOWER)) {
     50         oled_write_P(symbol_logo, false);
     51     } else if (IS_LAYER_ON(_RAISE)) {
     52         oled_write_P(numlock_logo, false);
     53     } else if (IS_LAYER_ON(_BASE)) {
     54         oled_write_P(qmk_logo, false);
     55     } else {
     56         if (IS_LAYER_ON(_ADJUST)) {
     57             oled_write_ln("ADJ", false);
     58         } else {
     59             oled_write_ln("?????", false);
     60         }
     61         oled_write_ln(" ", false);
     62         oled_write_ln(" ", false);
     63         oled_write_ln(" ", false);
     64     }
     65 }
     66 
     67 #endif