From 103e1a0cd4775ade19a64173a318e1c2c1ee76ef Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Fri, 26 Feb 2021 13:13:14 +1100 Subject: [PATCH 1/3] Allow for disabling RGB_MATRIX on Massdrop boards. --- keyboards/massdrop/ctrl/config_led.c | 2 +- tmk_core/protocol/arm_atsam/md_rgb_matrix.c | 2 ++ tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/keyboards/massdrop/ctrl/config_led.c b/keyboards/massdrop/ctrl/config_led.c index f711c6a4fe27..27ddb5c388e7 100644 --- a/keyboards/massdrop/ctrl/config_led.c +++ b/keyboards/massdrop/ctrl/config_led.c @@ -79,4 +79,4 @@ void rgb_matrix_indicators_kb(void) } #endif // USB_LED_INDICATOR_ENABLE -#endif +#endif // RGB_MATRIX_ENABLE diff --git a/tmk_core/protocol/arm_atsam/md_rgb_matrix.c b/tmk_core/protocol/arm_atsam/md_rgb_matrix.c index 0ea7e3839557..e7c93cb9d97d 100644 --- a/tmk_core/protocol/arm_atsam/md_rgb_matrix.c +++ b/tmk_core/protocol/arm_atsam/md_rgb_matrix.c @@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifdef RGB_MATRIX_ENABLE #include "arm_atsam_protocol.h" #include "led.h" #include "rgb_matrix.h" @@ -470,3 +471,4 @@ static void md_rgb_matrix_config_override(int i) { } #endif // USE_MASSDROP_CONFIGURATOR +#endif // RGB_MATRIX_ENABLE \ No newline at end of file diff --git a/tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c b/tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c index b43008cc5b52..1149cea7a190 100644 --- a/tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c +++ b/tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c @@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#ifdef RGB_MATRIX_ENABLE #ifdef USE_MASSDROP_CONFIGURATOR # include "md_rgb_matrix.h" @@ -96,4 +97,5 @@ void *led_setups[] = {leds_rainbow_s, leds_rainbow_ns, leds_teal_salmon, leds_ye const uint8_t led_setups_count = sizeof(led_setups) / sizeof(led_setups[0]); -#endif +#endif // USE_MASSDROP_CONFIGURATOR +#endif // RGB_MATRIX_ENABLE \ No newline at end of file From 46db3807ebd14b0d987cbbc4a2fb5e4fe0c38e7f Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Fri, 26 Feb 2021 14:08:38 +1100 Subject: [PATCH 2/3] Fixup init sequence. --- quantum/quantum.c | 3 +++ tmk_core/common/keyboard.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/quantum/quantum.c b/quantum/quantum.c index 38234bb17b36..db99e80fa02d 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -621,6 +621,9 @@ void matrix_init_quantum() { #ifdef AUDIO_ENABLE audio_init(); #endif +#ifdef RGB_MATRIX_ENABLE + rgb_matrix_init(); +#endif #if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) unicode_input_mode_init(); #endif diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index 34fed0caba8c..ce3255c06965 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c @@ -307,9 +307,6 @@ void keyboard_init(void) { #ifdef RGBLIGHT_ENABLE rgblight_init(); #endif -#ifdef RGB_MATRIX_ENABLE - rgb_matrix_init(); -#endif #ifdef ENCODER_ENABLE encoder_init(); #endif From 97fbef1f008a9b04d4de9efa7cc85feae76cf42f Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Fri, 26 Feb 2021 14:22:56 +1100 Subject: [PATCH 3/3] Make some functions static as they've got very generic names. --- tmk_core/protocol/arm_atsam/md_rgb_matrix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tmk_core/protocol/arm_atsam/md_rgb_matrix.c b/tmk_core/protocol/arm_atsam/md_rgb_matrix.c index e7c93cb9d97d..eb71443b884a 100644 --- a/tmk_core/protocol/arm_atsam/md_rgb_matrix.c +++ b/tmk_core/protocol/arm_atsam/md_rgb_matrix.c @@ -197,7 +197,7 @@ void md_rgb_matrix_prepare(void) { } } -void led_set_one(int i, uint8_t r, uint8_t g, uint8_t b) { +static void led_set_one(int i, uint8_t r, uint8_t g, uint8_t b) { if (i < ISSI3733_LED_COUNT) { #ifdef USE_MASSDROP_CONFIGURATOR md_rgb_matrix_config_override(i); @@ -209,13 +209,13 @@ void led_set_one(int i, uint8_t r, uint8_t g, uint8_t b) { } } -void led_set_all(uint8_t r, uint8_t g, uint8_t b) { +static void led_set_all(uint8_t r, uint8_t g, uint8_t b) { for (uint8_t i = 0; i < ISSI3733_LED_COUNT; i++) { led_set_one(i, r, g, b); } } -void init(void) { +static void init(void) { DBGC(DC_LED_MATRIX_INIT_BEGIN); issi3733_prepare_arrays(); @@ -228,7 +228,7 @@ void init(void) { DBGC(DC_LED_MATRIX_INIT_COMPLETE); } -void flush(void) { +static void flush(void) { #ifdef USE_MASSDROP_CONFIGURATOR if (!led_enabled) { return;