summaryrefslogtreecommitdiff
path: root/quantum/process_keycode
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2024-04-11 14:06:36 +1000
committerGitHub <noreply@github.com>2024-04-11 14:06:36 +1000
commit25f608c1b437060e8c9b451ed81c7e37a2531284 (patch)
treed49488270685d04b7ff8a017946497d21b9d16ea /quantum/process_keycode
parent4acdddbf48707e5221cb754b4aa5caf32ce28276 (diff)
Separate keycode handling for LED Matrix and Backlight (#23426)
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r--quantum/process_keycode/process_backlight.c30
-rw-r--r--quantum/process_keycode/process_led_matrix.c32
-rw-r--r--quantum/process_keycode/process_led_matrix.h10
3 files changed, 44 insertions, 28 deletions
diff --git a/quantum/process_keycode/process_backlight.c b/quantum/process_keycode/process_backlight.c
index c1596ec07d..dafe979760 100644
--- a/quantum/process_keycode/process_backlight.c
+++ b/quantum/process_keycode/process_backlight.c
@@ -15,36 +15,11 @@
15 */ 15 */
16 16
17#include "process_backlight.h" 17#include "process_backlight.h"
18 18#include "backlight.h"
19#ifdef LED_MATRIX_ENABLE
20# include "led_matrix.h"
21#else
22# include "backlight.h"
23#endif
24 19
25bool process_backlight(uint16_t keycode, keyrecord_t *record) { 20bool process_backlight(uint16_t keycode, keyrecord_t *record) {
26 if (record->event.pressed) { 21 if (record->event.pressed) {
27 switch (keycode) { 22 switch (keycode) {
28#ifdef LED_MATRIX_ENABLE
29 case QK_BACKLIGHT_ON:
30 led_matrix_enable();
31 return false;
32 case QK_BACKLIGHT_OFF:
33 led_matrix_disable();
34 return false;
35 case QK_BACKLIGHT_DOWN:
36 led_matrix_decrease_val();
37 return false;
38 case QK_BACKLIGHT_UP:
39 led_matrix_increase_val();
40 return false;
41 case QK_BACKLIGHT_TOGGLE:
42 led_matrix_toggle();
43 return false;
44 case QK_BACKLIGHT_STEP:
45 led_matrix_step();
46 return false;
47#else
48 case QK_BACKLIGHT_ON: 23 case QK_BACKLIGHT_ON:
49 backlight_level(BACKLIGHT_LEVELS); 24 backlight_level(BACKLIGHT_LEVELS);
50 return false; 25 return false;
@@ -63,11 +38,10 @@ bool process_backlight(uint16_t keycode, keyrecord_t *record) {
63 case QK_BACKLIGHT_STEP: 38 case QK_BACKLIGHT_STEP:
64 backlight_step(); 39 backlight_step();
65 return false; 40 return false;
66# ifdef BACKLIGHT_BREATHING 41#ifdef BACKLIGHT_BREATHING
67 case QK_BACKLIGHT_TOGGLE_BREATHING: 42 case QK_BACKLIGHT_TOGGLE_BREATHING:
68 backlight_toggle_breathing(); 43 backlight_toggle_breathing();
69 return false; 44 return false;
70# endif
71#endif 45#endif
72 } 46 }
73 } 47 }
diff --git a/quantum/process_keycode/process_led_matrix.c b/quantum/process_keycode/process_led_matrix.c
new file mode 100644
index 0000000000..217c9a2c28
--- /dev/null
+++ b/quantum/process_keycode/process_led_matrix.c
@@ -0,0 +1,32 @@
1// Copyright 2024 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include "process_led_matrix.h"
5#include "led_matrix.h"
6
7bool process_led_matrix(uint16_t keycode, keyrecord_t *record) {
8 if (record->event.pressed) {
9 switch (keycode) {
10 case QK_BACKLIGHT_ON:
11 led_matrix_enable();
12 return false;
13 case QK_BACKLIGHT_OFF:
14 led_matrix_disable();
15 return false;
16 case QK_BACKLIGHT_DOWN:
17 led_matrix_decrease_val();
18 return false;
19 case QK_BACKLIGHT_UP:
20 led_matrix_increase_val();
21 return false;
22 case QK_BACKLIGHT_TOGGLE:
23 led_matrix_toggle();
24 return false;
25 case QK_BACKLIGHT_STEP:
26 led_matrix_step();
27 return false;
28 }
29 }
30
31 return true;
32}
diff --git a/quantum/process_keycode/process_led_matrix.h b/quantum/process_keycode/process_led_matrix.h
new file mode 100644
index 0000000000..407d04aa27
--- /dev/null
+++ b/quantum/process_keycode/process_led_matrix.h
@@ -0,0 +1,10 @@
1// Copyright 2024 QMK
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6#include <stdint.h>
7#include <stdbool.h>
8#include "action.h"
9
10bool process_led_matrix(uint16_t keycode, keyrecord_t *record);