kb16.c (1460B)
1 /* Copyright 2022 DOIO 2 * Copyright 2022 HorrorTroll <https://github.com/HorrorTroll> 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #include "quantum.h" 19 20 // OLED animation 21 #include "./lib/logo.h" 22 23 // Default timeout for displaying boot logo. 24 #ifndef OLED_LOGO_TIMEOUT 25 #define OLED_LOGO_TIMEOUT 5000 26 #endif 27 28 #ifdef OLED_ENABLE 29 uint16_t startup_timer; 30 31 oled_rotation_t oled_init_kb(oled_rotation_t rotation) { 32 startup_timer = timer_read(); 33 34 return rotation; 35 } 36 37 bool oled_task_kb(void) { 38 static bool finished_logo = false; 39 40 if ((timer_elapsed(startup_timer) < OLED_LOGO_TIMEOUT) && !finished_logo) { 41 render_logo(); 42 } else { 43 finished_logo = true; 44 if (!oled_task_user()) { 45 return false; 46 } 47 } 48 return true; 49 } 50 #endif