aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2021-02-15 11:55:13 +1100
committerGitHub <noreply@github.com>2021-02-15 11:55:13 +1100
commit9ee12820197f38f6618b78f92481f3ffd2d8b7e5 (patch)
treed3a35c71242cbfff2868ce85d5348ccb8a68a489
parent6f44c2ec31a6aeacd9e90060a9670be03be372fe (diff)
downloadqmk_firmware-9ee12820197f38f6618b78f92481f3ffd2d8b7e5.tar.gz
qmk_firmware-9ee12820197f38f6618b78f92481f3ffd2d8b7e5.zip
LED Matrix: rename `LED_DRIVER_LED_COUNT` to `DRIVER_LED_TOTAL` (#11858)
-rw-r--r--common_features.mk1
-rw-r--r--docs/feature_led_matrix.md4
-rw-r--r--docs/ja/feature_led_matrix.md4
-rw-r--r--drivers/issi/is31fl3731-simple.c4
-rw-r--r--drivers/issi/is31fl3731-simple.h2
-rw-r--r--keyboards/clueboard/66_hotswap/gen1/config.h2
-rw-r--r--keyboards/clueboard/66_hotswap/gen1/gen1.c2
-rwxr-xr-xkeyboards/fallacy/config.h2
-rwxr-xr-xkeyboards/fallacy/indicators.c4
-rw-r--r--keyboards/terrazzo/config.h2
-rw-r--r--keyboards/terrazzo/terrazzo.c8
-rw-r--r--quantum/led_matrix.c8
-rw-r--r--quantum/led_matrix_drivers.c2
-rw-r--r--quantum/led_matrix_types.h4
14 files changed, 24 insertions, 25 deletions
diff --git a/common_features.mk b/common_features.mk
index f98a788ca..11065dfa9 100644
--- a/common_features.mk
+++ b/common_features.mk
@@ -176,7 +176,6 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
176 endif 176 endif
177endif 177endif
178 178
179
180LED_MATRIX_ENABLE ?= no 179LED_MATRIX_ENABLE ?= no
181VALID_LED_MATRIX_TYPES := IS31FL3731 custom 180VALID_LED_MATRIX_TYPES := IS31FL3731 custom
182# TODO: IS31FL3733 IS31FL3737 IS31FL3741 181# TODO: IS31FL3733 IS31FL3737 IS31FL3741
diff --git a/docs/feature_led_matrix.md b/docs/feature_led_matrix.md
index 6de01f31a..f4a661634 100644
--- a/docs/feature_led_matrix.md
+++ b/docs/feature_led_matrix.md
@@ -22,7 +22,7 @@ You can use between 1 and 4 IS31FL3731 IC's. Do not specify `LED_DRIVER_ADDR_<N>
22| `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages | 100 | 22| `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages | 100 |
23| `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | 23| `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 |
24| `LED_DRIVER_COUNT` | (Required) How many LED driver IC's are present | | 24| `LED_DRIVER_COUNT` | (Required) How many LED driver IC's are present | |
25| `LED_DRIVER_LED_COUNT` | (Required) How many LED lights are present across all drivers | | 25| `DRIVER_LED_TOTAL` | (Required) How many LED lights are present across all drivers | |
26| `LED_DRIVER_ADDR_1` | (Required) Address for the first LED driver | | 26| `LED_DRIVER_ADDR_1` | (Required) Address for the first LED driver | |
27| `LED_DRIVER_ADDR_2` | (Optional) Address for the second LED driver | | 27| `LED_DRIVER_ADDR_2` | (Optional) Address for the second LED driver | |
28| `LED_DRIVER_ADDR_3` | (Optional) Address for the third LED driver | | 28| `LED_DRIVER_ADDR_3` | (Optional) Address for the third LED driver | |
@@ -44,7 +44,7 @@ Here is an example using 2 drivers.
44#define LED_DRIVER_COUNT 2 44#define LED_DRIVER_COUNT 2
45#define LED_DRIVER_1_LED_COUNT 25 45#define LED_DRIVER_1_LED_COUNT 25
46#define LED_DRIVER_2_LED_COUNT 24 46#define LED_DRIVER_2_LED_COUNT 24
47#define LED_DRIVER_LED_COUNT LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL 47#define DRIVER_LED_TOTAL LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL
48``` 48```
49 49
50Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations. 50Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations.
diff --git a/docs/ja/feature_led_matrix.md b/docs/ja/feature_led_matrix.md
index 445aa73b7..b73487ca6 100644
--- a/docs/ja/feature_led_matrix.md
+++ b/docs/ja/feature_led_matrix.md
@@ -25,7 +25,7 @@ I2C IS31FL3731 RGB コントローラを使ったアドレス指定可能な LED
25| `ISSI_TIMEOUT` | (オプション) i2c メッセージを待つ時間 | 100 | 25| `ISSI_TIMEOUT` | (オプション) i2c メッセージを待つ時間 | 100 |
26| `ISSI_PERSISTENCE` | (オプション) 失敗したメッセージをこの回数再試行する | 0 | 26| `ISSI_PERSISTENCE` | (オプション) 失敗したメッセージをこの回数再試行する | 0 |
27| `LED_DRIVER_COUNT` | (必須) LED ドライバ IC の数 | | 27| `LED_DRIVER_COUNT` | (必須) LED ドライバ IC の数 | |
28| `LED_DRIVER_LED_COUNT` | (必須) 全てのドライバの LED ライトの数 | | 28| `DRIVER_LED_TOTAL` | (必須) 全てのドライバの LED ライトの数 | |
29| `LED_DRIVER_ADDR_1` | (必須) 最初の LED ドライバのアドレス | | 29| `LED_DRIVER_ADDR_1` | (必須) 最初の LED ドライバのアドレス | |
30| `LED_DRIVER_ADDR_2` | (オプション) 2番目の LED ドライバのアドレス | | 30| `LED_DRIVER_ADDR_2` | (オプション) 2番目の LED ドライバのアドレス | |
31| `LED_DRIVER_ADDR_3` | (オプション) 3番目の LED ドライバのアドレス | | 31| `LED_DRIVER_ADDR_3` | (オプション) 3番目の LED ドライバのアドレス | |
@@ -46,7 +46,7 @@ I2C IS31FL3731 RGB コントローラを使ったアドレス指定可能な LED
46 #define LED_DRIVER_COUNT 2 46 #define LED_DRIVER_COUNT 2
47 #define LED_DRIVER_1_LED_COUNT 25 47 #define LED_DRIVER_1_LED_COUNT 25
48 #define LED_DRIVER_2_LED_COUNT 24 48 #define LED_DRIVER_2_LED_COUNT 24
49 #define LED_DRIVER_LED_COUNT LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL 49 #define DRIVER_LED_TOTAL LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL
50 50
51現在、2つのドライバのみがサポートされますが、4つの組み合わせ全てをサポートすることは簡単です。 51現在、2つのドライバのみがサポートされますが、4つの組み合わせ全てをサポートすることは簡単です。
52 52
diff --git a/drivers/issi/is31fl3731-simple.c b/drivers/issi/is31fl3731-simple.c
index 7c86841f1..d295772f5 100644
--- a/drivers/issi/is31fl3731-simple.c
+++ b/drivers/issi/is31fl3731-simple.c
@@ -186,7 +186,7 @@ void IS31FL3731_init(uint8_t addr) {
186} 186}
187 187
188void IS31FL3731_set_value(int index, uint8_t value) { 188void IS31FL3731_set_value(int index, uint8_t value) {
189 if (index >= 0 && index < LED_DRIVER_LED_COUNT) { 189 if (index >= 0 && index < DRIVER_LED_TOTAL) {
190 is31_led led = g_is31_leds[index]; 190 is31_led led = g_is31_leds[index];
191 191
192 // Subtract 0x24 to get the second index of g_pwm_buffer 192 // Subtract 0x24 to get the second index of g_pwm_buffer
@@ -196,7 +196,7 @@ void IS31FL3731_set_value(int index, uint8_t value) {
196} 196}
197 197
198void IS31FL3731_set_value_all(uint8_t value) { 198void IS31FL3731_set_value_all(uint8_t value) {
199 for (int i = 0; i < LED_DRIVER_LED_COUNT; i++) { 199 for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
200 IS31FL3731_set_value(i, value); 200 IS31FL3731_set_value(i, value);
201 } 201 }
202} 202}
diff --git a/drivers/issi/is31fl3731-simple.h b/drivers/issi/is31fl3731-simple.h
index 85b458753..9665d6ed3 100644
--- a/drivers/issi/is31fl3731-simple.h
+++ b/drivers/issi/is31fl3731-simple.h
@@ -26,7 +26,7 @@ typedef struct is31_led {
26 uint8_t v; 26 uint8_t v;
27} __attribute__((packed)) is31_led; 27} __attribute__((packed)) is31_led;
28 28
29extern const is31_led g_is31_leds[LED_DRIVER_LED_COUNT]; 29extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
30 30
31void IS31FL3731_init(uint8_t addr); 31void IS31FL3731_init(uint8_t addr);
32void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data); 32void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data);
diff --git a/keyboards/clueboard/66_hotswap/gen1/config.h b/keyboards/clueboard/66_hotswap/gen1/config.h
index eb53dd255..c90689e56 100644
--- a/keyboards/clueboard/66_hotswap/gen1/config.h
+++ b/keyboards/clueboard/66_hotswap/gen1/config.h
@@ -132,4 +132,4 @@
132#define I2C1_SDA 9 132#define I2C1_SDA 9
133 133
134#define LED_DRIVER_COUNT 1 134#define LED_DRIVER_COUNT 1
135#define LED_DRIVER_LED_COUNT 71 135#define DRIVER_LED_TOTAL 71
diff --git a/keyboards/clueboard/66_hotswap/gen1/gen1.c b/keyboards/clueboard/66_hotswap/gen1/gen1.c
index 4bee38dc4..dd399317c 100644
--- a/keyboards/clueboard/66_hotswap/gen1/gen1.c
+++ b/keyboards/clueboard/66_hotswap/gen1/gen1.c
@@ -18,7 +18,7 @@
18#ifdef LED_MATRIX_ENABLE 18#ifdef LED_MATRIX_ENABLE
19 #include "is31fl3731-simple.h" 19 #include "is31fl3731-simple.h"
20 20
21const is31_led g_is31_leds[LED_DRIVER_LED_COUNT] = { 21const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
22/* Refer to IS31 manual for these locations 22/* Refer to IS31 manual for these locations
23 * driver 23 * driver
24 * | LED address 24 * | LED address
diff --git a/keyboards/fallacy/config.h b/keyboards/fallacy/config.h
index 559b6292b..379d25d9d 100755
--- a/keyboards/fallacy/config.h
+++ b/keyboards/fallacy/config.h
@@ -45,7 +45,7 @@
45 */ 45 */
46#define LED_DRIVER_ADDR_1 0b1110100 46#define LED_DRIVER_ADDR_1 0b1110100
47#define LED_DRIVER_COUNT 1 47#define LED_DRIVER_COUNT 1
48#define LED_DRIVER_LED_COUNT 3 48#define DRIVER_LED_TOTAL 3
49 49
50/* Set 0 if debouncing isn't needed 50/* Set 0 if debouncing isn't needed
51 */ 51 */
diff --git a/keyboards/fallacy/indicators.c b/keyboards/fallacy/indicators.c
index deda752fa..6c80f3167 100755
--- a/keyboards/fallacy/indicators.c
+++ b/keyboards/fallacy/indicators.c
@@ -25,7 +25,7 @@ void init_fallacy_leds(void) {
25 i2c_init(); 25 i2c_init();
26 IS31FL3731_init(LED_DRIVER_ADDR_1); 26 IS31FL3731_init(LED_DRIVER_ADDR_1);
27 27
28 for (int i = 0; i < LED_DRIVER_LED_COUNT; i++) { 28 for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
29 IS31FL3731_set_led_control_register(i, true); 29 IS31FL3731_set_led_control_register(i, true);
30 } 30 }
31 31
@@ -54,7 +54,7 @@ void set_fallacy_led(int index, bool state) {
54 54
55/* define LED matrix 55/* define LED matrix
56 */ 56 */
57const is31_led g_is31_leds[LED_DRIVER_LED_COUNT] = { 57const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
58 {0, C1_1}, 58 {0, C1_1},
59 {0, C2_1}, 59 {0, C2_1},
60 {0, C3_1}, 60 {0, C3_1},
diff --git a/keyboards/terrazzo/config.h b/keyboards/terrazzo/config.h
index 4b1dac706..e13a1e0db 100644
--- a/keyboards/terrazzo/config.h
+++ b/keyboards/terrazzo/config.h
@@ -85,7 +85,7 @@ so there is only one configuration. */
85 85
86#define LED_DRIVER_ADDR_1 0x74 86#define LED_DRIVER_ADDR_1 0x74
87#define LED_DRIVER_COUNT 1 87#define LED_DRIVER_COUNT 1
88#define LED_DRIVER_LED_COUNT 105 88#define DRIVER_LED_TOTAL 105
89#define LED_MATRIX_ROWS 15 89#define LED_MATRIX_ROWS 15
90#define LED_MATRIX_COLS 7 90#define LED_MATRIX_COLS 7
91#define LED_MATRIX_MAXIMUM_BRIGHTNESS 20 91#define LED_MATRIX_MAXIMUM_BRIGHTNESS 20
diff --git a/keyboards/terrazzo/terrazzo.c b/keyboards/terrazzo/terrazzo.c
index e8a4e03fc..f079ded4d 100644
--- a/keyboards/terrazzo/terrazzo.c
+++ b/keyboards/terrazzo/terrazzo.c
@@ -22,7 +22,7 @@
22 #include "print.h" 22 #include "print.h"
23 #include "quantum.h" 23 #include "quantum.h"
24 24
25const is31_led g_is31_leds[LED_DRIVER_LED_COUNT] = { 25const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
26/* Refer to IS31 manual for these locations 26/* Refer to IS31 manual for these locations
27 * https://cdn-learn.adafruit.com/downloads/pdf/adafruit-15x7-7x15-charlieplex-led-matrix-charliewing-featherwing.pdf 27 * https://cdn-learn.adafruit.com/downloads/pdf/adafruit-15x7-7x15-charlieplex-led-matrix-charliewing-featherwing.pdf
28 */ 28 */
@@ -58,7 +58,7 @@ uint8_t terrazzo_effect = 1;
58 58
59void terrazzo_set_pixel(uint8_t x, uint8_t y, uint8_t value) { 59void terrazzo_set_pixel(uint8_t x, uint8_t y, uint8_t value) {
60 uint8_t target = y * LED_MATRIX_COLS + x; 60 uint8_t target = y * LED_MATRIX_COLS + x;
61 if (target < LED_DRIVER_LED_COUNT && target >= 0) { 61 if (target < DRIVER_LED_TOTAL && target >= 0) {
62 led_matrix_set_index_value(y * LED_MATRIX_COLS + x, value); 62 led_matrix_set_index_value(y * LED_MATRIX_COLS + x, value);
63 } 63 }
64} 64}
@@ -85,10 +85,10 @@ void terrazzo_scroll_pixel(bool clockwise) {
85 terrazzo_led_index = terrazzo_led_index - 1; 85 terrazzo_led_index = terrazzo_led_index - 1;
86 } 86 }
87 87
88 if (terrazzo_led_index >= LED_DRIVER_LED_COUNT) { 88 if (terrazzo_led_index >= DRIVER_LED_TOTAL) {
89 terrazzo_led_index = 0; 89 terrazzo_led_index = 0;
90 } else if (terrazzo_led_index <= 0 ) { 90 } else if (terrazzo_led_index <= 0 ) {
91 terrazzo_led_index = LED_DRIVER_LED_COUNT - 1; 91 terrazzo_led_index = DRIVER_LED_TOTAL - 1;
92 } 92 }
93} 93}
94 94
diff --git a/quantum/led_matrix.c b/quantum/led_matrix.c
index c3538e94d..4f1f06c7a 100644
--- a/quantum/led_matrix.c
+++ b/quantum/led_matrix.c
@@ -59,7 +59,7 @@ bool g_suspend_state = false;
59uint32_t g_tick = 0; 59uint32_t g_tick = 0;
60 60
61// Ticks since this key was last hit. 61// Ticks since this key was last hit.
62uint8_t g_key_hit[LED_DRIVER_LED_COUNT]; 62uint8_t g_key_hit[DRIVER_LED_TOTAL];
63 63
64// Ticks since any key was last hit. 64// Ticks since any key was last hit.
65uint32_t g_any_key_hit = 0; 65uint32_t g_any_key_hit = 0;
@@ -152,7 +152,7 @@ void led_matrix_task(void) {
152 g_any_key_hit++; 152 g_any_key_hit++;
153 } 153 }
154 154
155 for (int led = 0; led < LED_DRIVER_LED_COUNT; led++) { 155 for (int led = 0; led < DRIVER_LED_TOTAL; led++) {
156 if (g_key_hit[led] < 255) { 156 if (g_key_hit[led] < 255) {
157 if (g_key_hit[led] == 254) g_last_led_count = MAX(g_last_led_count - 1, 0); 157 if (g_key_hit[led] == 254) g_last_led_count = MAX(g_last_led_count - 1, 0);
158 g_key_hit[led]++; 158 g_key_hit[led]++;
@@ -217,7 +217,7 @@ void led_matrix_init(void) {
217 wait_ms(500); 217 wait_ms(500);
218 218
219 // clear the key hits 219 // clear the key hits
220 for (int led = 0; led < LED_DRIVER_LED_COUNT; led++) { 220 for (int led = 0; led < DRIVER_LED_TOTAL; led++) {
221 g_key_hit[led] = 255; 221 g_key_hit[led] = 255;
222 } 222 }
223 223
@@ -265,7 +265,7 @@ static uint8_t decrement(uint8_t value, uint8_t step, uint8_t min, uint8_t max)
265// uint8_t led[8]; 265// uint8_t led[8];
266// uint8_t led_count = map_row_column_to_led(row, column, led); 266// uint8_t led_count = map_row_column_to_led(row, column, led);
267// for(uint8_t i = 0; i < led_count; i++) { 267// for(uint8_t i = 0; i < led_count; i++) {
268// if (led[i] < LED_DRIVER_LED_COUNT) { 268// if (led[i] < DRIVER_LED_TOTAL) {
269// void *address = backlight_get_custom_key_value_eeprom_address(led[i]); 269// void *address = backlight_get_custom_key_value_eeprom_address(led[i]);
270// eeprom_update_byte(address, value); 270// eeprom_update_byte(address, value);
271// } 271// }
diff --git a/quantum/led_matrix_drivers.c b/quantum/led_matrix_drivers.c
index 9decaa33c..eddf3f286 100644
--- a/quantum/led_matrix_drivers.c
+++ b/quantum/led_matrix_drivers.c
@@ -66,7 +66,7 @@ static void init(void) {
66# endif 66# endif
67# endif 67# endif
68 68
69 for (int index = 0; index < LED_DRIVER_LED_COUNT; index++) { 69 for (int index = 0; index < DRIVER_LED_TOTAL; index++) {
70# ifdef IS31FL3731 70# ifdef IS31FL3731
71 IS31FL3731_set_led_control_register(index, true); 71 IS31FL3731_set_led_control_register(index, true);
72# else 72# else
diff --git a/quantum/led_matrix_types.h b/quantum/led_matrix_types.h
index 2602bf2bf..669b67042 100644
--- a/quantum/led_matrix_types.h
+++ b/quantum/led_matrix_types.h
@@ -49,8 +49,8 @@ typedef struct PACKED {
49 49
50typedef struct PACKED { 50typedef struct PACKED {
51 uint8_t matrix_co[MATRIX_ROWS][MATRIX_COLS]; 51 uint8_t matrix_co[MATRIX_ROWS][MATRIX_COLS];
52 point_t point[LED_DRIVER_LED_COUNT]; 52 point_t point[DRIVER_LED_TOTAL];
53 uint8_t flags[LED_DRIVER_LED_COUNT]; 53 uint8_t flags[DRIVER_LED_TOTAL];
54} led_config_t; 54} led_config_t;
55 55
56typedef union { 56typedef union {