From d95f68f56f0aded0c0e5a38a33db0bf369dbd5b3 Mon Sep 17 00:00:00 2001 From: ccullin Date: Sun, 4 Jul 2021 16:05:32 +1000 Subject: [PATCH 1/6] initial commit --- drivers/issi/is31fl3737.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/issi/is31fl3737.c b/drivers/issi/is31fl3737.c index 8647c93cc114..48471e6fd1a0 100644 --- a/drivers/issi/is31fl3737.c +++ b/drivers/issi/is31fl3737.c @@ -153,7 +153,9 @@ void IS31FL3737_init(uint8_t addr) { void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { if (index >= 0 && index < DRIVER_LED_TOTAL) { - is31_led led = g_is31_leds[index]; + // set the led ptr to the led config in progmem + is31_led led; + memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); g_pwm_buffer[led.driver][led.r] = red; g_pwm_buffer[led.driver][led.g] = green; @@ -169,7 +171,9 @@ void IS31FL3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { } void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bool blue) { - is31_led led = g_is31_leds[index]; + // set the led ptr to the led config in progmem + is31_led led; + memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); uint8_t control_register_r = led.r / 8; uint8_t control_register_g = led.g / 8; From 89390663c6933df4c9ac7827f453b5bdd6a2a9e0 Mon Sep 17 00:00:00 2001 From: ccullin Date: Mon, 5 Jul 2021 21:07:57 +1000 Subject: [PATCH 2/6] updated comments --- drivers/issi/is31fl3737.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/issi/is31fl3737.c b/drivers/issi/is31fl3737.c index 48471e6fd1a0..324d5afdeb7d 100644 --- a/drivers/issi/is31fl3737.c +++ b/drivers/issi/is31fl3737.c @@ -153,7 +153,7 @@ void IS31FL3737_init(uint8_t addr) { void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { if (index >= 0 && index < DRIVER_LED_TOTAL) { - // set the led ptr to the led config in progmem + // copy the led config from progmem to SRAM is31_led led; memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); @@ -171,7 +171,7 @@ void IS31FL3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { } void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bool blue) { - // set the led ptr to the led config in progmem + // copy the led config from progmem to SRAM is31_led led; memcpy_P(&led, (&g_is31_leds[index]), sizeof(led)); From fb6f6e858ed6d79e2789c65a0ae3f9709eec1253 Mon Sep 17 00:00:00 2001 From: ccullin Date: Wed, 7 Jul 2021 17:06:21 +1000 Subject: [PATCH 3/6] added #include progmem.h --- drivers/issi/is31fl3737.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/issi/is31fl3737.c b/drivers/issi/is31fl3737.c index 324d5afdeb7d..e40bfa0d79b1 100644 --- a/drivers/issi/is31fl3737.c +++ b/drivers/issi/is31fl3737.c @@ -19,6 +19,7 @@ #include "is31fl3737.h" #include "i2c_master.h" #include "wait.h" +#include "progmem.h" // This is a 7-bit address, that gets left-shifted and bit 0 // set to 0 for write, 1 for read (as per I2C protocol) From 9d372f0d6a360dfe92019ecc2be77999e69b9f7d Mon Sep 17 00:00:00 2001 From: ccullin Date: Wed, 7 Jul 2021 17:12:11 +1000 Subject: [PATCH 4/6] updated documentation --- docs/feature_rgb_matrix.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index 675b7a1be004..be763ee02590 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md @@ -171,7 +171,7 @@ Currently only a single drivers is supported, but it would be trivial to support Define these arrays listing all the LEDs in your `.c`: ```c -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver * | R location From 284df1f8b0892cca1db57956b00eac6e68051ce1 Mon Sep 17 00:00:00 2001 From: ccullin Date: Sun, 11 Jul 2021 17:08:49 +1000 Subject: [PATCH 5/6] added string.h to progmem.h --- tmk_core/common/progmem.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tmk_core/common/progmem.h b/tmk_core/common/progmem.h index 4e4771e52383..3a7a169682ce 100644 --- a/tmk_core/common/progmem.h +++ b/tmk_core/common/progmem.h @@ -3,6 +3,7 @@ #if defined(__AVR__) # include #else +# include # define PROGMEM # define PSTR(x) x # define PGM_P const char* From af2aebb25fccecef8dd75630b44de7a45b3fe81b Mon Sep 17 00:00:00 2001 From: ccullin Date: Mon, 12 Jul 2021 19:22:45 +1000 Subject: [PATCH 6/6] update IS31FL3737 keyboards with PROGMEM --- keyboards/mt84/mt84.c | 40 ++++++++++++++++++++-------------------- keyboards/planck/ez/ez.c | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/keyboards/mt84/mt84.c b/keyboards/mt84/mt84.c index d9f509e14d91..e15a1ff95189 100644 --- a/keyboards/mt84/mt84.c +++ b/keyboards/mt84/mt84.c @@ -1,22 +1,22 @@ - /* Copyright 2020 MT<704340378@qq.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ + /* Copyright 2020 MT<704340378@qq.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "mt84.h" #ifdef RGB_MATRIX_ENABLE -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver * | R location @@ -40,7 +40,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {1, D_12, E_12, F_12}, {1, G_12, H_12, I_12}, {1, J_12, K_12, L_12}, - + {0, A_1, B_1, C_1}, {0, D_1, E_1, F_1}, {0, G_1, H_1, I_1}, @@ -72,7 +72,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {1, A_7, B_7, C_7}, {1, D_7, E_7, F_7}, {1, G_7, H_7, I_7}, - + {0, A_3, B_3, C_3}, {0, D_3, E_3, F_3}, {0, G_3, H_3, I_3}, @@ -87,7 +87,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {1, J_3, K_3, L_3}, {1, A_8, B_8, C_8}, {1, G_8, H_8, I_8}, - + {0, A_4, B_4, C_4}, {0, D_4, E_4, F_4}, {0, G_4, H_4, I_4}, @@ -130,7 +130,7 @@ led_config_t g_led_config = {{ { 9, 52 }, { 27, 52 }, { 43, 52 }, { 59, 52 }, { 75, 52 }, { 91, 52 }, { 107, 52 }, { 123, 52 }, { 139, 52 }, { 155, 52 }, { 171, 52 }, { 187, 52 }, { 212, 52 }, { 224, 52 }, { 2, 64 }, { 18, 64 }, { 33, 64 }, { 93, 64 }, { 150, 64 }, { 165, 64 }, { 180, 64 }, { 195, 64 }, { 210, 64 }, { 224, 64 } }, { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, diff --git a/keyboards/planck/ez/ez.c b/keyboards/planck/ez/ez.c index 8c498a552092..818dc6658754 100644 --- a/keyboards/planck/ez/ez.c +++ b/keyboards/planck/ez/ez.c @@ -19,7 +19,7 @@ keyboard_config_t keyboard_config; #ifdef RGB_MATRIX_ENABLE -const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver * | R location