qmk_firmware

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

wt_mono_backlight.h (2634B)


      1 /* Copyright 2018 Jason Williams (Wilba)
      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 #pragma once
     18 
     19 #include <stdint.h>
     20 #include <stdbool.h>
     21 
     22 #include "action.h"
     23 #include "quantum/color.h"
     24 
     25 typedef struct PACKED
     26 {
     27     uint8_t h;
     28     uint8_t s;
     29 } HS;
     30 
     31 typedef struct
     32 {
     33 	bool disable_when_usb_suspended:1;  // |
     34     bool __pad1:1;                      // |
     35     bool __pad2:1;                      // |
     36     bool __pad3:1;                      // |
     37     bool __pad4:1;                      // |
     38     bool __pad5:1;                      // |
     39     bool __pad6:1;                      // |
     40     bool __pad7:1;                      // 1 byte
     41     uint8_t disable_after_timeout;      // 1 byte
     42     uint8_t brightness;                 // 1 byte
     43     uint8_t effect;                     // 1 byte
     44     uint8_t effect_speed;               // 1 byte
     45     HS color_1;                         // 2 bytes (Indicator Color for Xeno)
     46 } backlight_config;                     // = 7 bytes
     47 
     48 void backlight_config_load(void);
     49 void backlight_config_save(void);
     50 void backlight_config_set_value( uint8_t *data );
     51 void backlight_config_get_value( uint8_t *data );
     52 
     53 void backlight_init_drivers(void);
     54 
     55 void backlight_timer_init(void);
     56 void backlight_timer_enable(void);
     57 void backlight_timer_disable(void);
     58 
     59 void backlight_set_suspend_state(bool state);
     60 
     61 // This should not be called from an interrupt
     62 // (eg. from a timer interrupt).
     63 // Call this while idle (in between matrix scans).
     64 // If the buffer is dirty, it will update the driver with the buffer.
     65 void backlight_update_pwm_buffers(void);
     66 
     67 // Handle backlight specific keycodes
     68 bool process_record_backlight(uint16_t keycode, keyrecord_t *record);
     69 
     70 void backlight_set_key_hit(uint8_t row, uint8_t col);
     71 
     72 void backlight_effect_increase(void);
     73 void backlight_effect_decrease(void);
     74 void backlight_effect_speed_increase(void);
     75 void backlight_effect_speed_decrease(void);
     76 
     77 void backlight_brightness_increase(void);
     78 void backlight_brightness_decrease(void);
     79 
     80 void backlight_device_indication(uint8_t value);