diff --git a/common_features.mk b/common_features.mk index 6463efb8ba..d238b28124 100644 --- a/common_features.mk +++ b/common_features.mk @@ -216,7 +216,6 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) endif endif - LED_MATRIX_ENABLE ?= no VALID_LED_MATRIX_TYPES := IS31FL3731 custom # TODO: IS31FL3733 IS31FL3737 IS31FL3741 diff --git a/docs/feature_led_matrix.md b/docs/feature_led_matrix.md index 6de01f31a1..f4a6616340 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_ | `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages | 100 | | `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 | | `LED_DRIVER_COUNT` | (Required) How many LED driver IC's are present | | -| `LED_DRIVER_LED_COUNT` | (Required) How many LED lights are present across all drivers | | +| `DRIVER_LED_TOTAL` | (Required) How many LED lights are present across all drivers | | | `LED_DRIVER_ADDR_1` | (Required) Address for the first LED driver | | | `LED_DRIVER_ADDR_2` | (Optional) Address for the second LED driver | | | `LED_DRIVER_ADDR_3` | (Optional) Address for the third LED driver | | @@ -44,7 +44,7 @@ Here is an example using 2 drivers. #define LED_DRIVER_COUNT 2 #define LED_DRIVER_1_LED_COUNT 25 #define LED_DRIVER_2_LED_COUNT 24 -#define LED_DRIVER_LED_COUNT LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL +#define DRIVER_LED_TOTAL LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL ``` Currently 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 445aa73b74..b73487ca63 100644 --- a/docs/ja/feature_led_matrix.md +++ b/docs/ja/feature_led_matrix.md @@ -25,7 +25,7 @@ I2C IS31FL3731 RGB コントローラを使ったアドレス指定可能な LED | `ISSI_TIMEOUT` | (オプション) i2c メッセージを待つ時間 | 100 | | `ISSI_PERSISTENCE` | (オプション) 失敗したメッセージをこの回数再試行する | 0 | | `LED_DRIVER_COUNT` | (必須) LED ドライバ IC の数 | | -| `LED_DRIVER_LED_COUNT` | (必須) 全てのドライバの LED ライトの数 | | +| `DRIVER_LED_TOTAL` | (必須) 全てのドライバの LED ライトの数 | | | `LED_DRIVER_ADDR_1` | (必須) 最初の LED ドライバのアドレス | | | `LED_DRIVER_ADDR_2` | (オプション) 2番目の LED ドライバのアドレス | | | `LED_DRIVER_ADDR_3` | (オプション) 3番目の LED ドライバのアドレス | | @@ -46,7 +46,7 @@ I2C IS31FL3731 RGB コントローラを使ったアドレス指定可能な LED #define LED_DRIVER_COUNT 2 #define LED_DRIVER_1_LED_COUNT 25 #define LED_DRIVER_2_LED_COUNT 24 - #define LED_DRIVER_LED_COUNT LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL + #define DRIVER_LED_TOTAL LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL 現在、2つのドライバのみがサポートされますが、4つの組み合わせ全てをサポートすることは簡単です。 diff --git a/drivers/issi/is31fl3731-simple.c b/drivers/issi/is31fl3731-simple.c index 7c86841f1e..d295772f5e 100644 --- a/drivers/issi/is31fl3731-simple.c +++ b/drivers/issi/is31fl3731-simple.c @@ -186,7 +186,7 @@ void IS31FL3731_init(uint8_t addr) { } void IS31FL3731_set_value(int index, uint8_t value) { - if (index >= 0 && index < LED_DRIVER_LED_COUNT) { + if (index >= 0 && index < DRIVER_LED_TOTAL) { is31_led led = g_is31_leds[index]; // Subtract 0x24 to get the second index of g_pwm_buffer @@ -196,7 +196,7 @@ void IS31FL3731_set_value(int index, uint8_t value) { } void IS31FL3731_set_value_all(uint8_t value) { - for (int i = 0; i < LED_DRIVER_LED_COUNT; i++) { + for (int i = 0; i < DRIVER_LED_TOTAL; i++) { IS31FL3731_set_value(i, value); } } diff --git a/drivers/issi/is31fl3731-simple.h b/drivers/issi/is31fl3731-simple.h index 85b458753c..9665d6ed35 100644 --- a/drivers/issi/is31fl3731-simple.h +++ b/drivers/issi/is31fl3731-simple.h @@ -26,7 +26,7 @@ typedef struct is31_led { uint8_t v; } __attribute__((packed)) is31_led; -extern const is31_led g_is31_leds[LED_DRIVER_LED_COUNT]; +extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; void IS31FL3731_init(uint8_t addr); void 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 1471af63dc..5ed3c5b272 100644 --- a/keyboards/clueboard/66_hotswap/gen1/config.h +++ b/keyboards/clueboard/66_hotswap/gen1/config.h @@ -107,7 +107,7 @@ #define I2C1_SDA 9 #define LED_DRIVER_COUNT 1 -#define LED_DRIVER_LED_COUNT 71 +#define DRIVER_LED_TOTAL 71 #define AUDIO_PIN A5 #define AUDIO_PIN_ALT A4 diff --git a/keyboards/clueboard/66_hotswap/gen1/gen1.c b/keyboards/clueboard/66_hotswap/gen1/gen1.c index 4bee38dc4e..dd399317c1 100644 --- a/keyboards/clueboard/66_hotswap/gen1/gen1.c +++ b/keyboards/clueboard/66_hotswap/gen1/gen1.c @@ -18,7 +18,7 @@ #ifdef LED_MATRIX_ENABLE #include "is31fl3731-simple.h" -const is31_led g_is31_leds[LED_DRIVER_LED_COUNT] = { +const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver * | LED address diff --git a/keyboards/fallacy/config.h b/keyboards/fallacy/config.h index 559b6292b4..379d25d9db 100755 --- a/keyboards/fallacy/config.h +++ b/keyboards/fallacy/config.h @@ -45,7 +45,7 @@ */ #define LED_DRIVER_ADDR_1 0b1110100 #define LED_DRIVER_COUNT 1 -#define LED_DRIVER_LED_COUNT 3 +#define DRIVER_LED_TOTAL 3 /* Set 0 if debouncing isn't needed */ diff --git a/keyboards/fallacy/indicators.c b/keyboards/fallacy/indicators.c index deda752faa..6c80f31678 100755 --- a/keyboards/fallacy/indicators.c +++ b/keyboards/fallacy/indicators.c @@ -25,7 +25,7 @@ void init_fallacy_leds(void) { i2c_init(); IS31FL3731_init(LED_DRIVER_ADDR_1); - for (int i = 0; i < LED_DRIVER_LED_COUNT; i++) { + for (int i = 0; i < DRIVER_LED_TOTAL; i++) { IS31FL3731_set_led_control_register(i, true); } @@ -54,7 +54,7 @@ void set_fallacy_led(int index, bool state) { /* define LED matrix */ -const is31_led g_is31_leds[LED_DRIVER_LED_COUNT] = { +const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, C1_1}, {0, C2_1}, {0, C3_1}, diff --git a/keyboards/terrazzo/config.h b/keyboards/terrazzo/config.h index 4b1dac7064..e13a1e0dba 100644 --- a/keyboards/terrazzo/config.h +++ b/keyboards/terrazzo/config.h @@ -85,7 +85,7 @@ so there is only one configuration. */ #define LED_DRIVER_ADDR_1 0x74 #define LED_DRIVER_COUNT 1 -#define LED_DRIVER_LED_COUNT 105 +#define DRIVER_LED_TOTAL 105 #define LED_MATRIX_ROWS 15 #define LED_MATRIX_COLS 7 #define LED_MATRIX_MAXIMUM_BRIGHTNESS 20 diff --git a/keyboards/terrazzo/terrazzo.c b/keyboards/terrazzo/terrazzo.c index e8a4e03fc6..f079ded4d7 100644 --- a/keyboards/terrazzo/terrazzo.c +++ b/keyboards/terrazzo/terrazzo.c @@ -22,7 +22,7 @@ #include "print.h" #include "quantum.h" -const is31_led g_is31_leds[LED_DRIVER_LED_COUNT] = { +const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * https://cdn-learn.adafruit.com/downloads/pdf/adafruit-15x7-7x15-charlieplex-led-matrix-charliewing-featherwing.pdf */ @@ -58,7 +58,7 @@ uint8_t terrazzo_effect = 1; void terrazzo_set_pixel(uint8_t x, uint8_t y, uint8_t value) { uint8_t target = y * LED_MATRIX_COLS + x; - if (target < LED_DRIVER_LED_COUNT && target >= 0) { + if (target < DRIVER_LED_TOTAL && target >= 0) { led_matrix_set_index_value(y * LED_MATRIX_COLS + x, value); } } @@ -85,10 +85,10 @@ void terrazzo_scroll_pixel(bool clockwise) { terrazzo_led_index = terrazzo_led_index - 1; } - if (terrazzo_led_index >= LED_DRIVER_LED_COUNT) { + if (terrazzo_led_index >= DRIVER_LED_TOTAL) { terrazzo_led_index = 0; } else if (terrazzo_led_index <= 0 ) { - terrazzo_led_index = LED_DRIVER_LED_COUNT - 1; + terrazzo_led_index = DRIVER_LED_TOTAL - 1; } } diff --git a/quantum/led_matrix.c b/quantum/led_matrix.c index c3538e94df..4f1f06c7ac 100644 --- a/quantum/led_matrix.c +++ b/quantum/led_matrix.c @@ -59,7 +59,7 @@ bool g_suspend_state = false; uint32_t g_tick = 0; // Ticks since this key was last hit. -uint8_t g_key_hit[LED_DRIVER_LED_COUNT]; +uint8_t g_key_hit[DRIVER_LED_TOTAL]; // Ticks since any key was last hit. uint32_t g_any_key_hit = 0; @@ -152,7 +152,7 @@ void led_matrix_task(void) { g_any_key_hit++; } - for (int led = 0; led < LED_DRIVER_LED_COUNT; led++) { + for (int led = 0; led < DRIVER_LED_TOTAL; led++) { if (g_key_hit[led] < 255) { if (g_key_hit[led] == 254) g_last_led_count = MAX(g_last_led_count - 1, 0); g_key_hit[led]++; @@ -217,7 +217,7 @@ void led_matrix_init(void) { wait_ms(500); // clear the key hits - for (int led = 0; led < LED_DRIVER_LED_COUNT; led++) { + for (int led = 0; led < DRIVER_LED_TOTAL; led++) { g_key_hit[led] = 255; } @@ -265,7 +265,7 @@ static uint8_t decrement(uint8_t value, uint8_t step, uint8_t min, uint8_t max) // uint8_t led[8]; // uint8_t led_count = map_row_column_to_led(row, column, led); // for(uint8_t i = 0; i < led_count; i++) { -// if (led[i] < LED_DRIVER_LED_COUNT) { +// if (led[i] < DRIVER_LED_TOTAL) { // void *address = backlight_get_custom_key_value_eeprom_address(led[i]); // eeprom_update_byte(address, value); // } diff --git a/quantum/led_matrix_drivers.c b/quantum/led_matrix_drivers.c index 9decaa33c2..eddf3f2863 100644 --- a/quantum/led_matrix_drivers.c +++ b/quantum/led_matrix_drivers.c @@ -66,7 +66,7 @@ static void init(void) { # endif # endif - for (int index = 0; index < LED_DRIVER_LED_COUNT; index++) { + for (int index = 0; index < DRIVER_LED_TOTAL; index++) { # ifdef IS31FL3731 IS31FL3731_set_led_control_register(index, true); # else diff --git a/quantum/led_matrix_types.h b/quantum/led_matrix_types.h index 2602bf2bf6..669b67042b 100644 --- a/quantum/led_matrix_types.h +++ b/quantum/led_matrix_types.h @@ -49,8 +49,8 @@ typedef struct PACKED { typedef struct PACKED { uint8_t matrix_co[MATRIX_ROWS][MATRIX_COLS]; - point_t point[LED_DRIVER_LED_COUNT]; - uint8_t flags[LED_DRIVER_LED_COUNT]; + point_t point[DRIVER_LED_TOTAL]; + uint8_t flags[DRIVER_LED_TOTAL]; } led_config_t; typedef union {