diff options
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r-- | quantum/process_keycode/process_backlight.c | 51 | ||||
-rw-r--r-- | quantum/process_keycode/process_backlight.h | 21 |
2 files changed, 72 insertions, 0 deletions
diff --git a/quantum/process_keycode/process_backlight.c b/quantum/process_keycode/process_backlight.c new file mode 100644 index 000000000..4d12f6813 --- /dev/null +++ b/quantum/process_keycode/process_backlight.c | |||
@@ -0,0 +1,51 @@ | |||
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 | |||
19 | #include "backlight.h" | ||
20 | |||
21 | bool process_backlight(uint16_t keycode, keyrecord_t *record) { | ||
22 | if (record->event.pressed) { | ||
23 | switch (keycode) { | ||
24 | case BL_ON: | ||
25 | backlight_level(BACKLIGHT_LEVELS); | ||
26 | return false; | ||
27 | case BL_OFF: | ||
28 | backlight_level(0); | ||
29 | return false; | ||
30 | case BL_DEC: | ||
31 | backlight_decrease(); | ||
32 | return false; | ||
33 | case BL_INC: | ||
34 | backlight_increase(); | ||
35 | return false; | ||
36 | case BL_TOGG: | ||
37 | backlight_toggle(); | ||
38 | return false; | ||
39 | case BL_STEP: | ||
40 | backlight_step(); | ||
41 | return false; | ||
42 | #ifdef BACKLIGHT_BREATHING | ||
43 | case BL_BRTG: | ||
44 | backlight_toggle_breathing(); | ||
45 | return false; | ||
46 | #endif | ||
47 | } | ||
48 | } | ||
49 | |||
50 | return true; | ||
51 | } | ||
diff --git a/quantum/process_keycode/process_backlight.h b/quantum/process_keycode/process_backlight.h new file mode 100644 index 000000000..7fe887ae6 --- /dev/null +++ b/quantum/process_keycode/process_backlight.h | |||
@@ -0,0 +1,21 @@ | |||
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 | #pragma once | ||
18 | |||
19 | #include "quantum.h" | ||
20 | |||
21 | bool process_backlight(uint16_t keycode, keyrecord_t *record); | ||