franky36.c (2096B)
1 /* Copyright 2024-2025 Grigory Avdyushin 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 QMK_KEYBOARD_H 18 19 #ifdef OLED_ENABLE 20 21 static void render_logo(void) { 22 static const char PROGMEM qmk_logo[] = { 23 0x80, 0x81, 0x82, 0x83, 0x84, 24 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 25 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0x00, 0x0A, 0x0A 26 }; 27 28 oled_write_P(qmk_logo, false); 29 } 30 31 static void render_mod_status(uint8_t modifiers) { 32 oled_write_P(PSTR("MODS:"), false); 33 oled_write_P(PSTR("S"), (modifiers & MOD_MASK_SHIFT)); 34 oled_write_P(PSTR("C"), (modifiers & MOD_MASK_CTRL)); 35 oled_write_P(PSTR("A"), (modifiers & MOD_MASK_ALT)); 36 oled_write_ln_P(PSTR("G"), (modifiers & MOD_MASK_GUI)); 37 oled_write_ln_P(PSTR(" "), false); 38 } 39 40 static void render_layer_state(void) { 41 oled_write_ln_P(PSTR(" "), false); 42 oled_write_P("BASE ", layer_state_is(0)); 43 oled_write_P("LOWER", layer_state_is(1)); 44 oled_write_P("RAISE", layer_state_is(2)); 45 oled_write_P("NAV ", layer_state_is(3)); 46 oled_write_ln_P(PSTR(" "), false); 47 } 48 49 static void render_capsword_state(bool on) { 50 oled_write_ln_P("CAPSW", on); 51 } 52 53 oled_rotation_t oled_init_kb(oled_rotation_t rotation) { 54 return OLED_ROTATION_270; 55 } 56 57 bool oled_task_kb(void) { 58 if (!oled_task_user()) { 59 return false; 60 } 61 render_logo(); 62 render_layer_state(); 63 render_mod_status(get_mods() | get_oneshot_mods()); 64 render_capsword_state(is_caps_word_on()); 65 return false; 66 } 67 68 #endif