glitch.c (1717B)
1 /* Copyright 2021 Matthew Dias 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 ENCODER_ENABLE 19 bool encoder_update_kb(uint8_t index, bool clockwise) { 20 if (!encoder_update_user(index, clockwise)) { 21 return false; 22 } 23 if (clockwise) { 24 rgblight_step(); 25 } else { 26 rgblight_step_reverse(); 27 } 28 29 return false; 30 } 31 #endif 32 33 #ifdef OLED_ENABLE 34 bool oled_task_kb(void) { 35 if (!oled_task_user()) { 36 return false; 37 } 38 // Host Keyboard Layer Status 39 oled_write_P(PSTR("Layer: "), false); 40 41 switch (get_highest_layer(layer_state)) { 42 case 0: 43 oled_write_P(PSTR("Default\n"), false); 44 break; 45 default: 46 oled_write_P(PSTR("Undefined\n"), false); 47 } 48 49 // Host Keyboard LED Status 50 led_t led_state = host_keyboard_led_state(); 51 oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false); 52 oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); 53 oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); 54 55 return false; 56 } 57 #endif