diff options
Diffstat (limited to 'quantum/backlight/backlight.h')
| -rw-r--r-- | quantum/backlight/backlight.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/quantum/backlight/backlight.h b/quantum/backlight/backlight.h new file mode 100644 index 000000000..1e581055d --- /dev/null +++ b/quantum/backlight/backlight.h | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2013 Mathias Andersson <wraul@dbox.se> | ||
| 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 | #pragma once | ||
| 19 | |||
| 20 | #include <stdint.h> | ||
| 21 | #include <stdbool.h> | ||
| 22 | |||
| 23 | #ifndef BACKLIGHT_LEVELS | ||
| 24 | # define BACKLIGHT_LEVELS 3 | ||
| 25 | #elif BACKLIGHT_LEVELS > 31 | ||
| 26 | # error "Maximum value of BACKLIGHT_LEVELS is 31" | ||
| 27 | #endif | ||
| 28 | |||
| 29 | #ifndef BREATHING_PERIOD | ||
| 30 | # define BREATHING_PERIOD 6 | ||
| 31 | #endif | ||
| 32 | |||
| 33 | typedef union { | ||
| 34 | uint8_t raw; | ||
| 35 | struct { | ||
| 36 | bool enable : 1; | ||
| 37 | bool breathing : 1; | ||
| 38 | uint8_t reserved : 1; // Reserved for possible future backlight modes | ||
| 39 | uint8_t level : 5; | ||
| 40 | }; | ||
| 41 | } backlight_config_t; | ||
| 42 | |||
| 43 | void backlight_init(void); | ||
| 44 | void backlight_increase(void); | ||
| 45 | void backlight_decrease(void); | ||
| 46 | void backlight_toggle(void); | ||
| 47 | void backlight_enable(void); | ||
| 48 | void backlight_disable(void); | ||
| 49 | bool is_backlight_enabled(void); | ||
| 50 | void backlight_step(void); | ||
| 51 | void backlight_set(uint8_t level); | ||
| 52 | void backlight_level(uint8_t level); | ||
| 53 | uint8_t get_backlight_level(void); | ||
| 54 | |||
| 55 | #ifdef BACKLIGHT_BREATHING | ||
| 56 | void backlight_toggle_breathing(void); | ||
| 57 | void backlight_enable_breathing(void); | ||
| 58 | void backlight_disable_breathing(void); | ||
| 59 | bool is_backlight_breathing(void); | ||
| 60 | void breathing_enable(void); | ||
| 61 | void breathing_disable(void); | ||
| 62 | #endif | ||
