zeuspad.c (2059B)
1 /* Copyright 2021 Koobaczech 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 // 21 characters max 20 #ifdef OLED_ENABLE 21 bool oled_task_kb(void) { 22 if (oled_task_user()) { 23 return false; 24 } 25 oled_write_P(PSTR("ZEUSPAD BY KOOBACZECH"), false); 26 // Keyboard Layer Status 27 oled_write_P(PSTR("LAYER: "), false); 28 29 switch (get_highest_layer(layer_state)) { 30 case 1: 31 oled_write_ln_P(PSTR("FN"), false); 32 break; 33 default: 34 oled_write_ln_P(PSTR("Default"), false); 35 } 36 // Keyboard Locking Status 37 led_t led_state = host_keyboard_led_state(); 38 oled_write_P(led_state.caps_lock ? PSTR("CAPS ") : PSTR(" "), false); 39 oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false); 40 oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); 41 42 switch (rgblight_is_enabled() ? 1 : 2) { 43 case 1: 44 // Or use the write_ln shortcut over adding '\n' to the end of your string 45 oled_write_P(PSTR("RGB"), false); 46 static char led_buf[30]; 47 snprintf(led_buf, sizeof(led_buf) - 1, "\nMODE:%2d BRIGHT:%2d/10", (uint8_t)(rgblight_get_mode()), (uint8_t)(rgblight_get_val() / 25.5)); 48 oled_write(led_buf, false); 49 break; 50 default: 51 oled_write_ln_P(PSTR(""), false); 52 oled_write_P(PSTR("\n"), false); 53 } 54 55 return true; 56 } 57 #endif