Add multithreadedness for lighting options
This commit is contained in:
parent
2df0263010
commit
82aed74e67
2 changed files with 65 additions and 14 deletions
|
@ -963,6 +963,10 @@ ifeq ($(strip $(DIP_SWITCH_ENABLE)), yes)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(MULTITHREADED_LIGHTING_ENABLE)), yes)
|
||||||
|
OPT_DEFS += -DMULTITHREADED_LIGHTING_ENABLE
|
||||||
|
endif
|
||||||
|
|
||||||
VALID_WS2812_DRIVER_TYPES := bitbang custom i2c pwm spi vendor
|
VALID_WS2812_DRIVER_TYPES := bitbang custom i2c pwm spi vendor
|
||||||
|
|
||||||
WS2812_DRIVER ?= bitbang
|
WS2812_DRIVER ?= bitbang
|
||||||
|
|
|
@ -403,6 +403,45 @@ void quantum_init(void) {
|
||||||
layer_state_set_kb((layer_state_t)layer_state);
|
layer_state_set_kb((layer_state_t)layer_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MULTITHREADED_LIGHTING_ENABLE
|
||||||
|
static THD_WORKING_AREA(waLightingThread, 1024);
|
||||||
|
static THD_FUNCTION(LightingThread, arg) {
|
||||||
|
(void)arg;
|
||||||
|
chRegSetThreadName("lighting");
|
||||||
|
# ifdef LED_MATRIX_ENABLE
|
||||||
|
led_matrix_init();
|
||||||
|
# endif
|
||||||
|
# ifdef RGB_MATRIX_ENABLE
|
||||||
|
rgb_matrix_init();
|
||||||
|
# endif
|
||||||
|
# ifdef RGBLIGHT_ENABLE
|
||||||
|
rgblight_init();
|
||||||
|
# endif
|
||||||
|
# ifdef BACKLIGHT_ENABLE
|
||||||
|
backlight_init();
|
||||||
|
# endif
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
# if defined(RGBLIGHT_ENABLE)
|
||||||
|
rgblight_task();
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef LED_MATRIX_ENABLE
|
||||||
|
led_matrix_task();
|
||||||
|
# endif
|
||||||
|
# ifdef RGB_MATRIX_ENABLE
|
||||||
|
rgb_matrix_task();
|
||||||
|
# endif
|
||||||
|
# if defined(BACKLIGHT_ENABLE)
|
||||||
|
# if defined(BACKLIGHT_PIN) || defined(BACKLIGHT_PINS)
|
||||||
|
backlight_task();
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
chThdSleepMicroseconds(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // MULTITHREADED_EFFECTS_ENABLE
|
||||||
|
|
||||||
/** \brief keyboard_init
|
/** \brief keyboard_init
|
||||||
*
|
*
|
||||||
* FIXME: needs doc
|
* FIXME: needs doc
|
||||||
|
@ -428,11 +467,15 @@ void keyboard_init(void) {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
audio_init();
|
audio_init();
|
||||||
#endif
|
#endif
|
||||||
#ifdef LED_MATRIX_ENABLE
|
#ifdef MULTITHREADED_LIGHTING_ENABLE
|
||||||
|
chThdCreateStatic(waLightingThread, sizeof(waLightingThread), HIGHPRIO, LightingThread, NULL);
|
||||||
|
#else
|
||||||
|
# ifdef LED_MATRIX_ENABLE
|
||||||
led_matrix_init();
|
led_matrix_init();
|
||||||
#endif
|
# endif
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
# ifdef RGB_MATRIX_ENABLE
|
||||||
rgb_matrix_init();
|
rgb_matrix_init();
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(UNICODE_COMMON_ENABLE)
|
#if defined(UNICODE_COMMON_ENABLE)
|
||||||
unicode_input_mode_init();
|
unicode_input_mode_init();
|
||||||
|
@ -449,11 +492,13 @@ void keyboard_init(void) {
|
||||||
#ifdef PS2_MOUSE_ENABLE
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
ps2_mouse_init();
|
ps2_mouse_init();
|
||||||
#endif
|
#endif
|
||||||
#ifdef BACKLIGHT_ENABLE
|
#ifndef MULTITHREADED_LIGHTING_ENABLE
|
||||||
|
# ifdef BACKLIGHT_ENABLE
|
||||||
backlight_init();
|
backlight_init();
|
||||||
#endif
|
# endif
|
||||||
#ifdef RGBLIGHT_ENABLE
|
# ifdef RGBLIGHT_ENABLE
|
||||||
rgblight_init();
|
rgblight_init();
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef STENO_ENABLE_ALL
|
#ifdef STENO_ENABLE_ALL
|
||||||
steno_init();
|
steno_init();
|
||||||
|
@ -682,21 +727,23 @@ void keyboard_task(void) {
|
||||||
split_watchdog_task();
|
split_watchdog_task();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(RGBLIGHT_ENABLE)
|
#ifndef MULTITHREADED_LIGHTING_ENABLE
|
||||||
|
# if defined(RGBLIGHT_ENABLE)
|
||||||
rgblight_task();
|
rgblight_task();
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#ifdef LED_MATRIX_ENABLE
|
# ifdef LED_MATRIX_ENABLE
|
||||||
led_matrix_task();
|
led_matrix_task();
|
||||||
#endif
|
# endif
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
# ifdef RGB_MATRIX_ENABLE
|
||||||
rgb_matrix_task();
|
rgb_matrix_task();
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#if defined(BACKLIGHT_ENABLE)
|
# if defined(BACKLIGHT_ENABLE)
|
||||||
# if defined(BACKLIGHT_PIN) || defined(BACKLIGHT_PINS)
|
# if defined(BACKLIGHT_PIN) || defined(BACKLIGHT_PINS)
|
||||||
backlight_task();
|
backlight_task();
|
||||||
# endif
|
# endif
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
|
|
Loading…
Add table
Reference in a new issue