qmk_firmware

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

meira.c (1414B)


      1 /* Copyright 2017 Cole Markham, WoodKeys.click
      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 "meira.h"
     17 
     18 void matrix_init_kb(void) {
     19 #ifdef WATCHDOG_ENABLE
     20     // This is done after turning the layer LED red, if we're caught in a loop
     21     // we should get a flashing red light
     22     wdt_enable(WDTO_500MS);
     23 #endif
     24 
     25     // put your keyboard start-up code here
     26     // runs once when the firmware starts up
     27     matrix_init_user();
     28 }
     29 
     30 void housekeeping_task_kb(void) {
     31 #ifdef WATCHDOG_ENABLE
     32     wdt_reset();
     33 #endif
     34 }
     35 
     36 bool shutdown_kb(bool jump_to_bootloader) {
     37 #ifdef WATCHDOG_ENABLE
     38     // Unconditionally run so shutdown_user can't mess up watchdog
     39     MCUSR = 0;
     40     wdt_disable();
     41     wdt_reset();
     42 #endif
     43 
     44     if (!shutdown_user(jump_to_bootloader)) {
     45         return false;
     46     }
     47     return true;
     48 }