qmk_firmware

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

process_backlight.c (1671B)


      1 /* Copyright 2019
      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 "process_backlight.h"
     18 #include "backlight.h"
     19 
     20 bool process_backlight(uint16_t keycode, keyrecord_t *record) {
     21     if (record->event.pressed) {
     22         switch (keycode) {
     23             case QK_BACKLIGHT_ON:
     24                 backlight_level(BACKLIGHT_LEVELS);
     25                 return false;
     26             case QK_BACKLIGHT_OFF:
     27                 backlight_level(0);
     28                 return false;
     29             case QK_BACKLIGHT_DOWN:
     30                 backlight_decrease();
     31                 return false;
     32             case QK_BACKLIGHT_UP:
     33                 backlight_increase();
     34                 return false;
     35             case QK_BACKLIGHT_TOGGLE:
     36                 backlight_toggle();
     37                 return false;
     38             case QK_BACKLIGHT_STEP:
     39                 backlight_step();
     40                 return false;
     41 #ifdef BACKLIGHT_BREATHING
     42             case QK_BACKLIGHT_TOGGLE_BREATHING:
     43                 backlight_toggle_breathing();
     44                 return false;
     45 #endif
     46         }
     47     }
     48 
     49     return true;
     50 }