forked from forks/qmk_firmware
Separate keycode handling for LED Matrix and Backlight (#23426)
This commit is contained in:
parent
4acdddbf48
commit
25f608c1b4
|
@ -353,7 +353,7 @@ ifeq ($(strip $(LED_MATRIX_ENABLE)), yes)
|
|||
COMMON_VPATH += $(QUANTUM_DIR)/led_matrix/animations
|
||||
COMMON_VPATH += $(QUANTUM_DIR)/led_matrix/animations/runners
|
||||
POST_CONFIG_H += $(QUANTUM_DIR)/led_matrix/post_config.h
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_led_matrix.c
|
||||
SRC += $(QUANTUM_DIR)/led_matrix/led_matrix.c
|
||||
SRC += $(QUANTUM_DIR)/led_matrix/led_matrix_drivers.c
|
||||
LIB8TION_ENABLE := yes
|
||||
|
|
|
@ -15,36 +15,11 @@
|
|||
*/
|
||||
|
||||
#include "process_backlight.h"
|
||||
|
||||
#ifdef LED_MATRIX_ENABLE
|
||||
# include "led_matrix.h"
|
||||
#else
|
||||
#include "backlight.h"
|
||||
#endif
|
||||
|
||||
bool process_backlight(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
switch (keycode) {
|
||||
#ifdef LED_MATRIX_ENABLE
|
||||
case QK_BACKLIGHT_ON:
|
||||
led_matrix_enable();
|
||||
return false;
|
||||
case QK_BACKLIGHT_OFF:
|
||||
led_matrix_disable();
|
||||
return false;
|
||||
case QK_BACKLIGHT_DOWN:
|
||||
led_matrix_decrease_val();
|
||||
return false;
|
||||
case QK_BACKLIGHT_UP:
|
||||
led_matrix_increase_val();
|
||||
return false;
|
||||
case QK_BACKLIGHT_TOGGLE:
|
||||
led_matrix_toggle();
|
||||
return false;
|
||||
case QK_BACKLIGHT_STEP:
|
||||
led_matrix_step();
|
||||
return false;
|
||||
#else
|
||||
case QK_BACKLIGHT_ON:
|
||||
backlight_level(BACKLIGHT_LEVELS);
|
||||
return false;
|
||||
|
@ -67,7 +42,6 @@ bool process_backlight(uint16_t keycode, keyrecord_t *record) {
|
|||
case QK_BACKLIGHT_TOGGLE_BREATHING:
|
||||
backlight_toggle_breathing();
|
||||
return false;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
32
quantum/process_keycode/process_led_matrix.c
Normal file
32
quantum/process_keycode/process_led_matrix.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2024 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "process_led_matrix.h"
|
||||
#include "led_matrix.h"
|
||||
|
||||
bool process_led_matrix(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
switch (keycode) {
|
||||
case QK_BACKLIGHT_ON:
|
||||
led_matrix_enable();
|
||||
return false;
|
||||
case QK_BACKLIGHT_OFF:
|
||||
led_matrix_disable();
|
||||
return false;
|
||||
case QK_BACKLIGHT_DOWN:
|
||||
led_matrix_decrease_val();
|
||||
return false;
|
||||
case QK_BACKLIGHT_UP:
|
||||
led_matrix_increase_val();
|
||||
return false;
|
||||
case QK_BACKLIGHT_TOGGLE:
|
||||
led_matrix_toggle();
|
||||
return false;
|
||||
case QK_BACKLIGHT_STEP:
|
||||
led_matrix_step();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
10
quantum/process_keycode/process_led_matrix.h
Normal file
10
quantum/process_keycode/process_led_matrix.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
// Copyright 2024 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "action.h"
|
||||
|
||||
bool process_led_matrix(uint16_t keycode, keyrecord_t *record);
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "quantum.h"
|
||||
|
||||
#if defined(BACKLIGHT_ENABLE) || defined(LED_MATRIX_ENABLE)
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
# include "process_backlight.h"
|
||||
#endif
|
||||
|
||||
|
@ -40,6 +40,10 @@
|
|||
# include "process_leader.h"
|
||||
#endif
|
||||
|
||||
#ifdef LED_MATRIX_ENABLE
|
||||
# include "process_led_matrix.h"
|
||||
#endif
|
||||
|
||||
#ifdef MAGIC_ENABLE
|
||||
# include "process_magic.h"
|
||||
#endif
|
||||
|
@ -333,9 +337,12 @@ bool process_record_quantum(keyrecord_t *record) {
|
|||
#ifdef AUDIO_ENABLE
|
||||
process_audio(keycode, record) &&
|
||||
#endif
|
||||
#if defined(BACKLIGHT_ENABLE) || defined(LED_MATRIX_ENABLE)
|
||||
#if defined(BACKLIGHT_ENABLE)
|
||||
process_backlight(keycode, record) &&
|
||||
#endif
|
||||
#if defined(LED_MATRIX_ENABLE)
|
||||
process_led_matrix(keycode, record) &&
|
||||
#endif
|
||||
#ifdef STENO_ENABLE
|
||||
process_steno(keycode, record) &&
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue