forked from forks/qmk_firmware
LED Matrix: rename LED_DRIVER_LED_COUNT
to DRIVER_LED_TOTAL
(#11858)
This commit is contained in:
parent
6f44c2ec31
commit
9ee1282019
|
@ -176,7 +176,6 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
|
|||
endif
|
||||
endif
|
||||
|
||||
|
||||
LED_MATRIX_ENABLE ?= no
|
||||
VALID_LED_MATRIX_TYPES := IS31FL3731 custom
|
||||
# TODO: IS31FL3733 IS31FL3737 IS31FL3741
|
||||
|
|
|
@ -22,7 +22,7 @@ You can use between 1 and 4 IS31FL3731 IC's. Do not specify `LED_DRIVER_ADDR_<N>
|
|||
| `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.
|
||||
|
|
|
@ -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つの組み合わせ全てをサポートすることは簡単です。
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -132,4 +132,4 @@
|
|||
#define I2C1_SDA 9
|
||||
|
||||
#define LED_DRIVER_COUNT 1
|
||||
#define LED_DRIVER_LED_COUNT 71
|
||||
#define DRIVER_LED_TOTAL 71
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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},
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
// }
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue