aboutsummaryrefslogtreecommitdiff
path: root/quantum/backlight/backlight.h
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2019-10-17 17:48:58 +0100
committerGitHub <noreply@github.com>2019-10-17 17:48:58 +0100
commitabfd6ed9613013d3c9f15da8b575a902d9bcf274 (patch)
tree8f2a4601586a7bc67f5f684e0d07b41e9608f3b3 /quantum/backlight/backlight.h
parente3a21348c3879c11072c7c42d3b4d04b022f4fe2 (diff)
downloadqmk_firmware-abfd6ed9613013d3c9f15da8b575a902d9bcf274.tar.gz
qmk_firmware-abfd6ed9613013d3c9f15da8b575a902d9bcf274.zip
Move tmk_core/common/backlight to quantum/backlight (#6710)
* Move tmk_core/common/backlight to quantum/backlight * Add guards to backlight inclusion * Add guards to backlight inclusion * Update backlight guards on clueboard/60 * Use full paths to avoid vpath issues
Diffstat (limited to 'quantum/backlight/backlight.h')
-rw-r--r--quantum/backlight/backlight.h62
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/*
2Copyright 2013 Mathias Andersson <wraul@dbox.se>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along 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
33typedef 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
43void backlight_init(void);
44void backlight_increase(void);
45void backlight_decrease(void);
46void backlight_toggle(void);
47void backlight_enable(void);
48void backlight_disable(void);
49bool is_backlight_enabled(void);
50void backlight_step(void);
51void backlight_set(uint8_t level);
52void backlight_level(uint8_t level);
53uint8_t get_backlight_level(void);
54
55#ifdef BACKLIGHT_BREATHING
56void backlight_toggle_breathing(void);
57void backlight_enable_breathing(void);
58void backlight_disable_breathing(void);
59bool is_backlight_breathing(void);
60void breathing_enable(void);
61void breathing_disable(void);
62#endif