LED Matrix: decouple from Backlight (#12054)
This commit is contained in:
parent
b0069c5c05
commit
9155b59e1a
@ -223,11 +223,10 @@ VALID_LED_MATRIX_TYPES := IS31FL3731 custom
|
|||||||
|
|
||||||
ifeq ($(strip $(LED_MATRIX_ENABLE)), yes)
|
ifeq ($(strip $(LED_MATRIX_ENABLE)), yes)
|
||||||
ifeq ($(filter $(LED_MATRIX_DRIVER),$(VALID_LED_MATRIX_TYPES)),)
|
ifeq ($(filter $(LED_MATRIX_DRIVER),$(VALID_LED_MATRIX_TYPES)),)
|
||||||
$(error LED_MATRIX_DRIVER="$(LED_MATRIX_DRIVER)" is not a valid matrix type)
|
$(error "$(LED_MATRIX_DRIVER)" is not a valid matrix type)
|
||||||
else
|
else
|
||||||
BACKLIGHT_ENABLE = yes
|
|
||||||
BACKLIGHT_DRIVER = custom
|
|
||||||
OPT_DEFS += -DLED_MATRIX_ENABLE
|
OPT_DEFS += -DLED_MATRIX_ENABLE
|
||||||
|
SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c
|
||||||
SRC += $(QUANTUM_DIR)/led_matrix.c
|
SRC += $(QUANTUM_DIR)/led_matrix.c
|
||||||
SRC += $(QUANTUM_DIR)/led_matrix_drivers.c
|
SRC += $(QUANTUM_DIR)/led_matrix_drivers.c
|
||||||
endif
|
endif
|
||||||
|
@ -45,10 +45,6 @@ led_eeconfig_t led_matrix_eeconfig;
|
|||||||
# define LED_DISABLE_WHEN_USB_SUSPENDED false
|
# define LED_DISABLE_WHEN_USB_SUSPENDED false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef EECONFIG_LED_MATRIX
|
|
||||||
# define EECONFIG_LED_MATRIX EECONFIG_RGBLIGHT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(LED_MATRIX_MAXIMUM_BRIGHTNESS) || LED_MATRIX_MAXIMUM_BRIGHTNESS > 255
|
#if !defined(LED_MATRIX_MAXIMUM_BRIGHTNESS) || LED_MATRIX_MAXIMUM_BRIGHTNESS > 255
|
||||||
# define LED_MATRIX_MAXIMUM_BRIGHTNESS 255
|
# define LED_MATRIX_MAXIMUM_BRIGHTNESS 255
|
||||||
#endif
|
#endif
|
||||||
@ -135,7 +131,7 @@ void led_matrix_set_suspend_state(bool state) { g_suspend_state = state; }
|
|||||||
void led_matrix_all_off(void) { led_matrix_set_index_value_all(0); }
|
void led_matrix_all_off(void) { led_matrix_set_index_value_all(0); }
|
||||||
|
|
||||||
// Uniform brightness
|
// Uniform brightness
|
||||||
void led_matrix_uniform_brightness(void) { led_matrix_set_index_value_all(LED_MATRIX_MAXIMUM_BRIGHTNESS / BACKLIGHT_LEVELS * led_matrix_eeconfig.val); }
|
void led_matrix_uniform_brightness(void) { led_matrix_set_index_value_all(led_matrix_eeconfig.val); }
|
||||||
|
|
||||||
void led_matrix_custom(void) {}
|
void led_matrix_custom(void) {}
|
||||||
|
|
||||||
@ -344,5 +340,3 @@ void led_matrix_set_value(uint8_t val) {
|
|||||||
led_matrix_set_value_noeeprom(val);
|
led_matrix_set_value_noeeprom(val);
|
||||||
eeconfig_update_led_matrix(led_matrix_eeconfig.raw);
|
eeconfig_update_led_matrix(led_matrix_eeconfig.raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set(uint8_t val) { led_matrix_set_value(val); }
|
|
||||||
|
@ -21,10 +21,6 @@
|
|||||||
|
|
||||||
#include "led_matrix_types.h"
|
#include "led_matrix_types.h"
|
||||||
|
|
||||||
#ifndef BACKLIGHT_ENABLE
|
|
||||||
# error You must define BACKLIGHT_ENABLE with LED_MATRIX_ENABLE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum led_matrix_effects {
|
enum led_matrix_effects {
|
||||||
LED_MATRIX_UNIFORM_BRIGHTNESS = 1,
|
LED_MATRIX_UNIFORM_BRIGHTNESS = 1,
|
||||||
// All new effects go above this line
|
// All new effects go above this line
|
||||||
|
@ -16,11 +16,35 @@
|
|||||||
|
|
||||||
#include "process_backlight.h"
|
#include "process_backlight.h"
|
||||||
|
|
||||||
#include "backlight.h"
|
#ifdef LED_MATRIX_ENABLE
|
||||||
|
# include "led_matrix.h"
|
||||||
|
#else
|
||||||
|
# include "backlight.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
bool process_backlight(uint16_t keycode, keyrecord_t *record) {
|
bool process_backlight(uint16_t keycode, keyrecord_t *record) {
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
|
#ifdef LED_MATRIX_ENABLE
|
||||||
|
case BL_ON:
|
||||||
|
led_matrix_enable();
|
||||||
|
return false;
|
||||||
|
case BL_OFF:
|
||||||
|
led_matrix_disable();
|
||||||
|
return false;
|
||||||
|
case BL_DEC:
|
||||||
|
led_matrix_decrease_val();
|
||||||
|
return false;
|
||||||
|
case BL_INC:
|
||||||
|
led_matrix_increase_val();
|
||||||
|
return false;
|
||||||
|
case BL_TOGG:
|
||||||
|
led_matrix_toggle();
|
||||||
|
return false;
|
||||||
|
case BL_STEP:
|
||||||
|
led_matrix_step();
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
case BL_ON:
|
case BL_ON:
|
||||||
backlight_level(BACKLIGHT_LEVELS);
|
backlight_level(BACKLIGHT_LEVELS);
|
||||||
return false;
|
return false;
|
||||||
@ -39,10 +63,11 @@ bool process_backlight(uint16_t keycode, keyrecord_t *record) {
|
|||||||
case BL_STEP:
|
case BL_STEP:
|
||||||
backlight_step();
|
backlight_step();
|
||||||
return false;
|
return false;
|
||||||
#ifdef BACKLIGHT_BREATHING
|
# ifdef BACKLIGHT_BREATHING
|
||||||
case BL_BRTG:
|
case BL_BRTG:
|
||||||
backlight_toggle_breathing();
|
backlight_toggle_breathing();
|
||||||
return false;
|
return false;
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ bool process_record_quantum(keyrecord_t *record) {
|
|||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
process_audio(keycode, record) &&
|
process_audio(keycode, record) &&
|
||||||
#endif
|
#endif
|
||||||
#ifdef BACKLIGHT_ENABLE
|
#if defined(BACKLIGHT_ENABLE) || defined(LED_MATRIX_ENABLE)
|
||||||
process_backlight(keycode, record) &&
|
process_backlight(keycode, record) &&
|
||||||
#endif
|
#endif
|
||||||
#ifdef STENO_ENABLE
|
#ifdef STENO_ENABLE
|
||||||
@ -387,15 +387,14 @@ void matrix_init_quantum() {
|
|||||||
led_init_ports();
|
led_init_ports();
|
||||||
#endif
|
#endif
|
||||||
#ifdef BACKLIGHT_ENABLE
|
#ifdef BACKLIGHT_ENABLE
|
||||||
# ifdef LED_MATRIX_ENABLE
|
|
||||||
led_matrix_init();
|
|
||||||
# else
|
|
||||||
backlight_init_ports();
|
backlight_init_ports();
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
audio_init();
|
audio_init();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef LED_MATRIX_ENABLE
|
||||||
|
led_matrix_init();
|
||||||
|
#endif
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
#ifdef RGB_MATRIX_ENABLE
|
||||||
rgb_matrix_init();
|
rgb_matrix_init();
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,11 +30,11 @@
|
|||||||
#include "keymap.h"
|
#include "keymap.h"
|
||||||
|
|
||||||
#ifdef BACKLIGHT_ENABLE
|
#ifdef BACKLIGHT_ENABLE
|
||||||
# ifdef LED_MATRIX_ENABLE
|
# include "backlight.h"
|
||||||
# include "led_matrix.h"
|
#endif
|
||||||
# else
|
|
||||||
# include "backlight.h"
|
#ifdef LED_MATRIX_ENABLE
|
||||||
# endif
|
# include "led_matrix.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(RGBLIGHT_ENABLE)
|
#if defined(RGBLIGHT_ENABLE)
|
||||||
@ -98,7 +98,7 @@ extern layer_state_t layer_state;
|
|||||||
# include "process_music.h"
|
# include "process_music.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BACKLIGHT_ENABLE
|
#if defined(BACKLIGHT_ENABLE) || defined(LED_MATRIX_ENABLE)
|
||||||
# include "process_backlight.h"
|
# include "process_backlight.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -43,9 +43,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define EECONFIG_VELOCIKEY (uint8_t *)23
|
#define EECONFIG_VELOCIKEY (uint8_t *)23
|
||||||
|
|
||||||
#define EECONFIG_HAPTIC (uint32_t *)24
|
#define EECONFIG_HAPTIC (uint32_t *)24
|
||||||
|
|
||||||
|
// Mutually exclusive
|
||||||
|
#define EECONFIG_LED_MATRIX (uint32_t *)28
|
||||||
#define EECONFIG_RGB_MATRIX (uint32_t *)28
|
#define EECONFIG_RGB_MATRIX (uint32_t *)28
|
||||||
// Speed & Flags
|
// Speed & Flags
|
||||||
|
#define EECONFIG_LED_MATRIX_EXTENDED (uint16_t *)32
|
||||||
#define EECONFIG_RGB_MATRIX_EXTENDED (uint16_t *)32
|
#define EECONFIG_RGB_MATRIX_EXTENDED (uint16_t *)32
|
||||||
|
|
||||||
// TODO: Combine these into a single word and single block of EEPROM
|
// TODO: Combine these into a single word and single block of EEPROM
|
||||||
#define EECONFIG_KEYMAP_UPPER_BYTE (uint8_t *)34
|
#define EECONFIG_KEYMAP_UPPER_BYTE (uint8_t *)34
|
||||||
// Size of EEPROM being used, other code can refer to this for available EEPROM
|
// Size of EEPROM being used, other code can refer to this for available EEPROM
|
||||||
|
Loading…
Reference in New Issue
Block a user