From cde2859a6591b1274da20978bd158f20229faa88 Mon Sep 17 00:00:00 2001
From: XScorpion2
Date: Tue, 2 Mar 2021 14:32:15 -0600
Subject: Split RGB Matrix (#11055)
* Split RGB Matrix
* Suspend State sync for rgb matrix---
docs/feature_rgb_matrix.md | 2 ++
1 file changed, 2 insertions(+)
(limited to 'docs/feature_rgb_matrix.md')
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index fd866bd571..878acaf8b3 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -439,6 +439,8 @@ These are defined in [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blo
#define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set
#define RGB_MATRIX_STARTUP_SPD 127 // Sets the default animation speed, if none has been set
#define RGB_MATRIX_DISABLE_KEYCODES // disables control of rgb matrix by keycodes (must use code functions to control the feature)
+#define RGB_MATRIX_SPLIT { X, Y } // (Optional) For split keyboards, the number of LEDs connected on each half. X = left, Y = Right.
+ // If RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is enabled, you also will want to enable SPLIT_TRANSPORT_MIRROR
```
## EEPROM storage :id=eeprom-storage
--
cgit v1.2.3
From d8167779cdfb243cb140782210d2cc6a7cb9b123 Mon Sep 17 00:00:00 2001
From: Drashna Jaelre
Date: Wed, 28 Apr 2021 19:39:54 -0700
Subject: Change RGB/LED Matrix to use a simple define for USB suspend (#12697)
---
docs/feature_rgb_matrix.md | 2 +-
keyboards/mt64rgb/keymaps/default/keymap.c | 32 +++++++++++++++---------------
keyboards/mt84/keymaps/default/keymap.c | 30 +++++++++++++---------------
quantum/led_matrix.c | 18 ++++++++---------
quantum/led_matrix.h | 1 -
quantum/rgb_matrix.c | 18 ++++++++---------
quantum/rgb_matrix.h | 1 -
tmk_core/common/avr/suspend.c | 7 +++++++
tmk_core/common/chibios/suspend.c | 6 ++++++
9 files changed, 62 insertions(+), 53 deletions(-)
(limited to 'docs/feature_rgb_matrix.md')
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 046b1f17fa..63ff7d6ad6 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -437,7 +437,7 @@ These are defined in [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blo
#define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses)
#define RGB_DISABLE_TIMEOUT 0 // number of milliseconds to wait until rgb automatically turns off
#define RGB_DISABLE_AFTER_TIMEOUT 0 // OBSOLETE: number of ticks to wait until disabling effects
-#define RGB_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended
+#define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
#define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
#define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255
diff --git a/keyboards/mt64rgb/keymaps/default/keymap.c b/keyboards/mt64rgb/keymaps/default/keymap.c
index c7e027ba73..84f3b1d35e 100644
--- a/keyboards/mt64rgb/keymaps/default/keymap.c
+++ b/keyboards/mt64rgb/keymaps/default/keymap.c
@@ -1,18 +1,18 @@
-/* Copyright 2020 MT
- *
- * 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
+ *
+ * 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 QMK_KEYBOARD_H
@@ -37,7 +37,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
void rgb_matrix_indicators_user(void) {
- if (!g_suspend_state && layer_state_is(1)) {
+ if (layer_state_is(1)) {
rgb_matrix_set_color(77,0xFF, 0x80, 0x00);
}
if (host_keyboard_led_state().caps_lock) {
diff --git a/keyboards/mt84/keymaps/default/keymap.c b/keyboards/mt84/keymaps/default/keymap.c
index fc8481da9d..bb7d5b447f 100644
--- a/keyboards/mt84/keymaps/default/keymap.c
+++ b/keyboards/mt84/keymaps/default/keymap.c
@@ -1,18 +1,18 @@
/* 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 .
- */
+ *
+ * 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 QMK_KEYBOARD_H
@@ -44,12 +44,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
void rgb_matrix_indicators_user(void) {
led_t led_state = host_keyboard_led_state();
- if (!g_suspend_state) {
switch (get_highest_layer(layer_state)) {
case _FN:
rgb_matrix_set_color(77,0xFF, 0x80, 0x00);
break;
- }
}
if (led_state.caps_lock) {
rgb_matrix_set_color(46, 0xFF, 0xFF, 0xFF);
diff --git a/quantum/led_matrix.c b/quantum/led_matrix.c
index 72eb5190b3..5dd37dff14 100644
--- a/quantum/led_matrix.c
+++ b/quantum/led_matrix.c
@@ -35,8 +35,8 @@
# define LED_DISABLE_TIMEOUT 0
#endif
-#ifndef LED_DISABLE_WHEN_USB_SUSPENDED
-# define LED_DISABLE_WHEN_USB_SUSPENDED false
+#if LED_DISABLE_WHEN_USB_SUSPENDED == false
+# undef LED_DISABLE_WHEN_USB_SUSPENDED
#endif
#if !defined(LED_MATRIX_MAXIMUM_BRIGHTNESS) || LED_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX
@@ -65,7 +65,6 @@
#endif
// globals
-bool g_suspend_state = false;
led_eeconfig_t led_matrix_eeconfig; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr
uint32_t g_led_timer;
#ifdef LED_MATRIX_FRAMEBUFFER_EFFECTS
@@ -76,6 +75,7 @@ last_hit_t g_last_hit_tracker;
#endif // LED_MATRIX_KEYREACTIVE_ENABLED
// internals
+static bool suspend_state = false;
static uint8_t led_last_enable = UINT8_MAX;
static uint8_t led_last_effect = UINT8_MAX;
static effect_params_t led_effect_params = {0, LED_FLAG_ALL, false};
@@ -325,9 +325,7 @@ void led_matrix_task(void) {
// Ideally we would also stop sending zeros to the LED driver PWM buffers
// while suspended and just do a software shutdown. This is a cheap hack for now.
bool suspend_backlight =
-#if LED_DISABLE_WHEN_USB_SUSPENDED == true
- g_suspend_state ||
-#endif // LED_DISABLE_WHEN_USB_SUSPENDED == true
+ suspend_state ||
#if LED_DISABLE_TIMEOUT > 0
(led_anykey_timer > (uint32_t)LED_DISABLE_TIMEOUT) ||
#endif // LED_DISABLE_TIMEOUT > 0
@@ -416,13 +414,15 @@ void led_matrix_init(void) {
}
void led_matrix_set_suspend_state(bool state) {
- if (LED_DISABLE_WHEN_USB_SUSPENDED && state) {
+#ifdef LED_DISABLE_WHEN_USB_SUSPENDED
+ if (state) {
led_matrix_set_value_all(0); // turn off all LEDs when suspending
}
- g_suspend_state = state;
+ suspend_state = state;
+#endif
}
-bool led_matrix_get_suspend_state(void) { return g_suspend_state; }
+bool led_matrix_get_suspend_state(void) { return suspend_state; }
void led_matrix_toggle_eeprom_helper(bool write_to_eeprom) {
led_matrix_eeconfig.enable ^= 1;
diff --git a/quantum/led_matrix.h b/quantum/led_matrix.h
index f35bbe2096..a3fa552b0a 100644
--- a/quantum/led_matrix.h
+++ b/quantum/led_matrix.h
@@ -134,7 +134,6 @@ extern const led_matrix_driver_t led_matrix_driver;
extern led_eeconfig_t led_matrix_eeconfig;
-extern bool g_suspend_state;
extern uint32_t g_led_timer;
extern led_config_t g_led_config;
#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c
index 8aae486034..1f76049430 100644
--- a/quantum/rgb_matrix.c
+++ b/quantum/rgb_matrix.c
@@ -67,8 +67,8 @@ __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) { return hsv_to_rgb(hsv
# define RGB_DISABLE_TIMEOUT 0
#endif
-#ifndef RGB_DISABLE_WHEN_USB_SUSPENDED
-# define RGB_DISABLE_WHEN_USB_SUSPENDED false
+#if RGB_DISABLE_WHEN_USB_SUSPENDED == false
+# undef RGB_DISABLE_WHEN_USB_SUSPENDED
#endif
#if !defined(RGB_MATRIX_MAXIMUM_BRIGHTNESS) || RGB_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX
@@ -118,7 +118,6 @@ __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) { return hsv_to_rgb(hsv
#endif
// globals
-bool g_suspend_state = false;
rgb_config_t rgb_matrix_config; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr
uint32_t g_rgb_timer;
#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
@@ -129,6 +128,7 @@ last_hit_t g_last_hit_tracker;
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
// internals
+static bool suspend_state = false;
static uint8_t rgb_last_enable = UINT8_MAX;
static uint8_t rgb_last_effect = UINT8_MAX;
static effect_params_t rgb_effect_params = {0, LED_FLAG_ALL, false};
@@ -410,9 +410,7 @@ void rgb_matrix_task(void) {
// Ideally we would also stop sending zeros to the LED driver PWM buffers
// while suspended and just do a software shutdown. This is a cheap hack for now.
bool suspend_backlight =
-#if RGB_DISABLE_WHEN_USB_SUSPENDED == true
- g_suspend_state ||
-#endif // RGB_DISABLE_WHEN_USB_SUSPENDED == true
+ suspend_state ||
#if RGB_DISABLE_TIMEOUT > 0
(rgb_anykey_timer > (uint32_t)RGB_DISABLE_TIMEOUT) ||
#endif // RGB_DISABLE_TIMEOUT > 0
@@ -501,13 +499,15 @@ void rgb_matrix_init(void) {
}
void rgb_matrix_set_suspend_state(bool state) {
- if (RGB_DISABLE_WHEN_USB_SUSPENDED && state) {
+#ifdef RGB_DISABLE_WHEN_USB_SUSPENDED
+ if (state) {
rgb_matrix_set_color_all(0, 0, 0); // turn off all LEDs when suspending
}
- g_suspend_state = state;
+ suspend_state = state;
+#endif
}
-bool rgb_matrix_get_suspend_state(void) { return g_suspend_state; }
+bool rgb_matrix_get_suspend_state(void) { return suspend_state; }
void rgb_matrix_toggle_eeprom_helper(bool write_to_eeprom) {
rgb_matrix_config.enable ^= 1;
diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h
index bb8bcfab68..a615b8422c 100644
--- a/quantum/rgb_matrix.h
+++ b/quantum/rgb_matrix.h
@@ -216,7 +216,6 @@ extern const rgb_matrix_driver_t rgb_matrix_driver;
extern rgb_config_t rgb_matrix_config;
-extern bool g_suspend_state;
extern uint32_t g_rgb_timer;
extern led_config_t g_led_config;
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c
index 96b19a77fd..1c2bf9cb46 100644
--- a/tmk_core/common/avr/suspend.c
+++ b/tmk_core/common/avr/suspend.c
@@ -163,6 +163,10 @@ void suspend_power_down(void) {
rgblight_suspend();
# endif
+# if defined(RGB_MATRIX_ENABLE)
+ rgb_matrix_set_suspend_state(true);
+# endif
+
// Enter sleep state if possible (ie, the MCU has a watchdog timeout interrupt)
# if defined(WDT_vect)
power_down(WDTO_15MS);
@@ -214,6 +218,9 @@ void suspend_wakeup_init(void) {
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
rgblight_wakeup();
#endif
+# if defined(RGB_MATRIX_ENABLE)
+ rgb_matrix_set_suspend_state(false);
+# endif
suspend_wakeup_init_kb();
}
diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c
index b3949185e9..1f4f93c455 100644
--- a/tmk_core/common/chibios/suspend.c
+++ b/tmk_core/common/chibios/suspend.c
@@ -83,6 +83,9 @@ void suspend_power_down(void) {
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
rgblight_suspend();
#endif
+# if defined(RGB_MATRIX_ENABLE)
+ rgb_matrix_set_suspend_state(true);
+# endif
#ifdef AUDIO_ENABLE
stop_all_notes();
#endif /* AUDIO_ENABLE */
@@ -151,5 +154,8 @@ void suspend_wakeup_init(void) {
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
rgblight_wakeup();
#endif
+# if defined(RGB_MATRIX_ENABLE)
+ rgb_matrix_set_suspend_state(false);
+# endif
suspend_wakeup_init_kb();
}
--
cgit v1.2.3
From 7078d5a5bdf9a639003a124342de567c976182ff Mon Sep 17 00:00:00 2001
From: Ryan
Date: Thu, 13 May 2021 12:57:57 +1000
Subject: LED Matrix: Documentation (#12685)
---
docs/feature_led_matrix.md | 356 +++++++++++++++++++++++++++++++++++++++------
docs/feature_rgb_matrix.md | 4 +-
2 files changed, 313 insertions(+), 47 deletions(-)
(limited to 'docs/feature_rgb_matrix.md')
diff --git a/docs/feature_led_matrix.md b/docs/feature_led_matrix.md
index ac2be2e775..7834b940d5 100644
--- a/docs/feature_led_matrix.md
+++ b/docs/feature_led_matrix.md
@@ -1,34 +1,21 @@
-# LED Matrix Lighting
+# LED Matrix Lighting :id=led-matrix-lighting
This feature allows you to use LED matrices driven by external drivers. It hooks into the backlight system so you can use the same keycodes as backlighting to control it.
If you want to use RGB LED's you should use the [RGB Matrix Subsystem](feature_rgb_matrix.md) instead.
-## Driver configuration
+## Driver configuration :id=driver-configuration
+---
+### IS31FL3731 :id=is31fl3731
-### IS31FL3731
-
-There is basic support for addressable LED matrix lighting with the I2C IS31FL3731 RGB controller. To enable it, add this to your `rules.mk`:
+There is basic support for addressable LED matrix lighting with the I2C IS31FL3731 LED controller. To enable it, add this to your `rules.mk`:
```make
LED_MATRIX_ENABLE = yes
LED_MATRIX_DRIVER = IS31FL3731
```
-You can use between 1 and 4 IS31FL3731 IC's. Do not specify `LED_DRIVER_ADDR_` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`:
-
-| Variable | Description | Default |
-|----------|-------------|---------|
-| `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 | |
-| `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 | |
-| `LED_DRIVER_ADDR_4` | (Optional) Address for the fourth LED driver | |
-
-Here is an example using 2 drivers.
+Configure the hardware via your `config.h`:
```c
// This is a 7-bit address, that gets left-shifted and bit 0
@@ -38,63 +25,342 @@ Here is an example using 2 drivers.
// 0b1110111 AD <-> VCC
// 0b1110101 AD <-> SCL
// 0b1110110 AD <-> SDA
-#define LED_DRIVER_ADDR_1 0b1110100
-#define LED_DRIVER_ADDR_2 0b1110110
+#define DRIVER_ADDR_1 0b1110100
+#define DRIVER_ADDR_2 0b1110110
-#define LED_DRIVER_COUNT 2
-#define LED_DRIVER_1_LED_COUNT 25
-#define LED_DRIVER_2_LED_COUNT 24
-#define DRIVER_LED_TOTAL LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL
+#define DRIVER_COUNT 2
+#define DRIVER_1_LED_TOTAL 25
+#define DRIVER_2_LED_TOTAL 24
+#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
```
+!> Note the parentheses, this is so when `DRIVER_LED_TOTAL` is used in code and expanded, the values are added together before any additional math is applied to them. As an example, `rand() % (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)` will give very different results than `rand() % DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL`.
+
Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations.
Define these arrays listing all the LEDs in your `.c`:
```c
- const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
- /* Refer to IS31 manual for these locations
- * driver
- * | LED address
- * | | */
- { 0, C1_1 },
- { 0, C1_15 },
- // ...
- }
+const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+/* Refer to IS31 manual for these locations
+ * driver
+ * | LED address
+ * | | */
+ { 0, C1_1 },
+ { 0, C1_15 },
+ // ...
+}
```
Where `Cx_y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3731.pdf) and the header file `drivers/issi/is31fl3731-simple.h`. The `driver` is the index of the driver you defined in your `config.h` (`0`, `1`, `2`, or `3` ).
-## Keycodes
+---
+
+From this point forward the configuration is the same for all the drivers. The `led_config_t` struct provides a key electrical matrix to led index lookup table, what the physical position of each LED is on the board, and what type of key or usage the LED if the LED represents. Here is a brief example:
+
+```c
+led_config_t g_led_config = { {
+ // Key Matrix to LED Index
+ { 5, NO_LED, NO_LED, 0 },
+ { NO_LED, NO_LED, NO_LED, NO_LED },
+ { 4, NO_LED, NO_LED, 1 },
+ { 3, NO_LED, NO_LED, 2 }
+}, {
+ // LED Index to Physical Position
+ { 188, 16 }, { 187, 48 }, { 149, 64 }, { 112, 64 }, { 37, 48 }, { 38, 16 }
+}, {
+ // LED Index to Flag
+ 1, 4, 4, 4, 4, 1
+} };
+```
+
+The first part, `// Key Matrix to LED Index`, tells the system what key this LED represents by using the key's electrical matrix row & col. The second part, `// LED Index to Physical Position` represents the LED's physical `{ x, y }` position on the keyboard. The default expected range of values for `{ x, y }` is the inclusive range `{ 0..224, 0..64 }`. This default expected range is due to effects that calculate the center of the keyboard for their animations. The easiest way to calculate these positions is imagine your keyboard is a grid, and the top left of the keyboard represents `{ x, y }` coordinate `{ 0, 0 }` and the bottom right of your keyboard represents `{ 224, 64 }`. Using this as a basis, you can use the following formula to calculate the physical position:
+
+```c
+x = 224 / (NUMBER_OF_COLS - 1) * COL_POSITION
+y = 64 / (NUMBER_OF_ROWS - 1) * ROW_POSITION
+```
+
+Where NUMBER_OF_COLS, NUMBER_OF_ROWS, COL_POSITION, & ROW_POSITION are all based on the physical layout of your keyboard, not the electrical layout.
+
+As mentioned earlier, the center of the keyboard by default is expected to be `{ 112, 32 }`, but this can be changed if you want to more accurately calculate the LED's physical `{ x, y }` positions. Keyboard designers can implement `#define LED_MATRIX_CENTER { 112, 32 }` in their config.h file with the new center point of the keyboard, or where they want it to be allowing more possibilities for the `{ x, y }` values. Do note that the maximum value for x or y is 255, and the recommended maximum is 224 as this gives animations runoff room before they reset.
+
+`// LED Index to Flag` is a bitmask, whether or not a certain LEDs is of a certain type. It is recommended that LEDs are set to only 1 type.
+
+## Flags :id=flags
+
+|Define |Value |Description |
+|----------------------------|------|-------------------------------------------------|
+|`HAS_FLAGS(bits, flags)` |*n/a* |Evaluates to `true` if `bits` has all `flags` set|
+|`HAS_ANY_FLAGS(bits, flags)`|*n/a* |Evaluates to `true` if `bits` has any `flags` set|
+|`LED_FLAG_NONE` |`0x00`|If this LED has no flags |
+|`LED_FLAG_ALL` |`0xFF`|If this LED has all flags |
+|`LED_FLAG_MODIFIER` |`0x01`|If the LED is on a modifier key |
+|`LED_FLAG_KEYLIGHT` |`0x04`|If the LED is for key backlight |
+|`LED_FLAG_INDICATOR` |`0x08`|If the LED is for keyboard state indication |
+
+## Keycodes :id=keycodes
+
+All LED matrix keycodes are currently shared with the [Backlight feature](feature_backlight.md).
+
+|Key |Description |
+|---------|-----------------------------|
+|`BL_TOGG`|Toggle LED Matrix on or off |
+|`BL_STEP`|Cycle through modes |
+|`BL_ON` |Turn on LED Matrix |
+|`BL_OFF` |Turn off LED Matrix |
+|`BL_INC` |Increase the brightness level|
+|`BL_DEC` |Decrease the brightness level|
-All LED matrix keycodes are currently shared with the [backlight system](feature_backlight.md).
+## LED Matrix Effects :id=led-matrix-effects
-## LED Matrix Effects
+These are the effects that are currently available:
-Currently no LED matrix effects have been created.
+```c
+enum led_matrix_effects {
+ LED_MATRIX_NONE = 0,
+ LED_MATRIX_SOLID = 1, // Static single val, no speed support
+ LED_MATRIX_ALPHAS_MODS, // Static dual val, speed is val for LEDs marked as modifiers
+ LED_MATRIX_BREATHING, // Cycling brightness animation
+ LED_MATRIX_BAND, // Band fading brightness scrolling left to right
+ LED_MATRIX_BAND_PINWHEEL, // 3 blade spinning pinwheel fades brightness
+ LED_MATRIX_BAND_SPIRAL, // Spinning spiral fades brightness
+ LED_MATRIX_CYCLE_LEFT_RIGHT, // Full gradient scrolling left to right
+ LED_MATRIX_CYCLE_UP_DOWN, // Full gradient scrolling top to bottom
+ LED_MATRIX_CYCLE_OUT_IN, // Full gradient scrolling out to in
+ LED_MATRIX_DUAL_BEACON, // Full gradient spinning around center of keyboard
+#if defined(LED_MATRIX_KEYPRESSES) || defined(LED_MATRIX_KEYRELEASES)
+ LED_MATRIX_SOLID_REACTIVE_SIMPLE, // Pulses keys hit then fades out
+ LED_MATRIX_SOLID_REACTIVE_WIDE // Value pulses near a single key hit then fades out
+ LED_MATRIX_SOLID_REACTIVE_MULTIWIDE // Value pulses near multiple key hits then fades out
+ LED_MATRIX_SOLID_REACTIVE_CROSS // Value pulses the same column and row of a single key hit then fades out
+ LED_MATRIX_SOLID_REACTIVE_MULTICROSS // Value pulses the same column and row of multiple key hits then fades out
+ LED_MATRIX_SOLID_REACTIVE_NEXUS // Value pulses away on the same column and row of a single key hit then fades out
+ LED_MATRIX_SOLID_REACTIVE_MULTINEXUS // Value pulses away on the same column and row of multiple key hits then fades out
+ LED_MATRIX_SOLID_SPLASH, // Value pulses away from a single key hit then fades out
+ LED_MATRIX_SOLID_MULTISPLASH, // Value pulses away from multiple key hits then fades out
+#endif
+ LED_MATRIX_WAVE_LEFT_RIGHT // Sine wave scrolling from left to right
+ LED_MATRIX_WAVE_UP_DOWN // Sine wave scrolling from up to down
+ LED_MATRIX_EFFECT_MAX
+};
+```
+
+You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `config.h`:
+
+
+|Define |Description |
+|-------------------------------------------------------|-----------------------------------------------|
+|`#define DISABLE_LED_MATRIX_SOLID` |Disables `LED_MATRIX_SOLID` |
+|`#define DISABLE_LED_MATRIX_ALPHAS_MODS` |Disables `LED_MATRIX_ALPHAS_MODS` |
+|`#define DISABLE_LED_MATRIX_BREATHING` |Disables `LED_MATRIX_BREATHING` |
+|`#define DISABLE_LED_MATRIX_BAND` |Disables `LED_MATRIX_BAND` |
+|`#define DISABLE_LED_MATRIX_BAND_PINWHEEL` |Disables `LED_MATRIX_BAND_PINWHEEL` |
+|`#define DISABLE_LED_MATRIX_BAND_SPIRAL` |Disables `LED_MATRIX_BAND_SPIRAL` |
+|`#define DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT` |Disables `LED_MATRIX_CYCLE_LEFT_RIGHT` |
+|`#define DISABLE_LED_MATRIX_CYCLE_UP_DOWN` |Disables `LED_MATRIX_CYCLE_UP_DOWN` |
+|`#define DISABLE_LED_MATRIX_CYCLE_OUT_IN` |Disables `LED_MATRIX_CYCLE_OUT_IN` |
+|`#define DISABLE_LED_MATRIX_DUAL_BEACON` |Disables `LED_MATRIX_DUAL_BEACON` |
+|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE` |Disables `LED_MATRIX_SOLID_REACTIVE_SIMPLE` |
+|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE` |Disables `LED_MATRIX_SOLID_REACTIVE_WIDE` |
+|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE` |Disables `LED_MATRIX_SOLID_REACTIVE_MULTIWIDE` |
+|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS` |Disables `LED_MATRIX_SOLID_REACTIVE_CROSS` |
+|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS` |Disables `LED_MATRIX_SOLID_REACTIVE_MULTICROSS`|
+|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS` |Disables `LED_MATRIX_SOLID_REACTIVE_NEXUS` |
+|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS` |Disables `LED_MATRIX_SOLID_REACTIVE_MULTINEXUS`|
+|`#define DISABLE_LED_MATRIX_SOLID_SPLASH` |Disables `LED_MATRIX_SOLID_SPLASH` |
+|`#define DISABLE_LED_MATRIX_SOLID_MULTISPLASH` |Disables `LED_MATRIX_SOLID_MULTISPLASH` |
+|`#define DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT` |Disables `LED_MATRIX_WAVE_LEFT_RIGHT` |
+|`#define DISABLE_LED_MATRIX_WAVE_UP_DOWN` |Disables `LED_MATRIX_WAVE_UP_DOWN` |
+
+## Custom LED Matrix Effects :id=custom-led-matrix-effects
-## Custom Layer Effects
+By setting `LED_MATRIX_CUSTOM_USER` (and/or `LED_MATRIX_CUSTOM_KB`) in `rules.mk`, new effects can be defined directly from userspace, without having to edit any QMK core files.
-Custom layer effects can be done by defining this in your `.c`:
+To declare new effects, create a new `led_matrix_user/kb.inc` that looks something like this:
+
+`led_matrix_user.inc` should go in the root of the keymap directory.
+`led_matrix_kb.inc` should go in the root of the keyboard directory.
+
+To use custom effects in your code, simply prepend `LED_MATRIX_CUSTOM_` to the effect name specified in `LED_MATRIX_EFFECT()`. For example, an effect declared as `LED_MATRIX_EFFECT(my_cool_effect)` would be referenced with:
+
+```c
+led_matrix_mode(led_MATRIX_CUSTOM_my_cool_effect);
+```
+```c
+// !!! DO NOT ADD #pragma once !!! //
+
+// Step 1.
+// Declare custom effects using the LED_MATRIX_EFFECT macro
+// (note the lack of semicolon after the macro!)
+LED_MATRIX_EFFECT(my_cool_effect)
+LED_MATRIX_EFFECT(my_cool_effect2)
+
+// Step 2.
+// Define effects inside the `LED_MATRIX_CUSTOM_EFFECT_IMPLS` ifdef block
+#ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
+
+// e.g: A simple effect, self-contained within a single method
+static bool my_cool_effect(effect_params_t* params) {
+ LED_MATRIX_USE_LIMITS(led_min, led_max);
+ for (uint8_t i = led_min; i < led_max; i++) {
+ led_matrix_set_value(i, 0xFF);
+ }
+ return led_max < DRIVER_LED_TOTAL;
+}
+
+// e.g: A more complex effect, relying on external methods and state, with
+// dedicated init and run methods
+static uint8_t some_global_state;
+static void my_cool_effect2_complex_init(effect_params_t* params) {
+ some_global_state = 1;
+}
+static bool my_cool_effect2_complex_run(effect_params_t* params) {
+ LED_MATRIX_USE_LIMITS(led_min, led_max);
+ for (uint8_t i = led_min; i < led_max; i++) {
+ led_matrix_set_value(i, some_global_state++);
+ }
+
+ return led_max < DRIVER_LED_TOTAL;
+}
+static bool my_cool_effect2(effect_params_t* params) {
+ if (params->init) my_cool_effect2_complex_init(params);
+ return my_cool_effect2_complex_run(params);
+}
+
+#endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
+```
+
+For inspiration and examples, check out the built-in effects under `quantum/led_matrix_animations/`
+
+
+
+
+
+
+
+
+
+## Additional `config.h` Options :id=additional-configh-options
+
+```c
+#define LED_MATRIX_KEYPRESSES // reacts to keypresses
+#define LED_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses)
+#define LED_DISABLE_TIMEOUT 0 // number of milliseconds to wait until led automatically turns off
+#define LED_DISABLE_AFTER_TIMEOUT 0 // OBSOLETE: number of ticks to wait until disabling effects
+#define LED_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended
+#define LED_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
+#define LED_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
+#define LED_MATRIX_MAXIMUM_BRIGHTNESS 255 // limits maximum brightness of LEDs
+#define LED_MATRIX_STARTUP_MODE LED_MATRIX_SOLID // Sets the default mode, if none has been set
+#define LED_MATRIX_STARTUP_VAL LED_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set
+#define LED_MATRIX_STARTUP_SPD 127 // Sets the default animation speed, if none has been set
+#define LED_MATRIX_SPLIT { X, Y } // (Optional) For split keyboards, the number of LEDs connected on each half. X = left, Y = Right.
+ // If LED_MATRIX_KEYPRESSES or LED_MATRIX_KEYRELEASES is enabled, you also will want to enable SPLIT_TRANSPORT_MIRROR
+```
+
+## EEPROM storage :id=eeprom-storage
+
+The EEPROM for it is currently shared with the RGB Matrix system (it's generally assumed only one feature would be used at a time), but could be configured to use its own 32bit address with:
+
+```c
+#define EECONFIG_LED_MATRIX (uint32_t *)28
+```
+
+Where `28` is an unused index from `eeconfig.h`.
+
+### Direct Operation :id=direct-operation
+|Function |Description |
+|--------------------------------------------|-------------|
+|`led_matrix_set_value_all(v)` |Set all of the LEDs to the given value, where `v` is between 0 and 255 (not written to EEPROM) |
+|`led_matrix_set_value(index, v)` |Set a single LED to the given value, where `v` is between 0 and 255, and `index` is between 0 and `DRIVER_LED_TOTAL` (not written to EEPROM) |
+
+### Disable/Enable Effects :id=disable-enable-effects
+|Function |Description |
+|--------------------------------------------|-------------|
+|`led_matrix_toggle()` |Toggle effect range LEDs between on and off |
+|`led_matrix_toggle_noeeprom()` |Toggle effect range LEDs between on and off (not written to EEPROM) |
+|`led_matrix_enable()` |Turn effect range LEDs on, based on their previous state |
+|`led_matrix_enable_noeeprom()` |Turn effect range LEDs on, based on their previous state (not written to EEPROM) |
+|`led_matrix_disable()` |Turn effect range LEDs off, based on their previous state |
+|`led_matrix_disable_noeeprom()` |Turn effect range LEDs off, based on their previous state (not written to EEPROM) |
+
+### Change Effect Mode :id=change-effect-mode
+|Function |Description |
+|--------------------------------------------|-------------|
+|`led_matrix_mode(mode)` |Set the mode, if LED animations are enabled |
+|`led_matrix_mode_noeeprom(mode)` |Set the mode, if LED animations are enabled (not written to EEPROM) |
+|`led_matrix_step()` |Change the mode to the next LED animation in the list of enabled LED animations |
+|`led_matrix_step_noeeprom()` |Change the mode to the next LED animation in the list of enabled LED animations (not written to EEPROM) |
+|`led_matrix_step_reverse()` |Change the mode to the previous LED animation in the list of enabled LED animations |
+|`led_matrix_step_reverse_noeeprom()` |Change the mode to the previous LED animation in the list of enabled LED animations (not written to EEPROM) |
+|`led_matrix_increase_speed()` |Increase the speed of the animations |
+|`led_matrix_increase_speed_noeeprom()` |Increase the speed of the animations (not written to EEPROM) |
+|`led_matrix_decrease_speed()` |Decrease the speed of the animations |
+|`led_matrix_decrease_speed_noeeprom()` |Decrease the speed of the animations (not written to EEPROM) |
+|`led_matrix_set_speed(speed)` |Set the speed of the animations to the given value where `speed` is between 0 and 255 |
+|`led_matrix_set_speed_noeeprom(speed)` |Set the speed of the animations to the given value where `speed` is between 0 and 255 (not written to EEPROM) |
+
+### Change Value :id=change-value
+|Function |Description |
+|--------------------------------------------|-------------|
+|`led_matrix_increase_val()` |Increase the value for effect range LEDs. This wraps around at maximum value |
+|`led_matrix_increase_val_noeeprom()` |Increase the value for effect range LEDs. This wraps around at maximum value (not written to EEPROM) |
+|`led_matrix_decrease_val()` |Decrease the value for effect range LEDs. This wraps around at minimum value |
+|`led_matrix_decrease_val_noeeprom()` |Decrease the value for effect range LEDs. This wraps around at minimum value (not written to EEPROM) |
+
+### Query Current Status :id=query-current-status
+|Function |Description |
+|---------------------------------|---------------------------|
+|`led_matrix_is_enabled()` |Gets current on/off status |
+|`led_matrix_get_mode()` |Gets current mode |
+|`led_matrix_get_val()` |Gets current val |
+|`led_matrix_get_speed()` |Gets current speed |
+|`led_matrix_get_suspend_state()` |Gets current suspend state |
+
+## Callbacks :id=callbacks
+
+### Indicators :id=indicators
+
+If you want to set custom indicators, such as an LED for Caps Lock, or layer indication, you can use the `led_matrix_indicators_kb` or `led_matrix_indicators_user` function for that:
```c
void led_matrix_indicators_kb(void) {
- led_matrix_set_value(index, value);
+ led_matrix_set_color(index, value);
}
```
-A similar function works in the keymap as `led_matrix_indicators_user`.
+In addition, there are the advanced indicator functions. These are aimed at those with heavily customized displays, where rendering every LED per cycle is expensive. This includes a special macro to help make this easier to use: `LED_MATRIX_INDICATOR_SET_VALUE(i, v)`.
+
+```c
+void led_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
+ LED_MATRIX_INDICATOR_SET_VALUE(index, value);
+}
+```
-## Suspended State
+## Suspended State :id=suspended-state
+To use the suspend feature, make sure that `#define LED_DISABLE_WHEN_USB_SUSPENDED true` is added to the `config.h` file.
-To use the suspend feature, add this to your `.c`:
+Additionally add this to your `.c`:
```c
void suspend_power_down_kb(void) {
led_matrix_set_suspend_state(true);
+ suspend_power_down_user();
}
void suspend_wakeup_init_kb(void) {
led_matrix_set_suspend_state(false);
+ suspend_wakeup_init_user();
+}
+```
+or add this to your `keymap.c`:
+```c
+void suspend_power_down_user(void) {
+ led_matrix_set_suspend_state(true);
+}
+
+void suspend_wakeup_init_user(void) {
+ led_matrix_set_suspend_state(false);
}
-```
\ No newline at end of file
+```
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 63ff7d6ad6..ffbb8c0b60 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -399,7 +399,7 @@ static bool my_cool_effect2(effect_params_t* params) {
#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS
```
-For inspiration and examples, check out the built-in effects under `quantum/rgb_matrix_animation/`
+For inspiration and examples, check out the built-in effects under `quantum/rgb_matrix_animations/`
## Colors :id=colors
@@ -453,7 +453,7 @@ These are defined in [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blo
## EEPROM storage :id=eeprom-storage
-The EEPROM for it is currently shared with the RGBLIGHT system (it's generally assumed only one RGB would be used at a time), but could be configured to use its own 32bit address with:
+The EEPROM for it is currently shared with the LED Matrix system (it's generally assumed only one feature would be used at a time), but could be configured to use its own 32bit address with:
```c
#define EECONFIG_RGB_MATRIX (uint32_t *)28
--
cgit v1.2.3
From 8e96c5a060896c4aa5ed181d9c86c4e66bb78cfc Mon Sep 17 00:00:00 2001
From: Donald Kjer
Date: Fri, 21 May 2021 21:42:39 -0700
Subject: Add support for up to 4 IS31FL3733 drivers (#12342)
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>---
docs/feature_led_matrix.md | 31 +++++++++-----
docs/feature_rgb_matrix.md | 96 +++++++++++++++++++++++++++++++++++++++-----
drivers/issi/is31fl3733.c | 2 +-
quantum/led_matrix_drivers.c | 22 +++++++---
quantum/rgb_matrix_drivers.c | 45 +++++++++++++++++++--
5 files changed, 167 insertions(+), 29 deletions(-)
(limited to 'docs/feature_rgb_matrix.md')
diff --git a/docs/feature_led_matrix.md b/docs/feature_led_matrix.md
index 7834b940d5..e56caabfe7 100644
--- a/docs/feature_led_matrix.md
+++ b/docs/feature_led_matrix.md
@@ -15,7 +15,20 @@ LED_MATRIX_ENABLE = yes
LED_MATRIX_DRIVER = IS31FL3731
```
-Configure the hardware via your `config.h`:
+You can use between 1 and 4 IS31FL3731 IC's. Do not specify `LED_DRIVER_ADDR_` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`:
+
+| Variable | Description | Default |
+|----------|-------------|---------|
+| `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 |
+| `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 |
+| `LED_DRIVER_COUNT` | (Required) How many LED driver IC's are present | |
+| `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 | |
+| `LED_DRIVER_ADDR_4` | (Optional) Address for the fourth LED driver | |
+
+Here is an example using 2 drivers.
```c
// This is a 7-bit address, that gets left-shifted and bit 0
@@ -25,18 +38,16 @@ Configure the hardware via your `config.h`:
// 0b1110111 AD <-> VCC
// 0b1110101 AD <-> SCL
// 0b1110110 AD <-> SDA
-#define DRIVER_ADDR_1 0b1110100
-#define DRIVER_ADDR_2 0b1110110
+#define LED_DRIVER_ADDR_1 0b1110100
+#define LED_DRIVER_ADDR_2 0b1110110
-#define DRIVER_COUNT 2
-#define DRIVER_1_LED_TOTAL 25
-#define DRIVER_2_LED_TOTAL 24
-#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
+#define LED_DRIVER_COUNT 2
+#define LED_DRIVER_1_LED_TOTAL 25
+#define LED_DRIVER_2_LED_TOTAL 24
+#define DRIVER_LED_TOTAL (LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL)
```
-!> Note the parentheses, this is so when `DRIVER_LED_TOTAL` is used in code and expanded, the values are added together before any additional math is applied to them. As an example, `rand() % (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)` will give very different results than `rand() % DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL`.
-
-Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations.
+!> Note the parentheses, this is so when `LED_DRIVER_LED_TOTAL` is used in code and expanded, the values are added together before any additional math is applied to them. As an example, `rand() % (LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL)` will give very different results than `rand() % LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL`.
Define these arrays listing all the LEDs in your `.c`:
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index ffbb8c0b60..a29d5c624b 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -15,7 +15,20 @@ RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = IS31FL3731
```
-Configure the hardware via your `config.h`:
+You can use between 1 and 4 IS31FL3731 IC's. Do not specify `DRIVER_ADDR_` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`:
+
+| Variable | Description | Default |
+|----------|-------------|---------|
+| `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 |
+| `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 |
+| `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | |
+| `DRIVER_LED_TOTAL` | (Required) How many RGB lights are present across all drivers | |
+| `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | |
+| `DRIVER_ADDR_2` | (Optional) Address for the second RGB driver | |
+| `DRIVER_ADDR_3` | (Optional) Address for the third RGB driver | |
+| `DRIVER_ADDR_4` | (Optional) Address for the fourth RGB driver | |
+
+Here is an example using 2 drivers.
```c
// This is a 7-bit address, that gets left-shifted and bit 0
@@ -36,8 +49,6 @@ Configure the hardware via your `config.h`:
!> Note the parentheses, this is so when `DRIVER_LED_TOTAL` is used in code and expanded, the values are added together before any additional math is applied to them. As an example, `rand() % (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)` will give very different results than `rand() % DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL`.
-Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations.
-
Define these arrays listing all the LEDs in your `.c`:
```c
@@ -53,12 +64,10 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
}
```
-Where `Cx_y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3731.pdf) and the header file `drivers/issi/is31fl3731.h`. The `driver` is the index of the driver you defined in your `config.h` (`0` or `1` right now).
+Where `Cx_y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3731.pdf) and the header file `drivers/issi/is31fl3731.h`. The `driver` is the index of the driver you defined in your `config.h` (`0`, `1`, `2`, or `3`).
---
-### IS31FL3733/IS31FL3737 :id=is31fl3733is31fl3737
-
-!> For the IS31FL3737, replace all instances of `IS31FL3733` below with `IS31FL3737`.
+### IS31FL3733 :id=is31fl3733
There is basic support for addressable RGB matrix lighting with the I2C IS31FL3733 RGB controller. To enable it, add this to your `rules.mk`:
@@ -67,7 +76,24 @@ RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = IS31FL3733
```
-Configure the hardware via your `config.h`:
+You can use between 1 and 4 IS31FL3733 IC's. Do not specify `DRIVER_ADDR_` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`:
+
+| Variable | Description | Default |
+|----------|-------------|---------|
+| `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 |
+| `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 |
+| `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | |
+| `DRIVER_LED_TOTAL` | (Required) How many RGB lights are present across all drivers | |
+| `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | |
+| `DRIVER_ADDR_2` | (Optional) Address for the second RGB driver | |
+| `DRIVER_ADDR_3` | (Optional) Address for the third RGB driver | |
+| `DRIVER_ADDR_4` | (Optional) Address for the fourth RGB driver | |
+| `DRIVER_SYNC_1` | (Optional) Sync configuration for the first RGB driver | 0 |
+| `DRIVER_SYNC_2` | (Optional) Sync configuration for the second RGB driver | 0 |
+| `DRIVER_SYNC_3` | (Optional) Sync configuration for the third RGB driver | 0 |
+| `DRIVER_SYNC_4` | (Optional) Sync configuration for the fourth RGB driver | 0 |
+
+Here is an example using 2 drivers.
```c
// This is a 7-bit address, that gets left-shifted and bit 0
@@ -81,6 +107,58 @@ Configure the hardware via your `config.h`:
// ADDR2 represents A3:A2 of the 7-bit address.
// The result is: 0b101(ADDR2)(ADDR1)
#define DRIVER_ADDR_1 0b1010000
+#define DRIVER_ADDR_2 0b1010011
+
+#define DRIVER_COUNT 2
+#define DRIVER_1_LED_TOTAL 58
+#define DRIVER_2_LED_TOTAL 10
+#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
+```
+
+!> Note the parentheses, this is so when `DRIVER_LED_TOTAL` is used in code and expanded, the values are added together before any additional math is applied to them. As an example, `rand() % (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)` will give very different results than `rand() % DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL`.
+
+Currently only 4 drivers are supported, but it would be trivial to support all 8 combinations.
+
+Define these arrays listing all the LEDs in your `.c`:
+
+```c
+const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+/* Refer to IS31 manual for these locations
+ * driver
+ * | R location
+ * | | G location
+ * | | | B location
+ * | | | | */
+ {0, B_1, A_1, C_1},
+ ....
+}
+```
+
+Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3733.pdf) and the header file `drivers/issi/is31fl3733.h`. The `driver` is the index of the driver you defined in your `config.h` (`0`, `1`, `2`, or `3` for now).
+
+---
+### IS31FL3737 :id=is31fl3737
+
+There is basic support for addressable RGB matrix lighting with the I2C IS31FL3737 RGB controller. To enable it, add this to your `rules.mk`:
+
+```makefile
+RGB_MATRIX_ENABLE = yes
+RGB_MATRIX_DRIVER = IS31FL3737
+```
+
+Configure the hardware via your `config.h`:
+
+```c
+// 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)
+// The address will vary depending on your wiring:
+// 0000 <-> GND
+// 0101 <-> SCL
+// 1010 <-> SDA
+// 1111 <-> VCC
+// ADDR represents A3:A0 of the 7-bit address.
+// The result is: 0b101(ADDR)
+#define DRIVER_ADDR_1 0b1010000
#define DRIVER_ADDR_2 0b1010000 // this is here for compliancy reasons.
#define DRIVER_COUNT 2
@@ -105,7 +183,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
}
```
-Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3733.pdf) and the header file `drivers/issi/is31fl3733.h`. The `driver` is the index of the driver you defined in your `config.h` (Only `0` right now).
+Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3737.pdf) and the header file `drivers/issi/is31fl3737.h`. The `driver` is the index of the driver you defined in your `config.h` (Only `0` right now).
---
diff --git a/drivers/issi/is31fl3733.c b/drivers/issi/is31fl3733.c
index dddf0cb734..d99e5339c9 100644
--- a/drivers/issi/is31fl3733.c
+++ b/drivers/issi/is31fl3733.c
@@ -68,7 +68,7 @@ uint8_t g_twi_transfer_buffer[20];
uint8_t g_pwm_buffer[DRIVER_COUNT][192];
bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
-uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}, {0}};
+uint8_t g_led_control_registers[DRIVER_COUNT][24] = {0};
bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
diff --git a/quantum/led_matrix_drivers.c b/quantum/led_matrix_drivers.c
index 370c5e6853..f3d4bc896e 100644
--- a/quantum/led_matrix_drivers.c
+++ b/quantum/led_matrix_drivers.c
@@ -46,16 +46,28 @@ static void init(void) {
# endif
# else
# ifdef LED_DRIVER_ADDR_1
- IS31FL3733_init(LED_DRIVER_ADDR_1, 0);
+# ifndef LED_DRIVER_SYNC_1
+# define LED_DRIVER_SYNC_1 0
+# endif
+ IS31FL3733_init(LED_DRIVER_ADDR_1, LED_DRIVER_SYNC_1);
# endif
# ifdef LED_DRIVER_ADDR_2
- IS31FL3733_init(LED_DRIVER_ADDR_2, 0);
+# ifndef LED_DRIVER_SYNC_2
+# define LED_DRIVER_SYNC_2 0
+# endif
+ IS31FL3733_init(LED_DRIVER_ADDR_2, LED_DRIVER_SYNC_2);
# endif
# ifdef LED_DRIVER_ADDR_3
- IS31FL3733_init(LED_DRIVER_ADDR_3, 0);
+# ifndef LED_DRIVER_SYNC_3
+# define LED_DRIVER_SYNC_3 0
+# endif
+ IS31FL3733_init(LED_DRIVER_ADDR_3, LED_DRIVER_SYNC_3);
# endif
# ifdef LED_DRIVER_ADDR_4
- IS31FL3733_init(LED_DRIVER_ADDR_4, 0);
+# ifndef LED_DRIVER_SYNC_4
+# define LED_DRIVER_SYNC_4 0
+# endif
+ IS31FL3733_init(LED_DRIVER_ADDR_4, LED_DRIVER_SYNC_4);
# endif
# endif
@@ -133,7 +145,7 @@ const led_matrix_driver_t led_matrix_driver = {
.set_value = IS31FL3731_set_value,
.set_value_all = IS31FL3731_set_value_all,
# else
- .set_value = IS31FL3733_set_value,
+ .set_value = IS31FL3733_set_value,
.set_value_all = IS31FL3733_set_value_all,
# endif
};
diff --git a/quantum/rgb_matrix_drivers.c b/quantum/rgb_matrix_drivers.c
index 2978e7bed9..a4db86d196 100644
--- a/quantum/rgb_matrix_drivers.c
+++ b/quantum/rgb_matrix_drivers.c
@@ -41,7 +41,28 @@ static void init(void) {
IS31FL3731_init(DRIVER_ADDR_4);
# endif
# elif defined(IS31FL3733)
- IS31FL3733_init(DRIVER_ADDR_1, 0);
+# ifndef DRIVER_SYNC_1
+# define DRIVER_SYNC_1 0
+# endif
+ IS31FL3733_init(DRIVER_ADDR_1, DRIVER_SYNC_1);
+# if defined DRIVER_ADDR_2 && (DRIVER_ADDR_1 != DRIVER_ADDR_2)
+# ifndef DRIVER_SYNC_2
+# define DRIVER_SYNC_2 0
+# endif
+ IS31FL3733_init(DRIVER_ADDR_2, DRIVER_SYNC_2);
+# endif
+# ifdef DRIVER_ADDR_3
+# ifndef DRIVER_SYNC_3
+# define DRIVER_SYNC_3 0
+# endif
+ IS31FL3733_init(DRIVER_ADDR_3, DRIVER_SYNC_3);
+# endif
+# ifdef DRIVER_ADDR_4
+# ifndef DRIVER_SYNC_4
+# define DRIVER_SYNC_4 0
+# endif
+ IS31FL3733_init(DRIVER_ADDR_4, DRIVER_SYNC_4);
+# endif
# elif defined(IS31FL3737)
IS31FL3737_init(DRIVER_ADDR_1);
# else
@@ -74,7 +95,15 @@ static void init(void) {
# endif
# elif defined(IS31FL3733)
IS31FL3733_update_led_control_registers(DRIVER_ADDR_1, 0);
+# ifdef DRIVER_ADDR_2
IS31FL3733_update_led_control_registers(DRIVER_ADDR_2, 1);
+# endif
+# ifdef DRIVER_ADDR_3
+ IS31FL3733_update_led_control_registers(DRIVER_ADDR_3, 2);
+# endif
+# ifdef DRIVER_ADDR_4
+ IS31FL3733_update_led_control_registers(DRIVER_ADDR_4, 3);
+# endif
# elif defined(IS31FL3737)
IS31FL3737_update_led_control_registers(DRIVER_ADDR_1, DRIVER_ADDR_2);
# else
@@ -105,13 +134,21 @@ const rgb_matrix_driver_t rgb_matrix_driver = {
# elif defined(IS31FL3733)
static void flush(void) {
IS31FL3733_update_pwm_buffers(DRIVER_ADDR_1, 0);
+# ifdef DRIVER_ADDR_2
IS31FL3733_update_pwm_buffers(DRIVER_ADDR_2, 1);
+# endif
+# ifdef DRIVER_ADDR_3
+ IS31FL3733_update_pwm_buffers(DRIVER_ADDR_3, 2);
+# endif
+# ifdef DRIVER_ADDR_4
+ IS31FL3733_update_pwm_buffers(DRIVER_ADDR_4, 3);
+# endif
}
const rgb_matrix_driver_t rgb_matrix_driver = {
- .init = init,
- .flush = flush,
- .set_color = IS31FL3733_set_color,
+ .init = init,
+ .flush = flush,
+ .set_color = IS31FL3733_set_color,
.set_color_all = IS31FL3733_set_color_all,
};
# elif defined(IS31FL3737)
--
cgit v1.2.3
From 8f4767d9663874c318cd2e66f745503d63a50f05 Mon Sep 17 00:00:00 2001
From: Ryan
Date: Sat, 22 May 2021 16:56:17 +1000
Subject: [Keyboard] Fix Terrazzo build failure (#12977)
---
docs/feature_led_matrix.md | 1 -
docs/feature_rgb_matrix.md | 1 -
keyboards/terrazzo/config.h | 21 +++++++++++++++++++++
keyboards/terrazzo/rules.mk | 36 ++++++++++++++----------------------
keyboards/terrazzo/terrazzo.c | 33 +++++++++++++++++++++++++++++++++
5 files changed, 68 insertions(+), 24 deletions(-)
(limited to 'docs/feature_rgb_matrix.md')
diff --git a/docs/feature_led_matrix.md b/docs/feature_led_matrix.md
index e56caabfe7..e3b389762d 100644
--- a/docs/feature_led_matrix.md
+++ b/docs/feature_led_matrix.md
@@ -162,7 +162,6 @@ You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `con
|Define |Description |
|-------------------------------------------------------|-----------------------------------------------|
-|`#define DISABLE_LED_MATRIX_SOLID` |Disables `LED_MATRIX_SOLID` |
|`#define DISABLE_LED_MATRIX_ALPHAS_MODS` |Disables `LED_MATRIX_ALPHAS_MODS` |
|`#define DISABLE_LED_MATRIX_BREATHING` |Disables `LED_MATRIX_BREATHING` |
|`#define DISABLE_LED_MATRIX_BAND` |Disables `LED_MATRIX_BAND` |
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index a29d5c624b..3871e6bfda 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -362,7 +362,6 @@ You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `con
|Define |Description |
|-------------------------------------------------------|-----------------------------------------------|
-|`#define DISABLE_RGB_MATRIX_SOLID_COLOR` |Disables `RGB_MATRIX_SOLID_COLOR` |
|`#define DISABLE_RGB_MATRIX_ALPHAS_MODS` |Disables `RGB_MATRIX_ALPHAS_MODS` |
|`#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN` |Disables `RGB_MATRIX_GRADIENT_UP_DOWN` |
|`#define DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT` |Disables `MATRIX_GRADIENT_LEFT_RIGHT` |
diff --git a/keyboards/terrazzo/config.h b/keyboards/terrazzo/config.h
index e13a1e0dba..985110d16b 100644
--- a/keyboards/terrazzo/config.h
+++ b/keyboards/terrazzo/config.h
@@ -91,6 +91,27 @@ so there is only one configuration. */
#define LED_MATRIX_MAXIMUM_BRIGHTNESS 20
#define LED_DISABLE_WHEN_USB_SUSPENDED true
+#define DISABLE_LED_MATRIX_ALPHAS_MODS
+#define DISABLE_LED_MATRIX_BREATHING
+#define DISABLE_LED_MATRIX_BAND
+#define DISABLE_LED_MATRIX_BAND_PINWHEEL
+#define DISABLE_LED_MATRIX_BAND_SPIRAL
+#define DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT
+#define DISABLE_LED_MATRIX_CYCLE_UP_DOWN
+#define DISABLE_LED_MATRIX_CYCLE_OUT_IN
+#define DISABLE_LED_MATRIX_DUAL_BEACON
+#define DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE
+#define DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
+#define DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE
+#define DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
+#define DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS
+#define DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS
+#define DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS
+#define DISABLE_LED_MATRIX_SOLID_SPLASH
+#define DISABLE_LED_MATRIX_SOLID_MULTISPLASH
+#define DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT
+#define DISABLE_LED_MATRIX_WAVE_UP_DOWN
+
#endif
/* Terrazzo animations */
diff --git a/keyboards/terrazzo/rules.mk b/keyboards/terrazzo/rules.mk
index 843dbb88d1..719c6cb1fc 100644
--- a/keyboards/terrazzo/rules.mk
+++ b/keyboards/terrazzo/rules.mk
@@ -2,33 +2,25 @@
MCU = atmega32u4
# Bootloader selection
-# Teensy halfkay
-# Pro Micro caterina
-# Atmel DFU atmel-dfu
-# LUFA DFU lufa-dfu
-# QMK DFU qmk-dfu
-# ATmega32A bootloadHID
-# ATmega328P USBasp
BOOTLOADER = atmel-dfu
-
-
# Build Options
-# comment out to disable the options.
+# change yes to no to disable
#
-BOOTMAGIC_ENABLE = full # Virtual DIP switch configuration
-MOUSEKEY_ENABLE = no # Mouse keys
-EXTRAKEY_ENABLE = yes # Audio control and System control
-CONSOLE_ENABLE = no # Console for debug
-COMMAND_ENABLE = no # Commands for debug and configuration
-SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
-NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
-AUDIO_ENABLE = no
-RGBLIGHT_ENABLE = no
-BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
+BOOTMAGIC_ENABLE = full # Virtual DIP switch configuration
+MOUSEKEY_ENABLE = no # Mouse keys
+EXTRAKEY_ENABLE = yes # Audio control and System control
+CONSOLE_ENABLE = no # Console for debug
+COMMAND_ENABLE = no # Commands for debug and configuration
+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
+SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
+# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+NKRO_ENABLE = no # USB Nkey Rollover
+BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
+RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
+BLUETOOTH_ENABLE = no # Enable Bluetooth
+AUDIO_ENABLE = no # Audio output
LED_MATRIX_ENABLE = yes
LED_MATRIX_DRIVER = IS31FL3731
ENCODER_ENABLE = yes
WPM_ENABLE = yes
-
-LAYOUTS = ortho ortho_mit ortho_all
\ No newline at end of file
diff --git a/keyboards/terrazzo/terrazzo.c b/keyboards/terrazzo/terrazzo.c
index 1319b05e76..e6ba1f6c39 100644
--- a/keyboards/terrazzo/terrazzo.c
+++ b/keyboards/terrazzo/terrazzo.c
@@ -43,6 +43,39 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
{0, C2_15},{0, C2_14},{0, C2_13},{0, C2_12},{0, C2_11},{0, C2_10},{0, C2_9}
};
+led_config_t g_led_config = {
+ {
+ // Key Matrix to LED Index
+ { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
+ { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
+ { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
+ { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
+ { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
+ { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
+ { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
+ { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
+ { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }
+ }, {
+ // LED Index to Physical Position
+ { 0, 0 }, { 16, 0 }, { 32, 0 }, { 48, 0 }, { 64, 0 }, { 80, 0 }, { 96, 0 }, { 112, 0 }, { 128, 0 }, { 144, 0 }, { 160, 0 }, { 176, 0 }, { 192, 0 }, { 208, 0 }, { 224, 0 },
+ { 0, 11 }, { 16, 11 }, { 32, 11 }, { 48, 11 }, { 64, 11 }, { 80, 11 }, { 96, 11 }, { 112, 11 }, { 128, 11 }, { 144, 11 }, { 160, 11 }, { 176, 11 }, { 192, 11 }, { 208, 11 }, { 224, 11 },
+ { 0, 21 }, { 16, 21 }, { 32, 21 }, { 48, 21 }, { 64, 21 }, { 80, 21 }, { 96, 21 }, { 112, 21 }, { 128, 21 }, { 144, 21 }, { 160, 21 }, { 176, 21 }, { 192, 21 }, { 208, 21 }, { 224, 21 },
+ { 0, 32 }, { 16, 32 }, { 32, 32 }, { 48, 32 }, { 64, 32 }, { 80, 32 }, { 96, 32 }, { 112, 32 }, { 128, 32 }, { 144, 32 }, { 160, 32 }, { 176, 32 }, { 192, 32 }, { 208, 32 }, { 224, 32 },
+ { 0, 43 }, { 16, 43 }, { 32, 43 }, { 48, 43 }, { 64, 43 }, { 80, 43 }, { 96, 43 }, { 112, 43 }, { 128, 43 }, { 144, 43 }, { 160, 43 }, { 176, 43 }, { 192, 43 }, { 208, 43 }, { 224, 43 },
+ { 0, 53 }, { 16, 53 }, { 32, 53 }, { 48, 53 }, { 64, 53 }, { 80, 53 }, { 96, 53 }, { 112, 53 }, { 128, 53 }, { 144, 53 }, { 160, 53 }, { 176, 53 }, { 192, 53 }, { 208, 53 }, { 224, 53 },
+ { 0, 64 }, { 16, 64 }, { 32, 64 }, { 48, 64 }, { 64, 64 }, { 80, 64 }, { 96, 64 }, { 112, 64 }, { 128, 64 }, { 144, 64 }, { 160, 64 }, { 176, 64 }, { 192, 64 }, { 208, 64 }, { 224, 64 }
+ }, {
+ // LED Index to Flag
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
+ }
+};
+
#define TERRAZZO_EFFECT(name)
#define TERRAZZO_EFFECT_IMPLS
--
cgit v1.2.3
From 32b2ac0a807bdb088df685e6118f4c0966b6cca4 Mon Sep 17 00:00:00 2001
From: Gigahawk
Date: Wed, 9 Jun 2021 18:40:25 -0700
Subject: GMMK Pro RGB Support (#13147)
* Enable SPI1 for GMMK pro
* Setup initial boilerplate for new LED driver
* RGB matrix minimally functional
* Map full LED matrix
* Return keymap to default
* Fix printscreen LED mapping
* Reduce max brightness
* Default values for AW20216
* Add documentation for AW20216
* Disable console and warnings
* Run cformat
* Update drivers/awinic/aw20216.h
Co-authored-by: Drashna Jaelre
* make aw struct match issi struct
Co-authored-by: Drashna Jaelre
* add led location defines
Co-authored-by: Drashna Jaelre
* Use led pin definitions in keyboard.c
* Add driver indices to led map
* Fix elif typo
* Run cformat
* Update docs
* Fix typo in docs
* Document global brightness limits
Co-authored-by: Drashna Jaelre ---
common_features.mk | 9 +-
docs/feature_rgb_matrix.md | 68 ++++++++++++
drivers/awinic/aw20216.c | 166 ++++++++++++++++++++++++++++
drivers/awinic/aw20216.h | 251 +++++++++++++++++++++++++++++++++++++++++++
keyboards/gmmk/pro/config.h | 17 +++
keyboards/gmmk/pro/halconf.h | 7 ++
keyboards/gmmk/pro/mcuconf.h | 6 ++
keyboards/gmmk/pro/pro.c | 222 ++++++++++++++++++++++++++++++++++++++
keyboards/gmmk/pro/rules.mk | 2 +
quantum/rgb_matrix.h | 2 +
quantum/rgb_matrix_drivers.c | 16 +++
11 files changed, 765 insertions(+), 1 deletion(-)
create mode 100644 drivers/awinic/aw20216.c
create mode 100644 drivers/awinic/aw20216.h
create mode 100644 keyboards/gmmk/pro/halconf.h
create mode 100644 keyboards/gmmk/pro/mcuconf.h
(limited to 'docs/feature_rgb_matrix.md')
diff --git a/common_features.mk b/common_features.mk
index 1a9fd46b55..37ce928e2a 100644
--- a/common_features.mk
+++ b/common_features.mk
@@ -244,7 +244,7 @@ endif
endif
RGB_MATRIX_ENABLE ?= no
-VALID_RGB_MATRIX_TYPES := IS31FL3731 IS31FL3733 IS31FL3737 IS31FL3741 WS2812 custom
+VALID_RGB_MATRIX_TYPES := AW20216 IS31FL3731 IS31FL3733 IS31FL3737 IS31FL3741 WS2812 custom
ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
ifeq ($(filter $(RGB_MATRIX_DRIVER),$(VALID_RGB_MATRIX_TYPES)),)
@@ -261,6 +261,13 @@ endif
CIE1931_CURVE := yes
RGB_KEYCODES_ENABLE := yes
+ ifeq ($(strip $(RGB_MATRIX_DRIVER)), AW20216)
+ OPT_DEFS += -DAW20216 -DSTM32_SPI -DHAL_USE_SPI=TRUE
+ COMMON_VPATH += $(DRIVER_PATH)/awinic
+ SRC += aw20216.c
+ QUANTUM_LIB_SRC += spi_master.c
+ endif
+
ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3731)
OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE
COMMON_VPATH += $(DRIVER_PATH)/issi
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 169443fb85..afd72fecff 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -227,6 +227,74 @@ Configure the hardware via your `config.h`:
#define DRIVER_LED_TOTAL 70
```
+---
+### AW20216 :id=aw20216
+There is basic support for addressable RGB matrix lighting with the SPI AW20216 RGB controller. To enable it, add this to your `rules.mk`:
+
+```makefile
+RGB_MATRIX_ENABLE = yes
+RGB_MATRIX_DRIVER = AW20216
+```
+
+You can use up to 2 AW20216 IC's. Do not specify `DRIVER__xxx` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`:
+
+| Variable | Description | Default |
+|----------|-------------|---------|
+| `DRIVER_1_CS` | (Required) MCU pin connected to first RGB driver chip select line | B13 |
+| `DRIVER_2_CS` | (Optional) MCU pin connected to second RGB driver chip select line | |
+| `DRIVER_1_EN` | (Required) MCU pin connected to first RGB driver hardware enable line | C13 |
+| `DRIVER_2_EN` | (Optional) MCU pin connected to second RGB driver hardware enable line | |
+| `DRIVER_1_LED_TOTAL` | (Required) How many RGB lights are connected to first RGB driver | |
+| `DRIVER_2_LED_TOTAL` | (Optional) How many RGB lights are connected to second RGB driver | |
+| `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | |
+| `DRIVER_LED_TOTAL` | (Required) How many RGB lights are present across all drivers | |
+| `AW_SCALING_MAX` | (Optional) LED current scaling value (0-255, higher values mean LED is brighter at full PWM) | 150 |
+| `AW_GLOBAL_CURRENT_MAX` | (Optional) Driver global current limit (0-255, higher values means the driver may consume more power) | 150 |
+
+Here is an example using 2 drivers.
+
+```c
+#define DRIVER_1_CS B13
+#define DRIVER_2_CS B14
+// Hardware enable lines may be connected to the same pin
+#define DRIVER_1_EN C13
+#define DRIVER_2_EN C13
+
+#define DRIVER_COUNT 2
+#define DRIVER_1_LED_TOTAL 66
+#define DRIVER_2_LED_TOTAL 32
+#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
+```
+
+!> Note the parentheses, this is so when `DRIVER_LED_TOTAL` is used in code and expanded, the values are added together before any additional math is applied to them. As an example, `rand() % (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)` will give very different results than `rand() % DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL`.
+
+Define these arrays listing all the LEDs in your `.c`:
+
+```c
+const aw_led g_aw_leds[DRIVER_LED_TOTAL] = {
+/* Each AW20216 channel is controlled by a register at some offset between 0x00
+ * and 0xD7 inclusive.
+ * See drivers/awinic/aw20216.h for the mapping between register offsets and
+ * driver pin locations.
+ * driver
+ * | R location
+ * | | G location
+ * | | | B location
+ * | | | | */
+ { 0, CS1_SW1, CS2_SW1, CS3_SW1 },
+ { 0, CS4_SW1, CS5_SW1, CS6_SW1 },
+ { 0, CS7_SW1, CS8_SW1, CS9_SW1 },
+ { 0, CS10_SW1, CS11_SW1, CS12_SW1 },
+ { 0, CS13_SW1, CS14_SW1, CS15_SW1 },
+ ...
+ { 1, CS1_SW1, CS2_SW1, CS3_SW1 },
+ { 1, CS13_SW1, CS14_SW1, CS15_SW1 },
+ { 1, CS16_SW1, CS17_SW1, CS18_SW1 },
+ { 1, CS4_SW2, CS5_SW2, CS6_SW2 },
+ ...
+};
+```
+
---
From this point forward the configuration is the same for all the drivers. The `led_config_t` struct provides a key electrical matrix to led index lookup table, what the physical position of each LED is on the board, and what type of key or usage the LED if the LED represents. Here is a brief example:
diff --git a/drivers/awinic/aw20216.c b/drivers/awinic/aw20216.c
new file mode 100644
index 0000000000..236c42a3cd
--- /dev/null
+++ b/drivers/awinic/aw20216.c
@@ -0,0 +1,166 @@
+/* Copyright 2021 Jasper Chan
+ *
+ * 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 "aw20216.h"
+#include "spi_master.h"
+
+/* The AW20216 appears to be somewhat similar to the IS31FL743, although quite
+ * a few things are different, such as the command byte format and page ordering.
+ * The LED addresses start from 0x00 instead of 0x01.
+ */
+#define AWINIC_ID 0b1010 << 4
+
+#define AW_PAGE_FUNCTION 0x00 << 1 // PG0, Function registers
+#define AW_PAGE_PWM 0x01 << 1 // PG1, LED PWM control
+#define AW_PAGE_SCALING 0x02 << 1 // PG2, LED current scaling control
+#define AW_PAGE_PATCHOICE 0x03 << 1 // PG3, Pattern choice?
+#define AW_PAGE_PWMSCALING 0x04 << 1 // PG4, LED PWM + Scaling control?
+
+#define AW_WRITE 0
+#define AW_READ 1
+
+#define AW_REG_CONFIGURATION 0x00 // PG0
+#define AW_REG_GLOBALCURRENT 0x01 // PG0
+
+// Default value of AW_REG_CONFIGURATION
+// D7:D4 = 1011, SWSEL (SW1~SW12 active)
+// D3 = 0?, reserved (apparently this should be 1 but it doesn't seem to matter)
+// D2:D1 = 00, OSDE (open/short detection enable)
+// D0 = 0, CHIPEN (write 1 to enable LEDs when hardware enable pulled high)
+#define AW_CONFIG_DEFAULT 0b10110000
+#define AW_CHIPEN 1
+
+#ifndef AW_SCALING_MAX
+# define AW_SCALING_MAX 150
+#endif
+
+#ifndef AW_GLOBAL_CURRENT_MAX
+# define AW_GLOBAL_CURRENT_MAX 150
+#endif
+
+#ifndef DRIVER_1_CS
+# define DRIVER_1_CS B13
+#endif
+
+#ifndef DRIVER_1_EN
+# define DRIVER_1_EN C13
+#endif
+
+uint8_t g_spi_transfer_buffer[20] = {0};
+aw_led g_pwm_buffer[DRIVER_LED_TOTAL];
+bool g_pwm_buffer_update_required[DRIVER_LED_TOTAL];
+
+bool AW20216_write_register(pin_t slave_pin, uint8_t page, uint8_t reg, uint8_t data) {
+ // Do we need to call spi_stop() if this fails?
+ if (!spi_start(slave_pin, false, 0, 16)) {
+ return false;
+ }
+
+ g_spi_transfer_buffer[0] = (AWINIC_ID | page | AW_WRITE);
+ g_spi_transfer_buffer[1] = reg;
+ g_spi_transfer_buffer[2] = data;
+
+ if (spi_transmit(g_spi_transfer_buffer, 3) != SPI_STATUS_SUCCESS) {
+ spi_stop();
+ return false;
+ }
+ spi_stop();
+ return true;
+}
+
+bool AW20216_init_scaling(void) {
+ // Set constant current to the max, control brightness with PWM
+ aw_led led;
+ for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
+ led = g_aw_leds[i];
+ if (led.driver == 0) {
+ AW20216_write_register(DRIVER_1_CS, AW_PAGE_SCALING, led.r, AW_SCALING_MAX);
+ AW20216_write_register(DRIVER_1_CS, AW_PAGE_SCALING, led.g, AW_SCALING_MAX);
+ AW20216_write_register(DRIVER_1_CS, AW_PAGE_SCALING, led.b, AW_SCALING_MAX);
+ }
+#ifdef DRIVER_2_CS
+ else if (led.driver == 1) {
+ AW20216_write_register(DRIVER_2_CS, AW_PAGE_SCALING, led.r, AW_SCALING_MAX);
+ AW20216_write_register(DRIVER_2_CS, AW_PAGE_SCALING, led.g, AW_SCALING_MAX);
+ AW20216_write_register(DRIVER_2_CS, AW_PAGE_SCALING, led.b, AW_SCALING_MAX);
+ }
+#endif
+ }
+ return true;
+}
+
+bool AW20216_soft_enable(void) {
+ AW20216_write_register(DRIVER_1_CS, AW_PAGE_FUNCTION, AW_REG_CONFIGURATION, AW_CONFIG_DEFAULT | AW_CHIPEN);
+#ifdef DRIVER_2_CS
+ AW20216_write_register(DRIVER_2_CS, AW_PAGE_FUNCTION, AW_REG_CONFIGURATION, AW_CONFIG_DEFAULT | AW_CHIPEN);
+#endif
+ return true;
+}
+
+void AW20216_update_pwm(int index, uint8_t red, uint8_t green, uint8_t blue) {
+ aw_led led = g_aw_leds[index];
+ if (led.driver == 0) {
+ AW20216_write_register(DRIVER_1_CS, AW_PAGE_PWM, led.r, red);
+ AW20216_write_register(DRIVER_1_CS, AW_PAGE_PWM, led.g, green);
+ AW20216_write_register(DRIVER_1_CS, AW_PAGE_PWM, led.b, blue);
+ }
+#ifdef DRIVER_2_CS
+ else if (led.driver == 1) {
+ AW20216_write_register(DRIVER_2_CS, AW_PAGE_PWM, led.r, red);
+ AW20216_write_register(DRIVER_2_CS, AW_PAGE_PWM, led.g, green);
+ AW20216_write_register(DRIVER_2_CS, AW_PAGE_PWM, led.b, blue);
+ }
+#endif
+ return;
+}
+
+void AW20216_init(void) {
+ // All LEDs should start with all scaling and PWM registers as off
+ setPinOutput(DRIVER_1_EN);
+ writePinHigh(DRIVER_1_EN);
+ AW20216_write_register(DRIVER_1_CS, AW_PAGE_FUNCTION, AW_REG_GLOBALCURRENT, AW_GLOBAL_CURRENT_MAX);
+#ifdef DRIVER_2_EN
+ setPinOutput(DRIVER_2_EN);
+ writePinHigh(DRIVER_2_EN);
+ AW20216_write_register(DRIVER_2_CS, AW_PAGE_FUNCTION, AW_REG_GLOBALCURRENT, AW_GLOBAL_CURRENT_MAX);
+#endif
+ AW20216_init_scaling();
+ AW20216_soft_enable();
+ return;
+}
+
+void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
+ g_pwm_buffer[index].r = red;
+ g_pwm_buffer[index].g = green;
+ g_pwm_buffer[index].b = blue;
+ g_pwm_buffer_update_required[index] = true;
+ return;
+}
+void AW20216_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
+ for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
+ AW20216_set_color(i, red, green, blue);
+ }
+ return;
+}
+void AW20216_update_pwm_buffers(void) {
+ for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
+ if (g_pwm_buffer_update_required[i]) {
+ AW20216_update_pwm(i, g_pwm_buffer[i].r, g_pwm_buffer[i].g, g_pwm_buffer[i].b);
+ g_pwm_buffer_update_required[i] = false;
+ }
+ }
+ return;
+}
diff --git a/drivers/awinic/aw20216.h b/drivers/awinic/aw20216.h
new file mode 100644
index 0000000000..9c6865cc82
--- /dev/null
+++ b/drivers/awinic/aw20216.h
@@ -0,0 +1,251 @@
+/* Copyright 2021 Jasper Chan (Gigahawk)
+ *
+ * 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 .
+ */
+
+#pragma once
+
+#include
+#include
+
+typedef struct aw_led {
+ uint8_t driver : 2;
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+} aw_led;
+
+extern const aw_led g_aw_leds[DRIVER_LED_TOTAL];
+
+void AW20216_init(void);
+void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
+void AW20216_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
+void AW20216_update_pwm_buffers(void);
+
+#define CS1_SW1 0x00
+#define CS2_SW1 0x01
+#define CS3_SW1 0x02
+#define CS4_SW1 0x03
+#define CS5_SW1 0x04
+#define CS6_SW1 0x05
+#define CS7_SW1 0x06
+#define CS8_SW1 0x07
+#define CS9_SW1 0x08
+#define CS10_SW1 0x09
+#define CS11_SW1 0x0A
+#define CS12_SW1 0x0B
+#define CS13_SW1 0x0C
+#define CS14_SW1 0x0D
+#define CS15_SW1 0x0E
+#define CS16_SW1 0x0F
+#define CS17_SW1 0x10
+#define CS18_SW1 0x11
+#define CS1_SW2 0x12
+#define CS2_SW2 0x13
+#define CS3_SW2 0x14
+#define CS4_SW2 0x15
+#define CS5_SW2 0x16
+#define CS6_SW2 0x17
+#define CS7_SW2 0x18
+#define CS8_SW2 0x19
+#define CS9_SW2 0x1A
+#define CS10_SW2 0x1B
+#define CS11_SW2 0x1C
+#define CS12_SW2 0x1D
+#define CS13_SW2 0x1E
+#define CS14_SW2 0x1F
+#define CS15_SW2 0x20
+#define CS16_SW2 0x21
+#define CS17_SW2 0x22
+#define CS18_SW2 0x23
+#define CS1_SW3 0x24
+#define CS2_SW3 0x25
+#define CS3_SW3 0x26
+#define CS4_SW3 0x27
+#define CS5_SW3 0x28
+#define CS6_SW3 0x29
+#define CS7_SW3 0x2A
+#define CS8_SW3 0x2B
+#define CS9_SW3 0x2C
+#define CS10_SW3 0x2D
+#define CS11_SW3 0x2E
+#define CS12_SW3 0x2F
+#define CS13_SW3 0x30
+#define CS14_SW3 0x31
+#define CS15_SW3 0x32
+#define CS16_SW3 0x33
+#define CS17_SW3 0x34
+#define CS18_SW3 0x35
+#define CS1_SW4 0x36
+#define CS2_SW4 0x37
+#define CS3_SW4 0x38
+#define CS4_SW4 0x39
+#define CS5_SW4 0x3A
+#define CS6_SW4 0x3B
+#define CS7_SW4 0x3C
+#define CS8_SW4 0x3D
+#define CS9_SW4 0x3E
+#define CS10_SW4 0x3F
+#define CS11_SW4 0x40
+#define CS12_SW4 0x41
+#define CS13_SW4 0x42
+#define CS14_SW4 0x43
+#define CS15_SW4 0x44
+#define CS16_SW4 0x45
+#define CS17_SW4 0x46
+#define CS18_SW4 0x47
+#define CS1_SW5 0x48
+#define CS2_SW5 0x49
+#define CS3_SW5 0x4A
+#define CS4_SW5 0x4B
+#define CS5_SW5 0x4C
+#define CS6_SW5 0x4D
+#define CS7_SW5 0x4E
+#define CS8_SW5 0x4F
+#define CS9_SW5 0x50
+#define CS10_SW5 0x51
+#define CS11_SW5 0x52
+#define CS12_SW5 0x53
+#define CS13_SW5 0x54
+#define CS14_SW5 0x55
+#define CS15_SW5 0x56
+#define CS16_SW5 0x57
+#define CS17_SW5 0x58
+#define CS18_SW5 0x59
+#define CS1_SW6 0x5A
+#define CS2_SW6 0x5B
+#define CS3_SW6 0x5C
+#define CS4_SW6 0x5D
+#define CS5_SW6 0x5E
+#define CS6_SW6 0x5F
+#define CS7_SW6 0x60
+#define CS8_SW6 0x61
+#define CS9_SW6 0x62
+#define CS10_SW6 0x63
+#define CS11_SW6 0x64
+#define CS12_SW6 0x65
+#define CS13_SW6 0x66
+#define CS14_SW6 0x67
+#define CS15_SW6 0x68
+#define CS16_SW6 0x69
+#define CS17_SW6 0x6A
+#define CS18_SW6 0x6B
+#define CS1_SW7 0x6C
+#define CS2_SW7 0x6D
+#define CS3_SW7 0x6E
+#define CS4_SW7 0x6F
+#define CS5_SW7 0x70
+#define CS6_SW7 0x71
+#define CS7_SW7 0x72
+#define CS8_SW7 0x73
+#define CS9_SW7 0x74
+#define CS10_SW7 0x75
+#define CS11_SW7 0x76
+#define CS12_SW7 0x77
+#define CS13_SW7 0x78
+#define CS14_SW7 0x79
+#define CS15_SW7 0x7A
+#define CS16_SW7 0x7B
+#define CS17_SW7 0x7C
+#define CS18_SW7 0x7D
+#define CS1_SW8 0x7E
+#define CS2_SW8 0x7F
+#define CS3_SW8 0x80
+#define CS4_SW8 0x81
+#define CS5_SW8 0x82
+#define CS6_SW8 0x83
+#define CS7_SW8 0x84
+#define CS8_SW8 0x85
+#define CS9_SW8 0x86
+#define CS10_SW8 0x87
+#define CS11_SW8 0x88
+#define CS12_SW8 0x89
+#define CS13_SW8 0x8A
+#define CS14_SW8 0x8B
+#define CS15_SW8 0x8C
+#define CS16_SW8 0x8D
+#define CS17_SW8 0x8E
+#define CS18_SW8 0x8F
+#define CS1_SW9 0x90
+#define CS2_SW9 0x91
+#define CS3_SW9 0x92
+#define CS4_SW9 0x93
+#define CS5_SW9 0x94
+#define CS6_SW9 0x95
+#define CS7_SW9 0x96
+#define CS8_SW9 0x97
+#define CS9_SW9 0x98
+#define CS10_SW9 0x99
+#define CS11_SW9 0x9A
+#define CS12_SW9 0x9B
+#define CS13_SW9 0x9C
+#define CS14_SW9 0x9D
+#define CS15_SW9 0x9E
+#define CS16_SW9 0x9F
+#define CS17_SW9 0xA0
+#define CS18_SW9 0xA1
+#define CS1_SW10 0xA2
+#define CS2_SW10 0xA3
+#define CS3_SW10 0xA4
+#define CS4_SW10 0xA5
+#define CS5_SW10 0xA6
+#define CS6_SW10 0xA7
+#define CS7_SW10 0xA8
+#define CS8_SW10 0xA9
+#define CS9_SW10 0xAA
+#define CS10_SW10 0xAB
+#define CS11_SW10 0xAC
+#define CS12_SW10 0xAD
+#define CS13_SW10 0xAE
+#define CS14_SW10 0xAF
+#define CS15_SW10 0xB0
+#define CS16_SW10 0xB1
+#define CS17_SW10 0xB2
+#define CS18_SW10 0xB3
+#define CS1_SW11 0xB4
+#define CS2_SW11 0xB5
+#define CS3_SW11 0xB6
+#define CS4_SW11 0xB7
+#define CS5_SW11 0xB8
+#define CS6_SW11 0xB9
+#define CS7_SW11 0xBA
+#define CS8_SW11 0xBB
+#define CS9_SW11 0xBC
+#define CS10_SW11 0xBD
+#define CS11_SW11 0xBE
+#define CS12_SW11 0xBF
+#define CS13_SW11 0xC0
+#define CS14_SW11 0xC1
+#define CS15_SW11 0xC2
+#define CS16_SW11 0xC3
+#define CS17_SW11 0xC4
+#define CS18_SW11 0xC5
+#define CS1_SW12 0xC6
+#define CS2_SW12 0xC7
+#define CS3_SW12 0xC8
+#define CS4_SW12 0xC9
+#define CS5_SW12 0xCA
+#define CS6_SW12 0xCB
+#define CS7_SW12 0xCC
+#define CS8_SW12 0xCD
+#define CS9_SW12 0xCE
+#define CS10_SW12 0xCF
+#define CS11_SW12 0xD0
+#define CS12_SW12 0xD1
+#define CS13_SW12 0xD2
+#define CS14_SW12 0xD3
+#define CS15_SW12 0xD4
+#define CS16_SW12 0xD5
+#define CS17_SW12 0xD6
+#define CS18_SW12 0xD7
diff --git a/keyboards/gmmk/pro/config.h b/keyboards/gmmk/pro/config.h
index ab3c7a7a21..64062becea 100644
--- a/keyboards/gmmk/pro/config.h
+++ b/keyboards/gmmk/pro/config.h
@@ -46,3 +46,20 @@
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
+
+/* SPI Config for LED Driver */
+#define SPI_DRIVER SPID1
+#define SPI_SCK_PIN A5
+#define SPI_MOSI_PIN A6
+#define SPI_MISO_PIN A7
+
+#define DRIVER_1_CS B13
+#define DRIVER_2_CS B14
+#define DRIVER_1_EN C13
+#define DRIVER_2_EN C13
+
+#define DRIVER_COUNT 2
+#define DRIVER_1_LED_TOTAL 66
+#define DRIVER_2_LED_TOTAL 32
+#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
+
diff --git a/keyboards/gmmk/pro/halconf.h b/keyboards/gmmk/pro/halconf.h
new file mode 100644
index 0000000000..23ecb202a1
--- /dev/null
+++ b/keyboards/gmmk/pro/halconf.h
@@ -0,0 +1,7 @@
+#pragma once
+
+#define HAL_USE_SPI TRUE
+#define SPI_USE_WAIT TRUE
+#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
+
+#include_next
diff --git a/keyboards/gmmk/pro/mcuconf.h b/keyboards/gmmk/pro/mcuconf.h
new file mode 100644
index 0000000000..bb1c0acde2
--- /dev/null
+++ b/keyboards/gmmk/pro/mcuconf.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#include_next
+
+#undef STM32_SPI_USE_SPI1
+#define STM32_SPI_USE_SPI1 TRUE
diff --git a/keyboards/gmmk/pro/pro.c b/keyboards/gmmk/pro/pro.c
index 816d089a58..3a343f2237 100644
--- a/keyboards/gmmk/pro/pro.c
+++ b/keyboards/gmmk/pro/pro.c
@@ -14,3 +14,225 @@
* along with this program. If not, see .
*/
#include "pro.h"
+
+#ifdef RGB_MATRIX_ENABLE
+led_config_t g_led_config = { {
+ { 4, NO_LED, NO_LED, 97, 65, 79, 5, 28 },
+ { 8, 2, 9, 0, 10, 75, 1, 7 },
+ { 14, 3, 15, NO_LED, 16, 86, 6, 13 },
+ { 20, 18, 21, 23, 22, 94, 12, 19 },
+ { 25, 30, 26, 31, 27, 32, 29, 24 },
+ { 41, 36, 42, 37, 43, 38, 35, 40 },
+ { 46, 89, 47, 34, 48, 72, 78, 45 },
+ { 52, 39, 53, 101, 54, 82, 44, 51 },
+ { 58, 63, 59, 64, NO_LED, 60, 62, 57 },
+ { 11, 90, 55, 17, 33, 49, NO_LED, 69 },
+ { NO_LED, 85, 93, 61, 100, 66, 50, 56 }
+}, {
+ { 0, 0 }, // 0, ESC, k13
+ { 0, 15 }, // 1, ~, k16
+ { 4, 26 }, // 2, Tab, k11
+ { 5, 38 }, // 3, Caps, k21
+ { 9, 49 }, // 4, Sh_L, k00
+ { 2, 61 }, // 5, Ct_L, k06
+ { 18, 0 }, // 6, F1, k26
+ { 14, 15 }, // 7, 1, k17
+ { 22, 26 }, // 8, Q, k10
+ { 25, 38 }, // 9, A, k12
+ { 33, 49 }, // 10, Z, k14
+ { 20, 61 }, // 11, Win_L, k90
+ { 33, 0 }, // 12, F2, k36
+ { 29, 15 }, // 13, 2, k27
+ { 36, 26 }, // 14, W, k20
+ { 40, 38 }, // 15, S, k22
+ { 47, 49 }, // 16, X, k24
+ { 38, 61 }, // 17, Alt_L, k93
+ { 47, 0 }, // 18, F3, k31
+ { 43, 15 }, // 19, 3, k37
+ { 51, 26 }, // 20, E, k30
+ { 54, 38 }, // 21, D, k32
+ { 61, 49 }, // 22, C, k34
+ { 61, 0 }, // 23, F4, k33
+ { 58, 15 }, // 24, 4, k47
+ { 65, 26 }, // 25, R, k40
+ { 69, 38 }, // 26, F, k42
+ { 76, 49 }, // 27, V, k44
+ { 79, 0 }, // 28, F5, k07
+ { 72, 15 }, // 29, 5, k46
+ { 79, 26 }, // 30, T, k41
+ { 83, 38 }, // 31, G, k43
+ { 90, 49 }, // 32, B, k45
+ { 92, 61 }, // 33, SPACE, k94
+ { 94, 0 }, // 34, F6, k63
+ { 87, 15 }, // 35, 6, k56
+ { 94, 26 }, // 36, Y, k51
+ { 98, 38 }, // 37, H, k53
+ { 105, 49 }, // 38, N, k55
+ { 108, 0 }, // 39, F7, k71
+ { 101, 15 }, // 40, 7, k57
+ { 108, 26 }, // 41, U, k50
+ { 112, 38 }, // 42, J, k52
+ { 119, 49 }, // 43, M, k54
+ { 123, 0 }, // 44, F8, k76
+ { 116, 15 }, // 45, 8, k67
+ { 123, 26 }, // 46, I, k60
+ { 126, 38 }, // 47, K, k62
+ { 134, 49 }, // 48, ,, k64
+ { 145, 61 }, // 49, Alt_R, k95
+ { 141, 0 }, // 50, F9, ka6
+ { 130, 15 }, // 51, 9, k77
+ { 137, 26 }, // 52, O, k70
+ { 141, 38 }, // 53, L, k72
+ { 148, 49 }, // 54, ., k74
+ { 159, 61 }, // 55, FN, k92
+ { 155, 0 }, // 56, F10, ka7
+ { 145, 15 }, // 57, 0, k87
+ { 152, 26 }, // 58, P, k80
+ { 155, 38 }, // 59, ;, k82
+ { 163, 49 }, // 60, ?, k85
+ { 170, 0 }, // 61, F11, ka3
+ { 159, 15 }, // 62, -, k86
+ { 166, 26 }, // 63, [, k81
+ { 170, 38 }, // 64, ", k83
+ { 173, 61 }, // 65, Ct_R, k04
+ { 184, 0 }, // 66, F12, ka5
+ { 0, 8 }, // 67, LED, l01
+ { 224, 8 }, // 68, LED, l11
+ { 202, 0 }, // 69, Prt, k97
+ { 0, 15 }, // 70, LED, l02
+ { 224, 15 }, // 71, LED, l12
+ { 224, 15 }, // 72, Del, k65
+ { 0, 21 }, // 73, LED, l03
+ { 224, 21 }, // 74, LED, l13
+ { 224, 26 }, // 75, PgUp, k15
+ { 0, 28 }, // 76, LED, l04
+ { 224, 28 }, // 77, LED, l14
+ { 173, 15 }, // 78, =, k66
+ { 220, 64 }, // 79, Right, k05
+ { 0, 35 }, // 80, LED, l05
+ { 224, 35 }, // 81, LED, l15
+ { 224, 49 }, // 82, End, k75
+ { 0, 42 }, // 83, LED, l06
+ { 224, 42 }, // 84, LED, l16
+ { 195, 15 }, // 85, BSpc, ka1
+ { 224, 38 }, // 86, PgDn, k25
+ { 0, 48 }, // 87, LED, l07
+ { 224, 48 }, // 88, LED, l17
+ { 181, 26 }, // 89, ], k61
+ { 182, 49 }, // 90, Sh_R, k91
+ { 0, 55 }, // 91, LED, l08
+ { 224, 55 }, // 92, LED, l18
+ { 199, 26 }, // 93, \, ka2
+ { 206, 52 }, // 94, Up, k35
+ { 191, 64 }, // 95, Left, k03
+ { 193, 38 }, // 96, Enter, ka4
+ { 206, 64 } // 97, Down, k73
+}, {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 4, 2, 2, 4, 2, 2,
+ 4, 2, 2, 4, 4, 2, 2, 4, 2, 2, 4, 4, 2, 2, 4, 4, 2, 2, 4, 4, 4, 4, 4
+} };
+
+const aw_led g_aw_leds[DRIVER_LED_TOTAL] = {
+ { 0, CS1_SW1, CS2_SW1, CS3_SW1 }, // 0, ESC, k13
+ { 0, CS4_SW1, CS5_SW1, CS6_SW1 }, // 1, ~, k16
+ { 0, CS7_SW1, CS8_SW1, CS9_SW1 }, // 2, Tab, k11
+ { 0, CS10_SW1, CS11_SW1, CS12_SW1 }, // 3, Caps, k21
+ { 0, CS13_SW1, CS14_SW1, CS15_SW1 }, // 4, Sh_L, k00
+ { 0, CS16_SW1, CS17_SW1, CS18_SW1 }, // 5, Ct_L, k06
+ { 0, CS1_SW2, CS2_SW2, CS3_SW2 }, // 6, F1, k26
+ { 0, CS4_SW2, CS5_SW2, CS6_SW2 }, // 7, 1, k17
+ { 0, CS7_SW2, CS8_SW2, CS9_SW2 }, // 8, Q, k10
+ { 0, CS10_SW2, CS11_SW2, CS12_SW2 }, // 9, A, k12
+ { 0, CS13_SW2, CS14_SW2, CS15_SW2 }, // 10, Z, k14
+ { 0, CS16_SW2, CS17_SW2, CS18_SW2 }, // 11, Win_L, k90
+ { 0, CS1_SW3, CS2_SW3, CS3_SW3 }, // 12, F2, k36
+ { 0, CS4_SW3, CS5_SW3, CS6_SW3 }, // 13, 2, k27
+ { 0, CS7_SW3, CS8_SW3, CS9_SW3 }, // 14, W, k20
+ { 0, CS10_SW3, CS11_SW3, CS12_SW3 }, // 15, S, k22
+ { 0, CS13_SW3, CS14_SW3, CS15_SW3 }, // 16, X, k24
+ { 0, CS16_SW3, CS17_SW3, CS18_SW3 }, // 17, Alt_L, k93
+ { 0, CS1_SW4, CS2_SW4, CS3_SW4 }, // 18, F3, k31
+ { 0, CS4_SW4, CS5_SW4, CS6_SW4 }, // 19, 3, k37
+ { 0, CS7_SW4, CS8_SW4, CS9_SW4 }, // 20, E, k30
+ { 0, CS10_SW4, CS11_SW4, CS12_SW4 }, // 21, D, k32
+ { 0, CS13_SW4, CS14_SW4, CS15_SW4 }, // 22, C, k34
+ { 0, CS1_SW5, CS2_SW5, CS3_SW5 }, // 23, F4, k33
+ { 0, CS4_SW5, CS5_SW5, CS6_SW5 }, // 24, 4, k47
+ { 0, CS7_SW5, CS8_SW5, CS9_SW5 }, // 25, R, k40
+ { 0, CS10_SW5, CS11_SW5, CS12_SW5 }, // 26, F, k42
+ { 0, CS13_SW5, CS14_SW5, CS15_SW5 }, // 27, V, k44
+ { 0, CS1_SW6, CS2_SW6, CS3_SW6 }, // 28, F5, k07
+ { 0, CS4_SW6, CS5_SW6, CS6_SW6 }, // 29, 5, k46
+ { 0, CS7_SW6, CS8_SW6, CS9_SW6 }, // 30, T, k41
+ { 0, CS10_SW6, CS11_SW6, CS12_SW6 }, // 31, G, k43
+ { 0, CS13_SW6, CS14_SW6, CS15_SW6 }, // 32, B, k45
+ { 0, CS16_SW6, CS17_SW6, CS18_SW6 }, // 33, SPACE, k94
+ { 0, CS1_SW7, CS2_SW7, CS3_SW7 }, // 34, F6, k63
+ { 0, CS4_SW7, CS5_SW7, CS6_SW7 }, // 35, 6, k56
+ { 0, CS7_SW7, CS8_SW7, CS9_SW7 }, // 36, Y, k51
+ { 0, CS10_SW7, CS11_SW7, CS12_SW7 }, // 37, H, k53
+ { 0, CS13_SW7, CS14_SW7, CS15_SW7 }, // 38, N, k55
+ { 0, CS1_SW8, CS2_SW8, CS3_SW8 }, // 39, F7, k71
+ { 0, CS4_SW8, CS5_SW8, CS6_SW8 }, // 40, 7, k57
+ { 0, CS7_SW8, CS8_SW8, CS9_SW8 }, // 41, U, k50
+ { 0, CS10_SW8, CS11_SW8, CS12_SW8 }, // 42, J, k52
+ { 0, CS13_SW8, CS14_SW8, CS15_SW8 }, // 43, M, k54
+ { 0, CS1_SW9, CS2_SW9, CS3_SW9 }, // 44, F8, k76
+ { 0, CS4_SW9, CS5_SW9, CS6_SW9 }, // 45, 8, k67
+ { 0, CS7_SW9, CS8_SW9, CS9_SW9 }, // 46, I, k60
+ { 0, CS10_SW9, CS11_SW9, CS12_SW9 }, // 47, K, k62
+ { 0, CS13_SW9, CS14_SW9, CS15_SW9 }, // 48, ,, k64
+ { 0, CS16_SW9, CS17_SW9, CS18_SW9 }, // 49, Alt_R, k95
+ { 0, CS1_SW10, CS2_SW10, CS3_SW10 }, // 50, F9, ka6
+ { 0, CS4_SW10, CS5_SW10, CS6_SW10 }, // 51, 9, k77
+ { 0, CS7_SW10, CS8_SW10, CS9_SW10 }, // 52, O, k70
+ { 0, CS10_SW10, CS11_SW10, CS12_SW10 }, // 53, L, k72
+ { 0, CS13_SW10, CS14_SW10, CS15_SW10 }, // 54, ., k74
+ { 0, CS16_SW10, CS17_SW10, CS18_SW10 }, // 55, FN, k92
+ { 0, CS1_SW11, CS2_SW11, CS3_SW11 }, // 56, F10, ka7
+ { 0, CS4_SW11, CS5_SW11, CS6_SW11 }, // 57, 0, k87
+ { 0, CS7_SW11, CS8_SW11, CS9_SW11 }, // 58, P, k80
+ { 0, CS10_SW11, CS11_SW11, CS12_SW11 }, // 59, ;, k82
+ { 0, CS13_SW11, CS14_SW11, CS15_SW11 }, // 60, ?, k85
+ { 0, CS1_SW12, CS2_SW12, CS3_SW12 }, // 61, F11, ka3
+ { 0, CS4_SW12, CS5_SW12, CS6_SW12 }, // 62, -, k86
+ { 0, CS7_SW12, CS8_SW12, CS9_SW12 }, // 63, [, k81
+ { 0, CS10_SW12, CS11_SW12, CS12_SW12 }, // 64, ", k83
+ { 0, CS16_SW12, CS17_SW12, CS18_SW12 }, // 65, Ct_R, k04
+
+ { 1, CS1_SW1, CS2_SW1, CS3_SW1 }, // 66, F12, ka5
+ { 1, CS13_SW1, CS14_SW1, CS15_SW1 }, // 67, LED, l01
+ { 1, CS16_SW1, CS17_SW1, CS18_SW1 }, // 68, LED, l11
+ { 1, CS4_SW2, CS5_SW2, CS6_SW2 }, // 69, Prt, k97
+ { 1, CS13_SW2, CS14_SW2, CS15_SW2 }, // 70, LED, l02
+ { 1, CS16_SW2, CS17_SW2, CS18_SW2 }, // 71, LED, l12
+ { 1, CS4_SW3, CS5_SW3, CS6_SW3 }, // 72, Del, k65
+ { 1, CS13_SW3, CS14_SW3, CS15_SW3 }, // 73, LED, l03
+ { 1, CS16_SW3, CS17_SW3, CS18_SW3 }, // 74, LED, l13
+ { 1, CS4_SW4, CS5_SW4, CS6_SW4 }, // 75, PgUp, k15
+ { 1, CS13_SW4, CS14_SW4, CS15_SW4 }, // 76, LED, l04
+ { 1, CS16_SW4, CS17_SW4, CS18_SW4 }, // 77, LED, l14
+ { 1, CS1_SW5, CS2_SW5, CS3_SW5 }, // 78, =, k66
+ { 1, CS10_SW5, CS11_SW5, CS12_SW5 }, // 79, Right, k05
+ { 1, CS13_SW5, CS14_SW5, CS15_SW5 }, // 80, LED, l05
+ { 1, CS16_SW5, CS17_SW5, CS18_SW5 }, // 81, LED, l15
+ { 1, CS4_SW6, CS5_SW6, CS6_SW6 }, // 82, End, k75
+ { 1, CS13_SW6, CS14_SW6, CS15_SW6 }, // 83, LED, l06
+ { 1, CS16_SW6, CS17_SW6, CS18_SW6 }, // 84, LED, l16
+ { 1, CS1_SW7, CS2_SW7, CS3_SW7 }, // 85, BSpc, ka1
+ { 1, CS4_SW7, CS5_SW7, CS6_SW7 }, // 86, PgDn, k25
+ { 1, CS13_SW7, CS14_SW7, CS15_SW7 }, // 87, LED, l07
+ { 1, CS16_SW7, CS17_SW7, CS18_SW7 }, // 88, LED, l17
+ { 1, CS1_SW8, CS2_SW8, CS3_SW8 }, // 89, ], k61
+ { 1, CS4_SW8, CS5_SW8, CS6_SW8 }, // 90, Sh_R, k91
+ { 1, CS13_SW8, CS14_SW8, CS15_SW8 }, // 91, LED, l08
+ { 1, CS16_SW8, CS17_SW8, CS18_SW8 }, // 92, LED, l18
+ { 1, CS1_SW9, CS2_SW9, CS3_SW9 }, // 93, \, ka2
+ { 1, CS4_SW9, CS5_SW9, CS6_SW9 }, // 94, Up, k35
+ { 1, CS4_SW10, CS5_SW10, CS6_SW10 }, // 95, Left, k03
+ { 1, CS1_SW11, CS2_SW11, CS3_SW11 }, // 96, Enter, ka4
+ { 1, CS4_SW11, CS5_SW11, CS6_SW11 }, // 97, Down, k73
+};
+#endif
diff --git a/keyboards/gmmk/pro/rules.mk b/keyboards/gmmk/pro/rules.mk
index b12d055a3d..6221d64082 100644
--- a/keyboards/gmmk/pro/rules.mk
+++ b/keyboards/gmmk/pro/rules.mk
@@ -21,3 +21,5 @@ RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no # Enable Bluetooth
AUDIO_ENABLE = no # Audio output
ENCODER_ENABLE = yes
+RGB_MATRIX_ENABLE = yes
+RGB_MATRIX_DRIVER = AW20216
diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h
index a615b8422c..741a2fe446 100644
--- a/quantum/rgb_matrix.h
+++ b/quantum/rgb_matrix.h
@@ -33,6 +33,8 @@
# include "is31fl3737.h"
#elif defined(IS31FL3741)
# include "is31fl3741.h"
+#elif defined(AW20216)
+# include "aw20216.h"
#elif defined(WS2812)
# include "ws2812.h"
#endif
diff --git a/quantum/rgb_matrix_drivers.c b/quantum/rgb_matrix_drivers.c
index 896fa6d0ef..6a11d4791e 100644
--- a/quantum/rgb_matrix_drivers.c
+++ b/quantum/rgb_matrix_drivers.c
@@ -171,6 +171,22 @@ const rgb_matrix_driver_t rgb_matrix_driver = {
};
# endif
+#elif defined(AW20216)
+# include "spi_master.h"
+static void init(void) {
+ spi_init();
+ AW20216_init();
+}
+
+static void flush(void) { AW20216_update_pwm_buffers(); }
+
+const rgb_matrix_driver_t rgb_matrix_driver = {
+ .init = init,
+ .flush = flush,
+ .set_color = AW20216_set_color,
+ .set_color_all = AW20216_set_color_all,
+};
+
#elif defined(WS2812)
# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_CUSTOM_DRIVER)
# pragma message "Cannot use RGBLIGHT and RGB Matrix using WS2812 at the same time."
--
cgit v1.2.3
From 1ea01765e19bf84b9a09954443b7d64be2bec0c7 Mon Sep 17 00:00:00 2001
From: Gigahawk
Date: Wed, 23 Jun 2021 02:57:46 -0700
Subject: Allow settable SPI divisor for AW20216 driver, set default to 4
(#13309)
---
docs/feature_rgb_matrix.md | 1 +
drivers/awinic/aw20216.c | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
(limited to 'docs/feature_rgb_matrix.md')
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 25ba3ffe32..925c9de6e4 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -250,6 +250,7 @@ You can use up to 2 AW20216 IC's. Do not specify `DRIVER__xxx` defines for IC
| `DRIVER_LED_TOTAL` | (Required) How many RGB lights are present across all drivers | |
| `AW_SCALING_MAX` | (Optional) LED current scaling value (0-255, higher values mean LED is brighter at full PWM) | 150 |
| `AW_GLOBAL_CURRENT_MAX` | (Optional) Driver global current limit (0-255, higher values means the driver may consume more power) | 150 |
+| `AW_SPI_DIVISOR` | (Optional) Clock divisor for SPI communication (powers of 2, smaller numbers means faster communication, should not be less than 4) | 4 |
Here is an example using 2 drivers.
diff --git a/drivers/awinic/aw20216.c b/drivers/awinic/aw20216.c
index 236c42a3cd..269bb3a59a 100644
--- a/drivers/awinic/aw20216.c
+++ b/drivers/awinic/aw20216.c
@@ -59,13 +59,17 @@
# define DRIVER_1_EN C13
#endif
+#ifndef AW_SPI_DIVISOR
+# define AW_SPI_DIVISOR 4
+#endif
+
uint8_t g_spi_transfer_buffer[20] = {0};
aw_led g_pwm_buffer[DRIVER_LED_TOTAL];
bool g_pwm_buffer_update_required[DRIVER_LED_TOTAL];
bool AW20216_write_register(pin_t slave_pin, uint8_t page, uint8_t reg, uint8_t data) {
// Do we need to call spi_stop() if this fails?
- if (!spi_start(slave_pin, false, 0, 16)) {
+ if (!spi_start(slave_pin, false, 0, AW_SPI_DIVISOR)) {
return false;
}
--
cgit v1.2.3
From 653082235aaca8552078e62714eab30d1a517f57 Mon Sep 17 00:00:00 2001
From: Ryan
Date: Wed, 30 Jun 2021 04:15:58 +1000
Subject: Relocate RGB/HSV color defs to a more fitting place (#13377)
---
docs/feature_rgb_matrix.md | 45 +++++-----
docs/feature_rgblight.md | 43 +++++-----
quantum/color.h | 54 ++++++++++++
quantum/rgblight/rgblight_list.h | 136 ++++++++++++++++++++++++++++++
quantum/rgblight_list.h | 178 ---------------------------------------
5 files changed, 235 insertions(+), 221 deletions(-)
create mode 100644 quantum/rgblight/rgblight_list.h
delete mode 100644 quantum/rgblight_list.h
(limited to 'docs/feature_rgb_matrix.md')
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 925c9de6e4..4bd8e1eb98 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -554,28 +554,29 @@ For inspiration and examples, check out the built-in effects under `quantum/rgb_
These are shorthands to popular colors. The `RGB` ones can be passed to the `setrgb` functions, while the `HSV` ones to the `sethsv` functions.
-|RGB |HSV |
-|-------------------|-------------------|
-|`RGB_WHITE` |`HSV_WHITE` |
-|`RGB_RED` |`HSV_RED` |
-|`RGB_CORAL` |`HSV_CORAL` |
-|`RGB_ORANGE` |`HSV_ORANGE` |
-|`RGB_GOLDENROD` |`HSV_GOLDENROD` |
-|`RGB_GOLD` |`HSV_GOLD` |
-|`RGB_YELLOW` |`HSV_YELLOW` |
-|`RGB_CHARTREUSE` |`HSV_CHARTREUSE` |
-|`RGB_GREEN` |`HSV_GREEN` |
-|`RGB_SPRINGGREEN` |`HSV_SPRINGGREEN` |
-|`RGB_TURQUOISE` |`HSV_TURQUOISE` |
-|`RGB_TEAL` |`HSV_TEAL` |
-|`RGB_CYAN` |`HSV_CYAN` |
-|`RGB_AZURE` |`HSV_AZURE` |
-|`RGB_BLUE` |`HSV_BLUE` |
-|`RGB_PURPLE` |`HSV_PURPLE` |
-|`RGB_MAGENTA` |`HSV_MAGENTA` |
-|`RGB_PINK` |`HSV_PINK` |
-
-These are defined in [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h). Feel free to add to this list!
+|RGB |HSV |
+|---------------------|---------------------|
+|`RGB_AZURE` |`HSV_AZURE` |
+|`RGB_BLACK`/`RGB_OFF`|`HSV_BLACK`/`HSV_OFF`|
+|`RGB_BLUE` |`HSV_BLUE` |
+|`RGB_CHARTREUSE` |`HSV_CHARTREUSE` |
+|`RGB_CORAL` |`HSV_CORAL` |
+|`RGB_CYAN` |`HSV_CYAN` |
+|`RGB_GOLD` |`HSV_GOLD` |
+|`RGB_GOLDENROD` |`HSV_GOLDENROD` |
+|`RGB_GREEN` |`HSV_GREEN` |
+|`RGB_MAGENTA` |`HSV_MAGENTA` |
+|`RGB_ORANGE` |`HSV_ORANGE` |
+|`RGB_PINK` |`HSV_PINK` |
+|`RGB_PURPLE` |`HSV_PURPLE` |
+|`RGB_RED` |`HSV_RED` |
+|`RGB_SPRINGGREEN` |`HSV_SPRINGGREEN` |
+|`RGB_TEAL` |`HSV_TEAL` |
+|`RGB_TURQUOISE` |`HSV_TURQUOISE` |
+|`RGB_WHITE` |`HSV_WHITE` |
+|`RGB_YELLOW` |`HSV_YELLOW` |
+
+These are defined in [`color.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/color.h). Feel free to add to this list!
## Additional `config.h` Options :id=additional-configh-options
diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md
index 0e75411f09..d323dee4f7 100644
--- a/docs/feature_rgblight.md
+++ b/docs/feature_rgblight.md
@@ -449,26 +449,27 @@ rgblight_sethsv_at(HSV_GREEN, 2); // led 2
These are shorthands to popular colors. The `RGB` ones can be passed to the `setrgb` functions, while the `HSV` ones to the `sethsv` functions.
-|RGB |HSV |
-|-------------------|-------------------|
-|`RGB_WHITE` |`HSV_WHITE` |
-|`RGB_RED` |`HSV_RED` |
-|`RGB_CORAL` |`HSV_CORAL` |
-|`RGB_ORANGE` |`HSV_ORANGE` |
-|`RGB_GOLDENROD` |`HSV_GOLDENROD` |
-|`RGB_GOLD` |`HSV_GOLD` |
-|`RGB_YELLOW` |`HSV_YELLOW` |
-|`RGB_CHARTREUSE` |`HSV_CHARTREUSE` |
-|`RGB_GREEN` |`HSV_GREEN` |
-|`RGB_SPRINGGREEN` |`HSV_SPRINGGREEN` |
-|`RGB_TURQUOISE` |`HSV_TURQUOISE` |
-|`RGB_TEAL` |`HSV_TEAL` |
-|`RGB_CYAN` |`HSV_CYAN` |
-|`RGB_AZURE` |`HSV_AZURE` |
-|`RGB_BLUE` |`HSV_BLUE` |
-|`RGB_PURPLE` |`HSV_PURPLE` |
-|`RGB_MAGENTA` |`HSV_MAGENTA` |
-|`RGB_PINK` |`HSV_PINK` |
+|RGB |HSV |
+|---------------------|---------------------|
+|`RGB_AZURE` |`HSV_AZURE` |
+|`RGB_BLACK`/`RGB_OFF`|`HSV_BLACK`/`HSV_OFF`|
+|`RGB_BLUE` |`HSV_BLUE` |
+|`RGB_CHARTREUSE` |`HSV_CHARTREUSE` |
+|`RGB_CORAL` |`HSV_CORAL` |
+|`RGB_CYAN` |`HSV_CYAN` |
+|`RGB_GOLD` |`HSV_GOLD` |
+|`RGB_GOLDENROD` |`HSV_GOLDENROD` |
+|`RGB_GREEN` |`HSV_GREEN` |
+|`RGB_MAGENTA` |`HSV_MAGENTA` |
+|`RGB_ORANGE` |`HSV_ORANGE` |
+|`RGB_PINK` |`HSV_PINK` |
+|`RGB_PURPLE` |`HSV_PURPLE` |
+|`RGB_RED` |`HSV_RED` |
+|`RGB_SPRINGGREEN` |`HSV_SPRINGGREEN` |
+|`RGB_TEAL` |`HSV_TEAL` |
+|`RGB_TURQUOISE` |`HSV_TURQUOISE` |
+|`RGB_WHITE` |`HSV_WHITE` |
+|`RGB_YELLOW` |`HSV_YELLOW` |
```c
rgblight_setrgb(RGB_ORANGE);
@@ -477,7 +478,7 @@ rgblight_setrgb_at(RGB_GOLD, 3);
rgblight_sethsv_range(HSV_WHITE, 0, 6);
```
-These are defined in [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h). Feel free to add to this list!
+These are defined in [`color.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/color.h). Feel free to add to this list!
## Changing the order of the LEDs
diff --git a/quantum/color.h b/quantum/color.h
index 4783f6839c..e2cfc46927 100644
--- a/quantum/color.h
+++ b/quantum/color.h
@@ -19,6 +19,60 @@
#include
#include
+// clang-format off
+
+/*
+ * RGB Colors
+ */
+#define RGB_AZURE 0x99, 0xF5, 0xFF
+#define RGB_BLACK 0x00, 0x00, 0x00
+#define RGB_BLUE 0x00, 0x00, 0xFF
+#define RGB_CHARTREUSE 0x80, 0xFF, 0x00
+#define RGB_CORAL 0xFF, 0x7C, 0x4D
+#define RGB_CYAN 0x00, 0xFF, 0xFF
+#define RGB_GOLD 0xFF, 0xD9, 0x00
+#define RGB_GOLDENROD 0xD9, 0xA5, 0x21
+#define RGB_GREEN 0x00, 0xFF, 0x00
+#define RGB_MAGENTA 0xFF, 0x00, 0xFF
+#define RGB_ORANGE 0xFF, 0x80, 0x00
+#define RGB_PINK 0xFF, 0x80, 0xBF
+#define RGB_PURPLE 0x7A, 0x00, 0xFF
+#define RGB_RED 0xFF, 0x00, 0x00
+#define RGB_SPRINGGREEN 0x00, 0xFF, 0x80
+#define RGB_TEAL 0x00, 0x80, 0x80
+#define RGB_TURQUOISE 0x47, 0x6E, 0x6A
+#define RGB_WHITE 0xFF, 0xFF, 0xFF
+#define RGB_YELLOW 0xFF, 0xFF, 0x00
+#define RGB_OFF RGB_BLACK
+
+/*
+ * HSV Colors
+ *
+ * All values (including hue) are scaled to 0-255
+ */
+#define HSV_AZURE 132, 102, 255
+#define HSV_BLACK 0, 0, 0
+#define HSV_BLUE 170, 255, 255
+#define HSV_CHARTREUSE 64, 255, 255
+#define HSV_CORAL 11, 176, 255
+#define HSV_CYAN 128, 255, 255
+#define HSV_GOLD 36, 255, 255
+#define HSV_GOLDENROD 30, 218, 218
+#define HSV_GREEN 85, 255, 255
+#define HSV_MAGENTA 213, 255, 255
+#define HSV_ORANGE 28, 255, 255
+#define HSV_PINK 234, 128, 255
+#define HSV_PURPLE 191, 255, 255
+#define HSV_RED 0, 255, 255
+#define HSV_SPRINGGREEN 106, 255, 255
+#define HSV_TEAL 128, 255, 128
+#define HSV_TURQUOISE 123, 90, 112
+#define HSV_WHITE 0, 0, 255
+#define HSV_YELLOW 43, 255, 255
+#define HSV_OFF HSV_BLACK
+
+// clang-format on
+
#if defined(__GNUC__)
# define PACKED __attribute__((__packed__))
#else
diff --git a/quantum/rgblight/rgblight_list.h b/quantum/rgblight/rgblight_list.h
new file mode 100644
index 0000000000..0fd68b75f3
--- /dev/null
+++ b/quantum/rgblight/rgblight_list.h
@@ -0,0 +1,136 @@
+/* Copyright 2018 Jack Humbert
+ *
+ * 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 .
+ */
+#pragma once
+
+#include "color.h"
+
+/*
+########################################################################################
+## ##
+## ##
+## ##
+## The functions below have been deprecated and may be removed in a future release. ##
+## ##
+## Please use the values in color.h with the RGB functions. ##
+## ##
+## ##
+## ##
+########################################################################################
+*/
+
+/* SET RGB List */
+#define rgblight_setrgb_white() rgblight_setrgb(RGB_WHITE)
+#define rgblight_setrgb_red() rgblight_setrgb(RGB_RED)
+#define rgblight_setrgb_coral() rgblight_setrgb(RGB_CORAL)
+#define rgblight_setrgb_orange() rgblight_setrgb(RGB_ORANGE)
+#define rgblight_setrgb_goldenrod() rgblight_setrgb(RGB_GOLDENROD)
+#define rgblight_setrgb_gold() rgblight_setrgb(RGB_GOLD)
+#define rgblight_setrgb_yellow() rgblight_setrgb(RGB_YELLOW)
+#define rgblight_setrgb_chartreuse() rgblight_setrgb(RGB_CHARTREUSE)
+#define rgblight_setrgb_green() rgblight_setrgb(RGB_GREEN)
+#define rgblight_setrgb_springgreen() rgblight_setrgb(RGB_SPRINGGREEN)
+#define rgblight_setrgb_turquoise() rgblight_setrgb(RGB_TURQUOISE)
+#define rgblight_setrgb_teal() rgblight_setrgb(RGB_TEAL)
+#define rgblight_setrgb_cyan() rgblight_setrgb(RGB_CYAN)
+#define rgblight_setrgb_azure() rgblight_setrgb(RGB_AZURE)
+#define rgblight_setrgb_blue() rgblight_setrgb(RGB_BLUE)
+#define rgblight_setrgb_purple() rgblight_setrgb(RGB_PURPLE)
+#define rgblight_setrgb_magenta() rgblight_setrgb(RGB_MAGENTA)
+#define rgblight_setrgb_pink() rgblight_setrgb(RGB_PINK)
+
+/* SET RGB List */
+#define rgblight_setrgb_white_at(at) rgblight_setrgb_at(RGB_WHITE, at)
+#define rgblight_setrgb_red_at(at) rgblight_setrgb_at(RGB_RED, at)
+#define rgblight_setrgb_coral_at(at) rgblight_setrgb_at(RGB_CORAL, at)
+#define rgblight_setrgb_orange_at(at) rgblight_setrgb_at(RGB_ORANGE at)
+#define rgblight_setrgb_goldenrod_at(at) rgblight_setrgb_at(RGB_GOLDENROD, at)
+#define rgblight_setrgb_gold_at(at) rgblight_setrgb_at(RGB_GOLD, at)
+#define rgblight_setrgb_yellow_at(at) rgblight_setrgb_at(RGB_YELLOW, at)
+#define rgblight_setrgb_chartreuse_at(at) rgblight_setrgb_at(RGB_CHARTREUSE, at)
+#define rgblight_setrgb_green_at(at) rgblight_setrgb_at(RGB_GREEN, at)
+#define rgblight_setrgb_springgreen_at(at) rgblight_setrgb_at(RGB_SPRINGGREEN, at)
+#define rgblight_setrgb_turquoise_at(at) rgblight_setrgb_at(RGB_TURQUOISE, at)
+#define rgblight_setrgb_teal_at(at) rgblight_setrgb_at(RGB_TEAL, at)
+#define rgblight_setrgb_cyan_at(at) rgblight_setrgb_at(RGB_CYAN, at)
+#define rgblight_setrgb_azure_at(at) rgblight_setrgb_at(RGB_AZURE, at)
+#define rgblight_setrgb_blue_at(at) rgblight_setrgb_at(RGB_BLUE, at)
+#define rgblight_setrgb_purple_at(at) rgblight_setrgb_at(RGB_PURPLE, at)
+#define rgblight_setrgb_magenta_at(at) rgblight_setrgb_at(RGB_MAGENTA, at)
+#define rgblight_setrgb_pink_at(at) rgblight_setrgb_at(RGB_PINK, at)
+
+/* SET HSV List */
+#define rgblight_sethsv_white() rgblight_sethsv(HSV_WHITE)
+#define rgblight_sethsv_red() rgblight_sethsv(HSV_RED)
+#define rgblight_sethsv_coral() rgblight_sethsv(HSV_CORAL)
+#define rgblight_sethsv_orange() rgblight_sethsv(HSV_ORANGE)
+#define rgblight_sethsv_goldenrod() rgblight_sethsv(HSV_GOLDENROD)
+#define rgblight_sethsv_gold() rgblight_sethsv(HSV_GOLD)
+#define rgblight_sethsv_yellow() rgblight_sethsv(HSV_YELLOW)
+#define rgblight_sethsv_chartreuse() rgblight_sethsv(HSV_CHARTREUSE)
+#define rgblight_sethsv_green() rgblight_sethsv(HSV_GREEN)
+#define rgblight_sethsv_springgreen() rgblight_sethsv(HSV_SPRINGGREEN)
+#define rgblight_sethsv_turquoise() rgblight_sethsv(HSV_TURQUOISE)
+#define rgblight_sethsv_teal() rgblight_sethsv(HSV_TEAL)
+#define rgblight_sethsv_cyan() rgblight_sethsv(HSV_CYAN)
+#define rgblight_sethsv_azure() rgblight_sethsv(HSV_AZURE)
+#define rgblight_sethsv_blue() rgblight_sethsv(HSV_BLUE)
+#define rgblight_sethsv_purple() rgblight_sethsv(HSV_PURPLE)
+#define rgblight_sethsv_magenta() rgblight_sethsv(HSV_MAGENTA)
+#define rgblight_sethsv_pink() rgblight_sethsv(HSV_PINK)
+
+/* SET HSV List */
+/* If you're doing layer indication, this is best, as it won't */
+/* write to the eeprom, since it's limited (very high value). */
+/* If you want to use modes with this (since you can), then you */
+/* want to use rgblight_mode_noeeprom(x) instead. */
+#define rgblight_sethsv_noeeprom_white() rgblight_sethsv_noeeprom(HSV_WHITE)
+#define rgblight_sethsv_noeeprom_red() rgblight_sethsv_noeeprom(HSV_RED)
+#define rgblight_sethsv_noeeprom_coral() rgblight_sethsv_noeeprom(HSV_CORAL)
+#define rgblight_sethsv_noeeprom_orange() rgblight_sethsv_noeeprom(HSV_ORANGE)
+#define rgblight_sethsv_noeeprom_goldenrod() rgblight_sethsv_noeeprom(HSV_GOLDENROD)
+#define rgblight_sethsv_noeeprom_gold() rgblight_sethsv_noeeprom(HSV_GOLD)
+#define rgblight_sethsv_noeeprom_yellow() rgblight_sethsv_noeeprom(HSV_YELLOW)
+#define rgblight_sethsv_noeeprom_chartreuse() rgblight_sethsv_noeeprom(HSV_CHARTREUSE)
+#define rgblight_sethsv_noeeprom_green() rgblight_sethsv_noeeprom(HSV_GREEN)
+#define rgblight_sethsv_noeeprom_springgreen() rgblight_sethsv_noeeprom(HSV_SPRINGGREEN)
+#define rgblight_sethsv_noeeprom_turquoise() rgblight_sethsv_noeeprom(HSV_TURQUOISE)
+#define rgblight_sethsv_noeeprom_teal() rgblight_sethsv_noeeprom(HSV_TEAL)
+#define rgblight_sethsv_noeeprom_cyan() rgblight_sethsv_noeeprom(HSV_CYAN)
+#define rgblight_sethsv_noeeprom_azure() rgblight_sethsv_noeeprom(HSV_AZURE)
+#define rgblight_sethsv_noeeprom_blue() rgblight_sethsv_noeeprom(HSV_BLUE)
+#define rgblight_sethsv_noeeprom_purple() rgblight_sethsv_noeeprom(HSV_PURPLE)
+#define rgblight_sethsv_noeeprom_magenta() rgblight_sethsv_noeeprom(HSV_MAGENTA)
+#define rgblight_sethsv_noeeprom_pink() rgblight_sethsv_noeeprom(HSV_PINK)
+
+/* SET HSV List */
+#define rgblight_sethsv_white_at(at) rgblight_sethsv_at(HSV_WHITE, at)
+#define rgblight_sethsv_red_at(at) rgblight_sethsv_at(HSV_RED, at)
+#define rgblight_sethsv_coral_at(at) rgblight_sethsv_at(HSV_CORAL, at)
+#define rgblight_sethsv_orange_at(at) rgblight_sethsv_at(HSV_ORANGE, at)
+#define rgblight_sethsv_goldenrod_at(at) rgblight_sethsv_at(HSV_GOLDENROD, at)
+#define rgblight_sethsv_gold_at(at) rgblight_sethsv_at(HSV_GOLD, at)
+#define rgblight_sethsv_yellow_at(at) rgblight_sethsv_at(HSV_YELLOW, at)
+#define rgblight_sethsv_chartreuse_at(at) rgblight_sethsv_at(HSV_CHARTREUSE, at)
+#define rgblight_sethsv_green_at(at) rgblight_sethsv_at(HSV_GREEN, at)
+#define rgblight_sethsv_springgreen_at(at) rgblight_sethsv_at(HSV_SPRINGGREEN, at)
+#define rgblight_sethsv_turquoise_at(at) rgblight_sethsv_at(HSV_TURQUOISE, at)
+#define rgblight_sethsv_teal_at(at) rgblight_sethsv_at(HSV_TEAL, at)
+#define rgblight_sethsv_cyan_at(at) rgblight_sethsv_at(HSV_CYAN, at)
+#define rgblight_sethsv_azure_at(at) rgblight_sethsv_at(HSV_AZURE, at)
+#define rgblight_sethsv_blue_at(at) rgblight_sethsv_at(HSV_BLUE, at)
+#define rgblight_sethsv_purple_at(at) rgblight_sethsv_at(HSV_PURPLE, at)
+#define rgblight_sethsv_magenta_at(at) rgblight_sethsv_at(HSV_MAGENTA, at)
+#define rgblight_sethsv_pink_at(at) rgblight_sethsv_at(HSV_PINK, at)
diff --git a/quantum/rgblight_list.h b/quantum/rgblight_list.h
deleted file mode 100644
index f29a646b66..0000000000
--- a/quantum/rgblight_list.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/* Copyright 2018 Jack Humbert
- *
- * 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 .
- */
-#pragma once
-
-/* RGB COLORS */
-#define RGB_WHITE 0xFF, 0xFF, 0xFF
-#define RGB_RED 0xFF, 0x00, 0x00
-#define RGB_CORAL 0xFF, 0x7C, 0x4D
-#define RGB_ORANGE 0xFF, 0x80, 0x00
-#define RGB_GOLDENROD 0xD9, 0xA5, 0x21
-#define RGB_GOLD 0xFF, 0xD9, 0x00
-#define RGB_YELLOW 0xFF, 0xFF, 0x00
-#define RGB_CHARTREUSE 0x80, 0xFF, 0x00
-#define RGB_GREEN 0x00, 0xFF, 0x00
-#define RGB_SPRINGGREEN 0x00, 0xFF, 0x80
-#define RGB_TURQUOISE 0x47, 0x6E, 0x6A
-#define RGB_TEAL 0x00, 0x80, 0x80
-#define RGB_CYAN 0x00, 0xFF, 0xFF
-#define RGB_AZURE 0x99, 0xf5, 0xFF
-#define RGB_BLUE 0x00, 0x00, 0xFF
-#define RGB_PURPLE 0x7A, 0x00, 0xFF
-#define RGB_MAGENTA 0xFF, 0x00, 0xFF
-#define RGB_PINK 0xFF, 0x80, 0xBF
-#define RGB_BLACK 0x00, 0x00, 0x00
-#define RGB_OFF RGB_BLACK
-
-/* HSV COLORS */
-#define HSV_WHITE 0, 0, 255
-#define HSV_RED 0, 255, 255
-#define HSV_CORAL 11, 176, 255
-#define HSV_ORANGE 28, 255, 255
-#define HSV_GOLDENROD 30, 218, 218
-#define HSV_GOLD 36, 255, 255
-#define HSV_YELLOW 43, 255, 255
-#define HSV_CHARTREUSE 64, 255, 255
-#define HSV_GREEN 85, 255, 255
-#define HSV_SPRINGGREEN 106, 255, 255
-#define HSV_TURQUOISE 123, 90, 112
-#define HSV_TEAL 128, 255, 128
-#define HSV_CYAN 128, 255, 255
-#define HSV_AZURE 132, 102, 255
-#define HSV_BLUE 170, 255, 255
-#define HSV_PURPLE 191, 255, 255
-#define HSV_MAGENTA 213, 255, 255
-#define HSV_PINK 234, 128, 255
-#define HSV_BLACK 0, 0, 0
-#define HSV_OFF HSV_BLACK
-
-/*
-########################################################################################
-## ##
-## ##
-## ##
-## The functions below have been deprecated and may be removed in a future release. ##
-## ##
-## Please use the values above with the RGB functions. ##
-## ##
-## ##
-## ##
-########################################################################################
-*/
-
-/* SET RGB List */
-#define rgblight_setrgb_white() rgblight_setrgb(RGB_WHITE)
-#define rgblight_setrgb_red() rgblight_setrgb(RGB_RED)
-#define rgblight_setrgb_coral() rgblight_setrgb(RGB_CORAL)
-#define rgblight_setrgb_orange() rgblight_setrgb(RGB_ORANGE)
-#define rgblight_setrgb_goldenrod() rgblight_setrgb(RGB_GOLDENROD)
-#define rgblight_setrgb_gold() rgblight_setrgb(RGB_GOLD)
-#define rgblight_setrgb_yellow() rgblight_setrgb(RGB_YELLOW)
-#define rgblight_setrgb_chartreuse() rgblight_setrgb(RGB_CHARTREUSE)
-#define rgblight_setrgb_green() rgblight_setrgb(RGB_GREEN)
-#define rgblight_setrgb_springgreen() rgblight_setrgb(RGB_SPRINGGREEN)
-#define rgblight_setrgb_turquoise() rgblight_setrgb(RGB_TURQUOISE)
-#define rgblight_setrgb_teal() rgblight_setrgb(RGB_TEAL)
-#define rgblight_setrgb_cyan() rgblight_setrgb(RGB_CYAN)
-#define rgblight_setrgb_azure() rgblight_setrgb(RGB_AZURE)
-#define rgblight_setrgb_blue() rgblight_setrgb(RGB_BLUE)
-#define rgblight_setrgb_purple() rgblight_setrgb(RGB_PURPLE)
-#define rgblight_setrgb_magenta() rgblight_setrgb(RGB_MAGENTA)
-#define rgblight_setrgb_pink() rgblight_setrgb(RGB_PINK)
-
-/* SET RGB List */
-#define rgblight_setrgb_white_at(at) rgblight_setrgb_at(RGB_WHITE, at)
-#define rgblight_setrgb_red_at(at) rgblight_setrgb_at(RGB_RED, at)
-#define rgblight_setrgb_coral_at(at) rgblight_setrgb_at(RGB_CORAL, at)
-#define rgblight_setrgb_orange_at(at) rgblight_setrgb_at(RGB_ORANGE at)
-#define rgblight_setrgb_goldenrod_at(at) rgblight_setrgb_at(RGB_GOLDENROD, at)
-#define rgblight_setrgb_gold_at(at) rgblight_setrgb_at(RGB_GOLD, at)
-#define rgblight_setrgb_yellow_at(at) rgblight_setrgb_at(RGB_YELLOW, at)
-#define rgblight_setrgb_chartreuse_at(at) rgblight_setrgb_at(RGB_CHARTREUSE, at)
-#define rgblight_setrgb_green_at(at) rgblight_setrgb_at(RGB_GREEN, at)
-#define rgblight_setrgb_springgreen_at(at) rgblight_setrgb_at(RGB_SPRINGGREEN, at)
-#define rgblight_setrgb_turquoise_at(at) rgblight_setrgb_at(RGB_TURQUOISE, at)
-#define rgblight_setrgb_teal_at(at) rgblight_setrgb_at(RGB_TEAL, at)
-#define rgblight_setrgb_cyan_at(at) rgblight_setrgb_at(RGB_CYAN, at)
-#define rgblight_setrgb_azure_at(at) rgblight_setrgb_at(RGB_AZURE, at)
-#define rgblight_setrgb_blue_at(at) rgblight_setrgb_at(RGB_BLUE, at)
-#define rgblight_setrgb_purple_at(at) rgblight_setrgb_at(RGB_PURPLE, at)
-#define rgblight_setrgb_magenta_at(at) rgblight_setrgb_at(RGB_MAGENTA, at)
-#define rgblight_setrgb_pink_at(at) rgblight_setrgb_at(RGB_PINK, at)
-
-/* SET HSV List */
-#define rgblight_sethsv_white() rgblight_sethsv(HSV_WHITE)
-#define rgblight_sethsv_red() rgblight_sethsv(HSV_RED)
-#define rgblight_sethsv_coral() rgblight_sethsv(HSV_CORAL)
-#define rgblight_sethsv_orange() rgblight_sethsv(HSV_ORANGE)
-#define rgblight_sethsv_goldenrod() rgblight_sethsv(HSV_GOLDENROD)
-#define rgblight_sethsv_gold() rgblight_sethsv(HSV_GOLD)
-#define rgblight_sethsv_yellow() rgblight_sethsv(HSV_YELLOW)
-#define rgblight_sethsv_chartreuse() rgblight_sethsv(HSV_CHARTREUSE)
-#define rgblight_sethsv_green() rgblight_sethsv(HSV_GREEN)
-#define rgblight_sethsv_springgreen() rgblight_sethsv(HSV_SPRINGGREEN)
-#define rgblight_sethsv_turquoise() rgblight_sethsv(HSV_TURQUOISE)
-#define rgblight_sethsv_teal() rgblight_sethsv(HSV_TEAL)
-#define rgblight_sethsv_cyan() rgblight_sethsv(HSV_CYAN)
-#define rgblight_sethsv_azure() rgblight_sethsv(HSV_AZURE)
-#define rgblight_sethsv_blue() rgblight_sethsv(HSV_BLUE)
-#define rgblight_sethsv_purple() rgblight_sethsv(HSV_PURPLE)
-#define rgblight_sethsv_magenta() rgblight_sethsv(HSV_MAGENTA)
-#define rgblight_sethsv_pink() rgblight_sethsv(HSV_PINK)
-
-/* SET HSV List */
-/* If you're doing layer indication, this is best, as it won't */
-/* write to the eeprom, since it's limited (very high value). */
-/* If you want to use modes with this (since you can), then you */
-/* want to use rgblight_mode_noeeprom(x) instead. */
-#define rgblight_sethsv_noeeprom_white() rgblight_sethsv_noeeprom(HSV_WHITE)
-#define rgblight_sethsv_noeeprom_red() rgblight_sethsv_noeeprom(HSV_RED)
-#define rgblight_sethsv_noeeprom_coral() rgblight_sethsv_noeeprom(HSV_CORAL)
-#define rgblight_sethsv_noeeprom_orange() rgblight_sethsv_noeeprom(HSV_ORANGE)
-#define rgblight_sethsv_noeeprom_goldenrod() rgblight_sethsv_noeeprom(HSV_GOLDENROD)
-#define rgblight_sethsv_noeeprom_gold() rgblight_sethsv_noeeprom(HSV_GOLD)
-#define rgblight_sethsv_noeeprom_yellow() rgblight_sethsv_noeeprom(HSV_YELLOW)
-#define rgblight_sethsv_noeeprom_chartreuse() rgblight_sethsv_noeeprom(HSV_CHARTREUSE)
-#define rgblight_sethsv_noeeprom_green() rgblight_sethsv_noeeprom(HSV_GREEN)
-#define rgblight_sethsv_noeeprom_springgreen() rgblight_sethsv_noeeprom(HSV_SPRINGGREEN)
-#define rgblight_sethsv_noeeprom_turquoise() rgblight_sethsv_noeeprom(HSV_TURQUOISE)
-#define rgblight_sethsv_noeeprom_teal() rgblight_sethsv_noeeprom(HSV_TEAL)
-#define rgblight_sethsv_noeeprom_cyan() rgblight_sethsv_noeeprom(HSV_CYAN)
-#define rgblight_sethsv_noeeprom_azure() rgblight_sethsv_noeeprom(HSV_AZURE)
-#define rgblight_sethsv_noeeprom_blue() rgblight_sethsv_noeeprom(HSV_BLUE)
-#define rgblight_sethsv_noeeprom_purple() rgblight_sethsv_noeeprom(HSV_PURPLE)
-#define rgblight_sethsv_noeeprom_magenta() rgblight_sethsv_noeeprom(HSV_MAGENTA)
-#define rgblight_sethsv_noeeprom_pink() rgblight_sethsv_noeeprom(HSV_PINK)
-
-/* SET HSV List */
-#define rgblight_sethsv_white_at(at) rgblight_sethsv_at(HSV_WHITE, at)
-#define rgblight_sethsv_red_at(at) rgblight_sethsv_at(HSV_RED, at)
-#define rgblight_sethsv_coral_at(at) rgblight_sethsv_at(HSV_CORAL, at)
-#define rgblight_sethsv_orange_at(at) rgblight_sethsv_at(HSV_ORANGE, at)
-#define rgblight_sethsv_goldenrod_at(at) rgblight_sethsv_at(HSV_GOLDENROD, at)
-#define rgblight_sethsv_gold_at(at) rgblight_sethsv_at(HSV_GOLD, at)
-#define rgblight_sethsv_yellow_at(at) rgblight_sethsv_at(HSV_YELLOW, at)
-#define rgblight_sethsv_chartreuse_at(at) rgblight_sethsv_at(HSV_CHARTREUSE, at)
-#define rgblight_sethsv_green_at(at) rgblight_sethsv_at(HSV_GREEN, at)
-#define rgblight_sethsv_springgreen_at(at) rgblight_sethsv_at(HSV_SPRINGGREEN, at)
-#define rgblight_sethsv_turquoise_at(at) rgblight_sethsv_at(HSV_TURQUOISE, at)
-#define rgblight_sethsv_teal_at(at) rgblight_sethsv_at(HSV_TEAL, at)
-#define rgblight_sethsv_cyan_at(at) rgblight_sethsv_at(HSV_CYAN, at)
-#define rgblight_sethsv_azure_at(at) rgblight_sethsv_at(HSV_AZURE, at)
-#define rgblight_sethsv_blue_at(at) rgblight_sethsv_at(HSV_BLUE, at)
-#define rgblight_sethsv_purple_at(at) rgblight_sethsv_at(HSV_PURPLE, at)
-#define rgblight_sethsv_magenta_at(at) rgblight_sethsv_at(HSV_MAGENTA, at)
-#define rgblight_sethsv_pink_at(at) rgblight_sethsv_at(HSV_PINK, at)
--
cgit v1.2.3
From 9c74fd14bc9777ec45cc93fa57bf83ab17b988db Mon Sep 17 00:00:00 2001
From: Chris Cullin
Date: Tue, 13 Jul 2021 01:51:23 +1000
Subject: Enable g_is31_leds PROGMEM for RGB Matrix IS31FL3737 driver (#13480)
---
docs/feature_rgb_matrix.md | 2 +-
drivers/issi/is31fl3737.c | 9 +++++++--
keyboards/mt84/mt84.c | 40 ++++++++++++++++++++--------------------
keyboards/planck/ez/ez.c | 2 +-
tmk_core/common/progmem.h | 1 +
5 files changed, 30 insertions(+), 24 deletions(-)
(limited to 'docs/feature_rgb_matrix.md')
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 675b7a1be0..be763ee025 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
diff --git a/drivers/issi/is31fl3737.c b/drivers/issi/is31fl3737.c
index 8647c93cc1..e40bfa0d79 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)
@@ -153,7 +154,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];
+ // copy the led config from progmem to SRAM
+ 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 +172,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];
+ // copy the led config from progmem to SRAM
+ 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;
diff --git a/keyboards/mt84/mt84.c b/keyboards/mt84/mt84.c
index d9f509e14d..e15a1ff951 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 8c498a5520..818dc66587 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
diff --git a/tmk_core/common/progmem.h b/tmk_core/common/progmem.h
index 4e4771e523..3a7a169682 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*
--
cgit v1.2.3
From 70267b35c357f2744262300db03eafe642159734 Mon Sep 17 00:00:00 2001
From: Chris Cullin
Date: Fri, 16 Jul 2021 07:52:05 +1000
Subject: Dual RGB Matrix IS31FL3737 driver support to address #13442 (#13457)
* initial commit
* removed changes to write_pwm_buffer
* backward compatbility added
* fixed issue with backward compatibility
* documentation update
* removed unneccessary comment. branched from master
* updated per comments #13457
* removed blank line
* cformat on diff files---
docs/feature_rgb_matrix.md | 25 +++++++++++++++----
drivers/issi/is31fl3737.c | 43 ++++++++++++++++-----------------
quantum/rgb_matrix/rgb_matrix_drivers.c | 15 ++++++++++--
3 files changed, 54 insertions(+), 29 deletions(-)
(limited to 'docs/feature_rgb_matrix.md')
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index be763ee025..f3e25f2f13 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -145,9 +145,22 @@ There is basic support for addressable RGB matrix lighting with the I2C IS31FL37
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = IS31FL3737
```
+You can use between 1 and 2 IS31FL3737 IC's. Do not specify `DRIVER_ADDR_2` define for second IC if not present on your keyboard.
Configure the hardware via your `config.h`:
+| Variable | Description | Default |
+|----------|-------------|---------|
+| `ISSI_TIMEOUT` | (Optional) How long to wait for i2c messages, in milliseconds | 100 |
+| `ISSI_PERSISTENCE` | (Optional) Retry failed messages this many times | 0 |
+| `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | |
+| `DRIVER_LED_TOTAL` | (Required) How many RGB lights are present across all drivers | |
+| `DRIVER_ADDR_1` | (Required) Address for the first RGB driver | |
+| `DRIVER_ADDR_2` | (Optional) Address for the second RGB driver | |
+
+
+Here is an example using 2 drivers.
+
```c
// 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)
@@ -159,14 +172,16 @@ Configure the hardware via your `config.h`:
// ADDR represents A3:A0 of the 7-bit address.
// The result is: 0b101(ADDR)
#define DRIVER_ADDR_1 0b1010000
-#define DRIVER_ADDR_2 0b1010000 // this is here for compliancy reasons.
+#define DRIVER_ADDR_2 0b1010001
#define DRIVER_COUNT 2
-#define DRIVER_1_LED_TOTAL 64
-#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL
+#define DRIVER_1_LED_TOTAL 30
+#define DRIVER_2_LED_TOTAL 36
+#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
```
+!> Note the parentheses, this is so when `DRIVER_LED_TOTAL` is used in code and expanded, the values are added together before any additional math is applied to them. As an example, `rand() % (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)` will give very different results than `rand() % DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL`.
-Currently only a single drivers is supported, but it would be trivial to support all 4 combinations. For now define `DRIVER_ADDR_2` as `DRIVER_ADDR_1`
+Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations.
Define these arrays listing all the LEDs in your `.c`:
@@ -183,7 +198,7 @@ const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = {
}
```
-Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3737.pdf) and the header file `drivers/issi/is31fl3737.h`. The `driver` is the index of the driver you defined in your `config.h` (Only `0` right now).
+Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3737.pdf) and the header file `drivers/issi/is31fl3737.h`. The `driver` is the index of the driver you defined in your `config.h` (Only `0`, `1` for now).
---
diff --git a/drivers/issi/is31fl3737.c b/drivers/issi/is31fl3737.c
index e40bfa0d79..30906b4840 100644
--- a/drivers/issi/is31fl3737.c
+++ b/drivers/issi/is31fl3737.c
@@ -66,11 +66,12 @@ uint8_t g_twi_transfer_buffer[20];
// We could optimize this and take out the unused registers from these
// buffers and the transfers in IS31FL3737_write_pwm_buffer() but it's
// probably not worth the extra complexity.
+
uint8_t g_pwm_buffer[DRIVER_COUNT][192];
-bool g_pwm_buffer_update_required = false;
+bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
-uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}};
-bool g_led_control_registers_update_required = false;
+uint8_t g_led_control_registers[DRIVER_COUNT][24] = {0};
+bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
g_twi_transfer_buffer[0] = reg;
@@ -158,10 +159,10 @@ void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
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;
- g_pwm_buffer[led.driver][led.b] = blue;
- g_pwm_buffer_update_required = true;
+ g_pwm_buffer[led.driver][led.r] = red;
+ g_pwm_buffer[led.driver][led.g] = green;
+ g_pwm_buffer[led.driver][led.b] = blue;
+ g_pwm_buffer_update_required[led.driver] = true;
}
}
@@ -199,30 +200,28 @@ void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bo
g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b);
}
- g_led_control_registers_update_required = true;
+ g_led_control_registers_update_required[led.driver] = true;
}
-void IS31FL3737_update_pwm_buffers(uint8_t addr1, uint8_t addr2) {
- if (g_pwm_buffer_update_required) {
+void IS31FL3737_update_pwm_buffers(uint8_t addr, uint8_t index) {
+ if (g_pwm_buffer_update_required[index]) {
// Firstly we need to unlock the command register and select PG1
- IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
- IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
+ IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+ IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
- IS31FL3737_write_pwm_buffer(addr1, g_pwm_buffer[0]);
- // IS31FL3737_write_pwm_buffer(addr2, g_pwm_buffer[1]);
+ IS31FL3737_write_pwm_buffer(addr, g_pwm_buffer[index]);
}
- g_pwm_buffer_update_required = false;
+ g_pwm_buffer_update_required[index] = false;
}
-void IS31FL3737_update_led_control_registers(uint8_t addr1, uint8_t addr2) {
- if (g_led_control_registers_update_required) {
+void IS31FL3737_update_led_control_registers(uint8_t addr, uint8_t index) {
+ if (g_led_control_registers_update_required[index]) {
// Firstly we need to unlock the command register and select PG0
- IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
- IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
+ IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+ IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
for (int i = 0; i < 24; i++) {
- IS31FL3737_write_register(addr1, i, g_led_control_registers[0][i]);
- // IS31FL3737_write_register(addr2, i, g_led_control_registers[1][i]);
+ IS31FL3737_write_register(addr, i, g_led_control_registers[index][i]);
}
- g_led_control_registers_update_required = false;
}
+ g_led_control_registers_update_required[index] = false;
}
diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c
index 6a11d4791e..dfdf452190 100644
--- a/quantum/rgb_matrix/rgb_matrix_drivers.c
+++ b/quantum/rgb_matrix/rgb_matrix_drivers.c
@@ -65,6 +65,9 @@ static void init(void) {
# endif
# elif defined(IS31FL3737)
IS31FL3737_init(DRIVER_ADDR_1);
+# if defined(DRIVER_ADDR_2) && (DRIVER_ADDR_2 != DRIVER_ADDR_1) // provides backward compatibility
+ IS31FL3737_init(DRIVER_ADDR_2);
+# endif
# else
IS31FL3741_init(DRIVER_ADDR_1);
# endif
@@ -105,7 +108,10 @@ static void init(void) {
IS31FL3733_update_led_control_registers(DRIVER_ADDR_4, 3);
# endif
# elif defined(IS31FL3737)
- IS31FL3737_update_led_control_registers(DRIVER_ADDR_1, DRIVER_ADDR_2);
+ IS31FL3737_update_led_control_registers(DRIVER_ADDR_1, 0);
+# if defined(DRIVER_ADDR_2) && (DRIVER_ADDR_2 != DRIVER_ADDR_1) // provides backward compatibility
+ IS31FL3737_update_led_control_registers(DRIVER_ADDR_2, 1);
+# endif
# else
IS31FL3741_update_led_control_registers(DRIVER_ADDR_1, 0);
# endif
@@ -152,7 +158,12 @@ const rgb_matrix_driver_t rgb_matrix_driver = {
.set_color_all = IS31FL3733_set_color_all,
};
# elif defined(IS31FL3737)
-static void flush(void) { IS31FL3737_update_pwm_buffers(DRIVER_ADDR_1, DRIVER_ADDR_2); }
+static void flush(void) {
+ IS31FL3737_update_pwm_buffers(DRIVER_ADDR_1, 0);
+# if defined(DRIVER_ADDR_2) && (DRIVER_ADDR_2 != DRIVER_ADDR_1) // provides backward compatibility
+ IS31FL3737_update_pwm_buffers(DRIVER_ADDR_2, 1);
+# endif
+}
const rgb_matrix_driver_t rgb_matrix_driver = {
.init = init,
--
cgit v1.2.3
From 0b95ac2e4b29a663258aee475a70a3200d113ac2 Mon Sep 17 00:00:00 2001
From: Drashna Jaelre
Date: Sat, 24 Jul 2021 12:17:04 -0700
Subject: Clean up remaining RGB_DISABLE_WHEN_USB_SUSPENDED defines (#13689)
---
docs/feature_led_matrix.md | 29 +--------------------
docs/feature_rgb_matrix.md | 27 -------------------
keyboards/bastardkb/scylla/config.h | 4 +--
keyboards/bastardkb/tbkmini/config.h | 4 +--
keyboards/boardsource/the_mark/config.h | 8 +++---
keyboards/crkbd/keymaps/davidrambo/config.h | 4 +--
keyboards/durgod/dgk6x/config.h | 18 ++++++-------
keyboards/dztech/dz60rgb/v2_1/config.h | 4 +--
keyboards/dztech/dz65rgb/v3/config.h | 24 ++++++++---------
.../handwired/tractyl_manuform/4x6_right/config.h | 2 +-
keyboards/latin6rgb/config.h | 30 +++++++++++-----------
keyboards/planck/rev6/config.h | 4 +--
keyboards/rgbkb/mun/config.h | 2 +-
keyboards/rgbkb/mun/keymaps/default/config.h | 4 +--
keyboards/rgbkb/mun/keymaps/xulkal2/config.h | 4 +--
keyboards/sawnsprojects/satxri6key/config.h | 4 +--
keyboards/xbows/knight/config.h | 5 ++--
keyboards/xbows/knight_plus/config.h | 5 ++--
keyboards/xbows/numpad/config.h | 5 ++--
keyboards/xelus/pachi/rgb/config.h | 2 +-
20 files changed, 64 insertions(+), 125 deletions(-)
(limited to 'docs/feature_rgb_matrix.md')
diff --git a/docs/feature_led_matrix.md b/docs/feature_led_matrix.md
index 5134ab6efa..018da43dd1 100644
--- a/docs/feature_led_matrix.md
+++ b/docs/feature_led_matrix.md
@@ -262,7 +262,7 @@ For inspiration and examples, check out the built-in effects under `quantum/led_
#define LED_MATRIX_FRAMEBUFFER_EFFECTS // enable framebuffer effects
#define LED_DISABLE_TIMEOUT 0 // number of milliseconds to wait until led automatically turns off
#define LED_DISABLE_AFTER_TIMEOUT 0 // OBSOLETE: number of ticks to wait until disabling effects
-#define LED_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended
+#define LED_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
#define LED_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
#define LED_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
#define LED_MATRIX_MAXIMUM_BRIGHTNESS 255 // limits maximum brightness of LEDs
@@ -350,30 +350,3 @@ void led_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
LED_MATRIX_INDICATOR_SET_VALUE(index, value);
}
```
-
-## Suspended State :id=suspended-state
-To use the suspend feature, make sure that `#define LED_DISABLE_WHEN_USB_SUSPENDED true` is added to the `config.h` file.
-
-Additionally add this to your `.c`:
-
-```c
-void suspend_power_down_kb(void) {
- led_matrix_set_suspend_state(true);
- suspend_power_down_user();
-}
-
-void suspend_wakeup_init_kb(void) {
- led_matrix_set_suspend_state(false);
- suspend_wakeup_init_user();
-}
-```
-or add this to your `keymap.c`:
-```c
-void suspend_power_down_user(void) {
- led_matrix_set_suspend_state(true);
-}
-
-void suspend_wakeup_init_user(void) {
- led_matrix_set_suspend_state(false);
-}
-```
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index f3e25f2f13..bd47fb6d39 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -741,30 +741,3 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
}
}
```
-
-### Suspended state :id=suspended-state
-To use the suspend feature, make sure that `#define RGB_DISABLE_WHEN_USB_SUSPENDED true` is added to the `config.h` file.
-
-Additionally add this to your `.c`:
-
-```c
-void suspend_power_down_kb(void) {
- rgb_matrix_set_suspend_state(true);
- suspend_power_down_user();
-}
-
-void suspend_wakeup_init_kb(void) {
- rgb_matrix_set_suspend_state(false);
- suspend_wakeup_init_user();
-}
-```
-or add this to your `keymap.c`:
-```c
-void suspend_power_down_user(void) {
- rgb_matrix_set_suspend_state(true);
-}
-
-void suspend_wakeup_init_user(void) {
- rgb_matrix_set_suspend_state(false);
-}
-```
diff --git a/keyboards/bastardkb/scylla/config.h b/keyboards/bastardkb/scylla/config.h
index 2a4972ea1e..d04dcb97fc 100644
--- a/keyboards/bastardkb/scylla/config.h
+++ b/keyboards/bastardkb/scylla/config.h
@@ -52,8 +52,6 @@
# define RGB_MATRIX_SPLIT { 29, 29 }
# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 50
# define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS
-# ifndef RGB_DISABLE_WHEN_USB_SUSPENDED
-# define RGB_DISABLE_WHEN_USB_SUSPENDED true
-# endif
+# define RGB_DISABLE_WHEN_USB_SUSPENDED
# define RGB_MATRIX_KEYPRESSES
#endif
diff --git a/keyboards/bastardkb/tbkmini/config.h b/keyboards/bastardkb/tbkmini/config.h
index adda761744..a09dafe488 100644
--- a/keyboards/bastardkb/tbkmini/config.h
+++ b/keyboards/bastardkb/tbkmini/config.h
@@ -53,8 +53,6 @@
# define RGB_MATRIX_SPLIT { 21, 21 }
# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 50
# define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS
-# ifndef RGB_DISABLE_WHEN_USB_SUSPENDED
-# define RGB_DISABLE_WHEN_USB_SUSPENDED true
-# endif
+# define RGB_DISABLE_WHEN_USB_SUSPENDED
# define RGB_MATRIX_KEYPRESSES
#endif
diff --git a/keyboards/boardsource/the_mark/config.h b/keyboards/boardsource/the_mark/config.h
index 3c78af62b2..cbfe4cd510 100644
--- a/keyboards/boardsource/the_mark/config.h
+++ b/keyboards/boardsource/the_mark/config.h
@@ -56,11 +56,9 @@ along with this program. If not, see .
/* RGB matrix support */
#ifdef RGB_MATRIX_ENABLE
-#define DRIVER_LED_TOTAL 24 // Number of LEDs
-#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200
-# ifndef RGB_DISABLE_WHEN_USB_SUSPENDED
-# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
-# endif
+# define DRIVER_LED_TOTAL 24 // Number of LEDs
+# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200
+# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
#endif
/*
diff --git a/keyboards/crkbd/keymaps/davidrambo/config.h b/keyboards/crkbd/keymaps/davidrambo/config.h
index 25f5f3b22f..82057151d3 100644
--- a/keyboards/crkbd/keymaps/davidrambo/config.h
+++ b/keyboards/crkbd/keymaps/davidrambo/config.h
@@ -41,8 +41,8 @@ along with this program. If not, see .
#define RGB_MATRIX_TYPING_MEATMAP_DECREASE_DELAY_MS 50
// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses)
// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
- #define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
- #define RGB_MATRIX_FRAMEBUFFER_EFFECTS
+# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
+#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
// # define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
// # define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 100 // limits maximum brightness of LEDs to 150 out of 255. Higher may cause the controller to crash.
diff --git a/keyboards/durgod/dgk6x/config.h b/keyboards/durgod/dgk6x/config.h
index 7cd15cfb41..53f824b98e 100644
--- a/keyboards/durgod/dgk6x/config.h
+++ b/keyboards/durgod/dgk6x/config.h
@@ -77,15 +77,15 @@
#define I2C1_TIMINGR_SCLH 0x0cU
#define I2C1_TIMINGR_SCLL 0x22U
-#define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
-#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
-#define RGB_MATRIX_KEYPRESSES
-#define RGB_MATRIX_LED_PROCESS_LIMIT 4
-#define RGB_MATRIX_LED_FLUSH_LIMIT 26
-
-#define DISABLE_RGB_MATRIX_HUE_BREATHING
-#define DISABLE_RGB_MATRIX_HUE_PENDULUM
-#define DISABLE_RGB_MATRIX_HUE_WAVE
+# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
+# define RGB_MATRIX_FRAMEBUFFER_EFFECTS
+# define RGB_MATRIX_KEYPRESSES
+# define RGB_MATRIX_LED_PROCESS_LIMIT 4
+# define RGB_MATRIX_LED_FLUSH_LIMIT 26
+
+# define DISABLE_RGB_MATRIX_HUE_BREATHING
+# define DISABLE_RGB_MATRIX_HUE_PENDULUM
+# define DISABLE_RGB_MATRIX_HUE_WAVE
// This allows VIA to control RGB Matrix settings in the 'Lighting' section.
#define VIA_QMK_RGBLIGHT_ENABLE
diff --git a/keyboards/dztech/dz60rgb/v2_1/config.h b/keyboards/dztech/dz60rgb/v2_1/config.h
index 6928ad50ad..06d504e393 100644
--- a/keyboards/dztech/dz60rgb/v2_1/config.h
+++ b/keyboards/dztech/dz60rgb/v2_1/config.h
@@ -53,7 +53,7 @@
#ifdef RGB_MATRIX_ENABLE
# define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
-# define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
+# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
# define RGB_MATRIX_KEYPRESSES
# define RGB_MATRIX_FRAMEBUFFER_EFFECTS
# define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
@@ -72,7 +72,7 @@
# define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
# define DISABLE_RGB_MATRIX_DIGITAL_RAIN
# define DRIVER_ADDR_1 0b1010000
-# define DRIVER_ADDR_2 0b1010000 // this is here for compliancy reasons.
+# define DRIVER_ADDR_2 0b1010000 // this is here for compliancy reasons.
# define DRIVER_COUNT 2
# define DRIVER_1_LED_TOTAL 63
# define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL
diff --git a/keyboards/dztech/dz65rgb/v3/config.h b/keyboards/dztech/dz65rgb/v3/config.h
index c348e323d4..dbf2f5b3ce 100755
--- a/keyboards/dztech/dz65rgb/v3/config.h
+++ b/keyboards/dztech/dz65rgb/v3/config.h
@@ -42,16 +42,16 @@
#define NO_ACTION_FUNCTION
#ifdef RGB_MATRIX_ENABLE
#define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
-#define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
-#define USB_SUSPEND_WAKEUP_DELAY 5000
-#define RGB_MATRIX_KEYPRESSES
-#define RGB_MATRIX_LED_PROCESS_LIMIT 4
-#define RGB_MATRIX_LED_FLUSH_LIMIT 26
-#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_ALL
-#define DRIVER_ADDR_1 0b0110000
-#define DRIVER_ADDR_2 0b0110000 // this is here for compliancy reasons.
-#define DRIVER_COUNT 1
-#define DRIVER_1_LED_TOTAL 68
-#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL
-#define DRIVER_INDICATOR_LED_TOTAL 0
+# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
+# define USB_SUSPEND_WAKEUP_DELAY 5000
+# define RGB_MATRIX_KEYPRESSES
+# define RGB_MATRIX_LED_PROCESS_LIMIT 4
+# define RGB_MATRIX_LED_FLUSH_LIMIT 26
+# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_ALL
+# define DRIVER_ADDR_1 0b0110000
+# define DRIVER_ADDR_2 0b0110000 // this is here for compliancy reasons.
+# define DRIVER_COUNT 1
+# define DRIVER_1_LED_TOTAL 68
+# define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL
+# define DRIVER_INDICATOR_LED_TOTAL 0
#endif
diff --git a/keyboards/handwired/tractyl_manuform/4x6_right/config.h b/keyboards/handwired/tractyl_manuform/4x6_right/config.h
index 05a1c5f3be..2f29778f33 100644
--- a/keyboards/handwired/tractyl_manuform/4x6_right/config.h
+++ b/keyboards/handwired/tractyl_manuform/4x6_right/config.h
@@ -39,7 +39,7 @@ along with this program. If not, see .
#define RGB_DI_PIN E7
#define DRIVER_LED_TOTAL 62
#define RGB_MATRIX_SPLIT { 32, 30 }
-#define RGB_DISABLE_WHEN_USB_SUSPENDED true
+#define RGB_DISABLE_WHEN_USB_SUSPENDED
#define RGB_MATRIX_KEYPRESSES
// #define RGB_MATRIX_KEYRELEASES
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
diff --git a/keyboards/latin6rgb/config.h b/keyboards/latin6rgb/config.h
index 4052fdc991..174c23c30c 100644
--- a/keyboards/latin6rgb/config.h
+++ b/keyboards/latin6rgb/config.h
@@ -1,18 +1,18 @@
/* Copyright 2021 18438880
- *
- * 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 .
- */
+ *
+ * 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 .
+ */
#pragma once
@@ -57,7 +57,7 @@
#ifdef RGB_MATRIX_ENABLE
# define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
-# define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
+# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
# define RGB_MATRIX_KEYPRESSES
# define RGB_MATRIX_FRAMEBUFFER_EFFECTS
# define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
diff --git a/keyboards/planck/rev6/config.h b/keyboards/planck/rev6/config.h
index 18bb740968..44ae7d277e 100644
--- a/keyboards/planck/rev6/config.h
+++ b/keyboards/planck/rev6/config.h
@@ -140,8 +140,6 @@
#define WS2812_DMA_STREAM STM32_DMA1_STREAM2
#define WS2812_DMA_CHANNEL 2
-#ifndef RGB_DISABLE_WHEN_USB_SUSPENDED
-# define RGB_DISABLE_WHEN_USB_SUSPENDED
-#endif
+#define RGB_DISABLE_WHEN_USB_SUSPENDED
#endif
diff --git a/keyboards/rgbkb/mun/config.h b/keyboards/rgbkb/mun/config.h
index 802672e14d..5d1a2ce202 100644
--- a/keyboards/rgbkb/mun/config.h
+++ b/keyboards/rgbkb/mun/config.h
@@ -86,7 +86,7 @@
#define RGB_MATRIX_LED_PROCESS_LIMIT 10
#define RGB_MATRIX_KEYPRESSES
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
-#define RGB_DISABLE_WHEN_USB_SUSPENDED true
+#define RGB_DISABLE_WHEN_USB_SUSPENDED
#if RGB_UNLIMITED_POWER
#define RGBLIGHT_LIMIT_VAL 255
diff --git a/keyboards/rgbkb/mun/keymaps/default/config.h b/keyboards/rgbkb/mun/keymaps/default/config.h
index 3d9aff94a6..967b309f63 100644
--- a/keyboards/rgbkb/mun/keymaps/default/config.h
+++ b/keyboards/rgbkb/mun/keymaps/default/config.h
@@ -18,8 +18,7 @@
// 20m timeout (20m * 60s * 1000mil)
// #define RGB_DISABLE_TIMEOUT 1200000
-#define RGB_DISABLE_WHEN_USB_SUSPENDED true
-
+#define RGB_DISABLE_WHEN_USB_SUSPENDED
#define VIA_EEPROM_LAYOUT_OPTIONS_SIZE 2
// 224B per layer right now
@@ -29,4 +28,3 @@
#define VIA_QMK_RGBLIGHT_ENABLE
#define STM32_ONBOARD_EEPROM_SIZE 2048
-
diff --git a/keyboards/rgbkb/mun/keymaps/xulkal2/config.h b/keyboards/rgbkb/mun/keymaps/xulkal2/config.h
index f78d0103c1..f36e5760fc 100644
--- a/keyboards/rgbkb/mun/keymaps/xulkal2/config.h
+++ b/keyboards/rgbkb/mun/keymaps/xulkal2/config.h
@@ -30,7 +30,7 @@
// 20m timeout (20m * 60s * 1000mil)
// #define RGB_DISABLE_TIMEOUT 1200000
-#define RGB_DISABLE_WHEN_USB_SUSPENDED true
+#define RGB_DISABLE_WHEN_USB_SUSPENDED
#define OLED_SCROLL_TIMEOUT 20000
#define ONESHOT_TAP_TOGGLE 2
@@ -39,4 +39,4 @@
#define RGB_MATRIX_VAL_STEP 8
#define RGB_MATRIX_SPD_STEP 8
-#define ENCODER_RESOLUTION 2
\ No newline at end of file
+#define ENCODER_RESOLUTION 2
diff --git a/keyboards/sawnsprojects/satxri6key/config.h b/keyboards/sawnsprojects/satxri6key/config.h
index 833fd584eb..129f2536b9 100644
--- a/keyboards/sawnsprojects/satxri6key/config.h
+++ b/keyboards/sawnsprojects/satxri6key/config.h
@@ -71,7 +71,7 @@
#define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses)
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
-#define RGB_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended
+// #define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
#define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255
-#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_REACTIVE_SIMPLE // Sets the default mode, if none has been set
\ No newline at end of file
+#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_REACTIVE_SIMPLE // Sets the default mode, if none has been set
diff --git a/keyboards/xbows/knight/config.h b/keyboards/xbows/knight/config.h
index 540e29d4df..2b15cbbb3f 100644
--- a/keyboards/xbows/knight/config.h
+++ b/keyboards/xbows/knight/config.h
@@ -35,10 +35,11 @@
# define RGB_MATRIX_LED_PROCESS_LIMIT 18
# define RGB_MATRIX_LED_FLUSH_LIMIT 16
# define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
-# define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
+# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
# define RGB_MATRIX_KEYPRESSES
# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200
-# define RGB_MATRIX_CENTER { 92, 43 }
+# define RGB_MATRIX_CENTER \
+ { 92, 43 }
# define DRIVER_ADDR_1 0b1110100
# define DRIVER_ADDR_2 0b1110110
diff --git a/keyboards/xbows/knight_plus/config.h b/keyboards/xbows/knight_plus/config.h
index ead345c04d..6293a6ffb1 100644
--- a/keyboards/xbows/knight_plus/config.h
+++ b/keyboards/xbows/knight_plus/config.h
@@ -36,9 +36,10 @@
# define RGB_MATRIX_LED_FLUSH_LIMIT 16
# define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
# define RGB_MATRIX_KEYPRESSES
-# define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
+# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200
-# define RGB_MATRIX_CENTER { 92, 43 }
+# define RGB_MATRIX_CENTER \
+ { 92, 43 }
# define DRIVER_ADDR_1 0b1110100
# define DRIVER_ADDR_2 0b1110110
diff --git a/keyboards/xbows/numpad/config.h b/keyboards/xbows/numpad/config.h
index fd13305ed9..832da03a2c 100644
--- a/keyboards/xbows/numpad/config.h
+++ b/keyboards/xbows/numpad/config.h
@@ -35,10 +35,11 @@
# define RGB_MATRIX_LED_PROCESS_LIMIT 18
# define RGB_MATRIX_LED_FLUSH_LIMIT 16
# define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
-# define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
+# define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
# define RGB_MATRIX_KEYPRESSES
# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200
-# define RGB_MATRIX_CENTER { 30, 32 }
+# define RGB_MATRIX_CENTER \
+ { 30, 32 }
# define DRIVER_ADDR_1 0b1110111
# define DRIVER_COUNT 1
diff --git a/keyboards/xelus/pachi/rgb/config.h b/keyboards/xelus/pachi/rgb/config.h
index f976508507..9378b2c413 100644
--- a/keyboards/xelus/pachi/rgb/config.h
+++ b/keyboards/xelus/pachi/rgb/config.h
@@ -70,7 +70,7 @@
#define RGB_MATRIX_STARTUP_VAL 80
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_KEYPRESSES
-#define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
+#define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_ALL
#define FORCE_NKRO
--
cgit v1.2.3
From 206a995ccd53b0843e72da606abebe06f39c9c28 Mon Sep 17 00:00:00 2001
From: Joel Challis
Date: Sat, 31 Jul 2021 14:31:09 +0100
Subject: Move some led drivers to common folder (#13749)
* Move some led drivers to common folder---
common_features.mk | 14 +-
docs/feature_led_matrix.md | 2 +-
docs/feature_rgb_matrix.md | 6 +-
docs/ja/feature_led_matrix.md | 2 +-
drivers/apa102/apa102.c | 151 ---------
drivers/apa102/apa102.h | 41 ---
drivers/awinic/aw20216.c | 141 --------
drivers/awinic/aw20216.h | 252 --------------
drivers/issi/is31fl3218.c | 96 ------
drivers/issi/is31fl3218.h | 25 --
drivers/issi/is31fl3731-simple.c | 233 -------------
drivers/issi/is31fl3731-simple.h | 207 ------------
drivers/issi/is31fl3731.c | 237 -------------
drivers/issi/is31fl3731.h | 208 ------------
drivers/issi/is31fl3733.c | 237 -------------
drivers/issi/is31fl3733.h | 251 --------------
drivers/issi/is31fl3736.c | 269 ---------------
drivers/issi/is31fl3736.h | 168 ----------
drivers/issi/is31fl3737.c | 227 -------------
drivers/issi/is31fl3737.h | 203 ------------
drivers/issi/is31fl3741.c | 255 --------------
drivers/issi/is31fl3741.h | 420 ------------------------
drivers/led/apa102.c | 151 +++++++++
drivers/led/apa102.h | 41 +++
drivers/led/aw20216.c | 141 ++++++++
drivers/led/aw20216.h | 252 ++++++++++++++
drivers/led/issi/is31fl3218.c | 96 ++++++
drivers/led/issi/is31fl3218.h | 25 ++
drivers/led/issi/is31fl3731-simple.c | 233 +++++++++++++
drivers/led/issi/is31fl3731-simple.h | 207 ++++++++++++
drivers/led/issi/is31fl3731.c | 237 +++++++++++++
drivers/led/issi/is31fl3731.h | 208 ++++++++++++
drivers/led/issi/is31fl3733.c | 237 +++++++++++++
drivers/led/issi/is31fl3733.h | 251 ++++++++++++++
drivers/led/issi/is31fl3736.c | 269 +++++++++++++++
drivers/led/issi/is31fl3736.h | 168 ++++++++++
drivers/led/issi/is31fl3737.c | 227 +++++++++++++
drivers/led/issi/is31fl3737.h | 203 ++++++++++++
drivers/led/issi/is31fl3741.c | 255 ++++++++++++++
drivers/led/issi/is31fl3741.h | 420 ++++++++++++++++++++++++
keyboards/fallacy/indicators.c | 2 +-
keyboards/fallacy/rules.mk | 2 +-
keyboards/hs60/v2/ansi/rules.mk | 2 +-
keyboards/hs60/v2/hhkb/rules.mk | 2 +-
keyboards/hs60/v2/iso/rules.mk | 2 +-
keyboards/keebwerk/mega/ansi/ansi.c | 2 +-
keyboards/keebwerk/mega/ansi/rules.mk | 2 +-
keyboards/nebula12/rules.mk | 2 +-
keyboards/nebula68/rules.mk | 2 +-
keyboards/nk65/nk65.c | 2 +-
keyboards/nk65/rules.mk | 2 +-
keyboards/nk87/nk87.c | 2 +-
keyboards/nk87/rules.mk | 2 +-
keyboards/tkc/portico/rules.mk | 2 +-
keyboards/wilba_tech/rama_works_kara/rules.mk | 2 +-
keyboards/wilba_tech/rama_works_koyu/rules.mk | 2 +-
keyboards/wilba_tech/rama_works_m10_c/rules.mk | 2 +-
keyboards/wilba_tech/rama_works_m50_a/rules.mk | 2 +-
keyboards/wilba_tech/rama_works_m60_a/rules.mk | 2 +-
keyboards/wilba_tech/rama_works_m65_b/rules.mk | 2 +-
keyboards/wilba_tech/rama_works_m65_bx/rules.mk | 2 +-
keyboards/wilba_tech/rama_works_m6_b/rules.mk | 2 +-
keyboards/wilba_tech/rama_works_u80_a/rules.mk | 2 +-
keyboards/wilba_tech/wt60_a/rules.mk | 2 +-
keyboards/wilba_tech/wt60_b/rules.mk | 2 +-
keyboards/wilba_tech/wt60_bx/rules.mk | 2 +-
keyboards/wilba_tech/wt60_c/rules.mk | 2 +-
keyboards/wilba_tech/wt65_a/rules.mk | 2 +-
keyboards/wilba_tech/wt65_b/rules.mk | 2 +-
keyboards/wilba_tech/wt75_a/rules.mk | 2 +-
keyboards/wilba_tech/wt75_b/rules.mk | 2 +-
keyboards/wilba_tech/wt75_c/rules.mk | 2 +-
keyboards/wilba_tech/wt80_a/rules.mk | 2 +-
keyboards/wilba_tech/wt_mono_backlight.c | 2 +-
keyboards/wilba_tech/wt_rgb_backlight.c | 10 +-
keyboards/wilba_tech/zeal60/rules.mk | 2 +-
keyboards/wilba_tech/zeal65/rules.mk | 2 +-
keyboards/xelus/dawn60/rev1/rules.mk | 2 +-
keyboards/xelus/dawn60/rev1_qmk/rev1_qmk.c | 2 +-
keyboards/xelus/dawn60/rev1_qmk/rules.mk | 2 +-
keyboards/xelus/pachi/rgb/rgb.c | 2 +-
keyboards/xelus/pachi/rgb/rules.mk | 2 +-
82 files changed, 3679 insertions(+), 3679 deletions(-)
delete mode 100644 drivers/apa102/apa102.c
delete mode 100644 drivers/apa102/apa102.h
delete mode 100644 drivers/awinic/aw20216.c
delete mode 100644 drivers/awinic/aw20216.h
delete mode 100644 drivers/issi/is31fl3218.c
delete mode 100644 drivers/issi/is31fl3218.h
delete mode 100644 drivers/issi/is31fl3731-simple.c
delete mode 100644 drivers/issi/is31fl3731-simple.h
delete mode 100644 drivers/issi/is31fl3731.c
delete mode 100644 drivers/issi/is31fl3731.h
delete mode 100644 drivers/issi/is31fl3733.c
delete mode 100644 drivers/issi/is31fl3733.h
delete mode 100644 drivers/issi/is31fl3736.c
delete mode 100644 drivers/issi/is31fl3736.h
delete mode 100644 drivers/issi/is31fl3737.c
delete mode 100644 drivers/issi/is31fl3737.h
delete mode 100644 drivers/issi/is31fl3741.c
delete mode 100644 drivers/issi/is31fl3741.h
create mode 100644 drivers/led/apa102.c
create mode 100644 drivers/led/apa102.h
create mode 100644 drivers/led/aw20216.c
create mode 100644 drivers/led/aw20216.h
create mode 100644 drivers/led/issi/is31fl3218.c
create mode 100644 drivers/led/issi/is31fl3218.h
create mode 100644 drivers/led/issi/is31fl3731-simple.c
create mode 100644 drivers/led/issi/is31fl3731-simple.h
create mode 100644 drivers/led/issi/is31fl3731.c
create mode 100644 drivers/led/issi/is31fl3731.h
create mode 100644 drivers/led/issi/is31fl3733.c
create mode 100644 drivers/led/issi/is31fl3733.h
create mode 100644 drivers/led/issi/is31fl3736.c
create mode 100644 drivers/led/issi/is31fl3736.h
create mode 100644 drivers/led/issi/is31fl3737.c
create mode 100644 drivers/led/issi/is31fl3737.h
create mode 100644 drivers/led/issi/is31fl3741.c
create mode 100644 drivers/led/issi/is31fl3741.h
(limited to 'docs/feature_rgb_matrix.md')
diff --git a/common_features.mk b/common_features.mk
index d8dce8a631..75a9e1f2eb 100644
--- a/common_features.mk
+++ b/common_features.mk
@@ -242,7 +242,7 @@ endif
ifeq ($(strip $(LED_MATRIX_DRIVER)), IS31FL3731)
OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/issi
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
SRC += is31fl3731-simple.c
QUANTUM_LIB_SRC += i2c_master.c
endif
@@ -272,35 +272,35 @@ endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), AW20216)
OPT_DEFS += -DAW20216 -DSTM32_SPI -DHAL_USE_SPI=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/awinic
+ COMMON_VPATH += $(DRIVER_PATH)/led
SRC += aw20216.c
QUANTUM_LIB_SRC += spi_master.c
endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3731)
OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/issi
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
SRC += is31fl3731.c
QUANTUM_LIB_SRC += i2c_master.c
endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3733)
OPT_DEFS += -DIS31FL3733 -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/issi
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
SRC += is31fl3733.c
QUANTUM_LIB_SRC += i2c_master.c
endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3737)
OPT_DEFS += -DIS31FL3737 -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/issi
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
SRC += is31fl3737.c
QUANTUM_LIB_SRC += i2c_master.c
endif
ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3741)
OPT_DEFS += -DIS31FL3741 -DSTM32_I2C -DHAL_USE_I2C=TRUE
- COMMON_VPATH += $(DRIVER_PATH)/issi
+ COMMON_VPATH += $(DRIVER_PATH)/led/issi
SRC += is31fl3741.c
QUANTUM_LIB_SRC += i2c_master.c
endif
@@ -417,7 +417,7 @@ ifeq ($(strip $(WS2812_DRIVER_REQUIRED)), yes)
endif
ifeq ($(strip $(APA102_DRIVER_REQUIRED)), yes)
- COMMON_VPATH += $(DRIVER_PATH)/apa102
+ COMMON_VPATH += $(DRIVER_PATH)/led
SRC += apa102.c
endif
diff --git a/docs/feature_led_matrix.md b/docs/feature_led_matrix.md
index 018da43dd1..afa11e7232 100644
--- a/docs/feature_led_matrix.md
+++ b/docs/feature_led_matrix.md
@@ -63,7 +63,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
}
```
-Where `Cx_y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3731.pdf) and the header file `drivers/issi/is31fl3731-simple.h`. The `driver` is the index of the driver you defined in your `config.h` (`0`, `1`, `2`, or `3` ).
+Where `Cx_y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3731.pdf) and the header file `drivers/led/issi/is31fl3731-simple.h`. The `driver` is the index of the driver you defined in your `config.h` (`0`, `1`, `2`, or `3` ).
---
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index bd47fb6d39..18e38955ec 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -64,7 +64,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
}
```
-Where `Cx_y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3731.pdf) and the header file `drivers/issi/is31fl3731.h`. The `driver` is the index of the driver you defined in your `config.h` (`0`, `1`, `2`, or `3`).
+Where `Cx_y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3731.pdf) and the header file `drivers/led/issi/is31fl3731.h`. The `driver` is the index of the driver you defined in your `config.h` (`0`, `1`, `2`, or `3`).
---
### IS31FL3733 :id=is31fl3733
@@ -134,7 +134,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
}
```
-Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3733.pdf) and the header file `drivers/issi/is31fl3733.h`. The `driver` is the index of the driver you defined in your `config.h` (`0`, `1`, `2`, or `3` for now).
+Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3733.pdf) and the header file `drivers/led/issi/is31fl3733.h`. The `driver` is the index of the driver you defined in your `config.h` (`0`, `1`, `2`, or `3` for now).
---
### IS31FL3737 :id=is31fl3737
@@ -198,7 +198,7 @@ const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = {
}
```
-Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3737.pdf) and the header file `drivers/issi/is31fl3737.h`. The `driver` is the index of the driver you defined in your `config.h` (Only `0`, `1` for now).
+Where `X_Y` is the location of the LED in the matrix defined by [the datasheet](https://www.issi.com/WW/pdf/31FL3737.pdf) and the header file `drivers/led/issi/is31fl3737.h`. The `driver` is the index of the driver you defined in your `config.h` (Only `0`, `1` for now).
---
diff --git a/docs/ja/feature_led_matrix.md b/docs/ja/feature_led_matrix.md
index 62e22859fb..f132d716f6 100644
--- a/docs/ja/feature_led_matrix.md
+++ b/docs/ja/feature_led_matrix.md
@@ -61,7 +61,7 @@ I2C IS31FL3731 RGB コントローラを使ったアドレス指定可能な LED
....
}
-ここで、`Cx_y` は[データシート](https://www.issi.com/WW/pdf/31FL3731.pdf)およびヘッダファイル `drivers/issi/is31fl3731-simple.h` で定義されるマトリックス内の LED の位置です。`driver` は `config.h` で定義したドライバのインデックス(`0`、`1`、`2`、`3`のいずれか)です。
+ここで、`Cx_y` は[データシート](https://www.issi.com/WW/pdf/31FL3731.pdf)およびヘッダファイル `drivers/led/issi/is31fl3731-simple.h` で定義されるマトリックス内の LED の位置です。`driver` は `config.h` で定義したドライバのインデックス(`0`、`1`、`2`、`3`のいずれか)です。
## キーコード
diff --git a/drivers/apa102/apa102.c b/drivers/apa102/apa102.c
deleted file mode 100644
index 7396dc3c55..0000000000
--- a/drivers/apa102/apa102.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* Copyright 2020 Aldehir Rojas
- * Copyright 2017 Mikkel (Duckle29)
- *
- * 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 "apa102.h"
-#include "quantum.h"
-
-#ifndef APA102_NOPS
-# if defined(__AVR__)
-# define APA102_NOPS 0 // AVR at 16 MHz already spends 62.5 ns per clock, so no extra delay is needed
-# elif defined(PROTOCOL_CHIBIOS)
-
-# include "hal.h"
-# if defined(STM32F0XX) || defined(STM32F1XX) || defined(STM32F3XX) || defined(STM32F4XX) || defined(STM32L0XX)
-# define APA102_NOPS (100 / (1000000000L / (STM32_SYSCLK / 4))) // This calculates how many loops of 4 nops to run to delay 100 ns
-# else
-# error("APA102_NOPS configuration required")
-# define APA102_NOPS 0 // this just pleases the compile so the above error is easier to spot
-# endif
-# endif
-#endif
-
-#define io_wait \
- do { \
- for (int i = 0; i < APA102_NOPS; i++) { \
- __asm__ volatile("nop\n\t" \
- "nop\n\t" \
- "nop\n\t" \
- "nop\n\t"); \
- } \
- } while (0)
-
-#define APA102_SEND_BIT(byte, bit) \
- do { \
- writePin(RGB_DI_PIN, (byte >> bit) & 1); \
- io_wait; \
- writePinHigh(RGB_CI_PIN); \
- io_wait; \
- writePinLow(RGB_CI_PIN); \
- io_wait; \
- } while (0)
-
-uint8_t apa102_led_brightness = APA102_DEFAULT_BRIGHTNESS;
-
-void static apa102_start_frame(void);
-void static apa102_end_frame(uint16_t num_leds);
-
-void static apa102_send_frame(uint8_t red, uint8_t green, uint8_t blue, uint8_t brightness);
-void static apa102_send_byte(uint8_t byte);
-
-void apa102_setleds(LED_TYPE *start_led, uint16_t num_leds) {
- LED_TYPE *end = start_led + num_leds;
-
- apa102_start_frame();
- for (LED_TYPE *led = start_led; led < end; led++) {
- apa102_send_frame(led->r, led->g, led->b, apa102_led_brightness);
- }
- apa102_end_frame(num_leds);
-}
-
-// Overwrite the default rgblight_call_driver to use apa102 driver
-void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { apa102_setleds(start_led, num_leds); }
-
-void static apa102_init(void) {
- setPinOutput(RGB_DI_PIN);
- setPinOutput(RGB_CI_PIN);
-
- writePinLow(RGB_DI_PIN);
- writePinLow(RGB_CI_PIN);
-}
-
-void apa102_set_brightness(uint8_t brightness) {
- if (brightness > APA102_MAX_BRIGHTNESS) {
- apa102_led_brightness = APA102_MAX_BRIGHTNESS;
- } else if (brightness < 0) {
- apa102_led_brightness = 0;
- } else {
- apa102_led_brightness = brightness;
- }
-}
-
-void static apa102_send_frame(uint8_t red, uint8_t green, uint8_t blue, uint8_t brightness) {
- apa102_send_byte(0b11100000 | brightness);
- apa102_send_byte(blue);
- apa102_send_byte(green);
- apa102_send_byte(red);
-}
-
-void static apa102_start_frame(void) {
- apa102_init();
- for (uint16_t i = 0; i < 4; i++) {
- apa102_send_byte(0);
- }
-}
-
-void static apa102_end_frame(uint16_t num_leds) {
- // This function has been taken from: https://github.com/pololu/apa102-arduino/blob/master/APA102.h
- // and adapted. The code is MIT licensed. I think thats compatible?
- //
- // The data stream seen by the last LED in the chain will be delayed by
- // (count - 1) clock edges, because each LED before it inverts the clock
- // line and delays the data by one clock edge. Therefore, to make sure
- // the last LED actually receives the data we wrote, the number of extra
- // edges we send at the end of the frame must be at least (count - 1).
- //
- // Assuming we only want to send these edges in groups of size K, the
- // C/C++ expression for the minimum number of groups to send is:
- //
- // ((count - 1) + (K - 1)) / K
- //
- // The C/C++ expression above is just (count - 1) divided by K,
- // rounded up to the nearest whole number if there is a remainder.
- //
- // We set K to 16 and use the formula above as the number of frame-end
- // bytes to transfer. Each byte has 16 clock edges.
- //
- // We are ignoring the specification for the end frame in the APA102
- // datasheet, which says to send 0xFF four times, because it does not work
- // when you have 66 LEDs or more, and also it results in unwanted white
- // pixels if you try to update fewer LEDs than are on your LED strip.
- uint16_t iterations = (num_leds + 14) / 16;
- for (uint16_t i = 0; i < iterations; i++) {
- apa102_send_byte(0);
- }
-
- apa102_init();
-}
-
-void static apa102_send_byte(uint8_t byte) {
- APA102_SEND_BIT(byte, 7);
- APA102_SEND_BIT(byte, 6);
- APA102_SEND_BIT(byte, 5);
- APA102_SEND_BIT(byte, 4);
- APA102_SEND_BIT(byte, 3);
- APA102_SEND_BIT(byte, 2);
- APA102_SEND_BIT(byte, 1);
- APA102_SEND_BIT(byte, 0);
-}
diff --git a/drivers/apa102/apa102.h b/drivers/apa102/apa102.h
deleted file mode 100644
index 58cf020c1e..0000000000
--- a/drivers/apa102/apa102.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright 2020 Aldehir Rojas
- * Copyright 2017 Mikkel (Duckle29)
- *
- * 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 .
- */
-
-#pragma once
-
-#include "color.h"
-
-#ifndef APA102_DEFAULT_BRIGHTNESS
-# define APA102_DEFAULT_BRIGHTNESS 31
-#endif
-
-#define APA102_MAX_BRIGHTNESS 31
-
-extern uint8_t apa102_led_brightness;
-
-/* User Interface
- *
- * Input:
- * start_led: An array of GRB data describing the LED colors
- * num_leds: The number of LEDs to write
- *
- * The functions will perform the following actions:
- * - Set the data-out pin as output
- * - Send out the LED data
- */
-void apa102_setleds(LED_TYPE *start_led, uint16_t num_leds);
-void apa102_set_brightness(uint8_t brightness);
diff --git a/drivers/awinic/aw20216.c b/drivers/awinic/aw20216.c
deleted file mode 100644
index c608c0ab44..0000000000
--- a/drivers/awinic/aw20216.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* Copyright 2021 Jasper Chan
- *
- * 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 "aw20216.h"
-#include "spi_master.h"
-
-/* The AW20216 appears to be somewhat similar to the IS31FL743, although quite
- * a few things are different, such as the command byte format and page ordering.
- * The LED addresses start from 0x00 instead of 0x01.
- */
-#define AWINIC_ID 0b1010 << 4
-
-#define AW_PAGE_FUNCTION 0x00 << 1 // PG0, Function registers
-#define AW_PAGE_PWM 0x01 << 1 // PG1, LED PWM control
-#define AW_PAGE_SCALING 0x02 << 1 // PG2, LED current scaling control
-#define AW_PAGE_PATCHOICE 0x03 << 1 // PG3, Pattern choice?
-#define AW_PAGE_PWMSCALING 0x04 << 1 // PG4, LED PWM + Scaling control?
-
-#define AW_WRITE 0
-#define AW_READ 1
-
-#define AW_REG_CONFIGURATION 0x00 // PG0
-#define AW_REG_GLOBALCURRENT 0x01 // PG0
-
-// Default value of AW_REG_CONFIGURATION
-// D7:D4 = 1011, SWSEL (SW1~SW12 active)
-// D3 = 0?, reserved (apparently this should be 1 but it doesn't seem to matter)
-// D2:D1 = 00, OSDE (open/short detection enable)
-// D0 = 0, CHIPEN (write 1 to enable LEDs when hardware enable pulled high)
-#define AW_CONFIG_DEFAULT 0b10110000
-#define AW_CHIPEN 1
-
-#define AW_PWM_REGISTER_COUNT 216
-
-#ifndef AW_SCALING_MAX
-# define AW_SCALING_MAX 150
-#endif
-
-#ifndef AW_GLOBAL_CURRENT_MAX
-# define AW_GLOBAL_CURRENT_MAX 150
-#endif
-
-#ifndef AW_SPI_DIVISOR
-# define AW_SPI_DIVISOR 4
-#endif
-
-uint8_t g_pwm_buffer[DRIVER_COUNT][AW_PWM_REGISTER_COUNT];
-bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
-
-bool AW20216_write(pin_t cs_pin, uint8_t page, uint8_t reg, uint8_t* data, uint8_t len) {
- static uint8_t s_spi_transfer_buffer[2] = {0};
-
- if (!spi_start(cs_pin, false, 0, AW_SPI_DIVISOR)) {
- spi_stop();
- return false;
- }
-
- s_spi_transfer_buffer[0] = (AWINIC_ID | page | AW_WRITE);
- s_spi_transfer_buffer[1] = reg;
-
- if (spi_transmit(s_spi_transfer_buffer, 2) != SPI_STATUS_SUCCESS) {
- spi_stop();
- return false;
- }
-
- if (spi_transmit(data, len) != SPI_STATUS_SUCCESS) {
- spi_stop();
- return false;
- }
-
- spi_stop();
- return true;
-}
-
-static inline bool AW20216_write_register(pin_t cs_pin, uint8_t page, uint8_t reg, uint8_t value) {
- // Little wrapper so callers need not care about sending a buffer
- return AW20216_write(cs_pin, page, reg, &value, 1);
-}
-
-static void AW20216_init_scaling(pin_t cs_pin) {
- // Set constant current to the max, control brightness with PWM
- for (uint8_t i = 0; i < AW_PWM_REGISTER_COUNT; i++) {
- AW20216_write_register(cs_pin, AW_PAGE_SCALING, i, AW_SCALING_MAX);
- }
-}
-
-static inline void AW20216_init_current_limit(pin_t cs_pin) {
- // Push config
- AW20216_write_register(cs_pin, AW_PAGE_FUNCTION, AW_REG_GLOBALCURRENT, AW_GLOBAL_CURRENT_MAX);
-}
-
-static inline void AW20216_soft_enable(pin_t cs_pin) {
- // Push config
- AW20216_write_register(cs_pin, AW_PAGE_FUNCTION, AW_REG_CONFIGURATION, AW_CONFIG_DEFAULT | AW_CHIPEN);
-}
-
-void AW20216_init(pin_t cs_pin, pin_t en_pin) {
- setPinOutput(en_pin);
- writePinHigh(en_pin);
-
- // Drivers should start with all scaling and PWM registers as off
- AW20216_init_current_limit(cs_pin);
- AW20216_init_scaling(cs_pin);
-
- AW20216_soft_enable(cs_pin);
-}
-
-void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
- aw_led led = g_aw_leds[index];
-
- g_pwm_buffer[led.driver][led.r] = red;
- g_pwm_buffer[led.driver][led.g] = green;
- g_pwm_buffer[led.driver][led.b] = blue;
- g_pwm_buffer_update_required[led.driver] = true;
-}
-
-void AW20216_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
- for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
- AW20216_set_color(i, red, green, blue);
- }
-}
-
-void AW20216_update_pwm_buffers(pin_t cs_pin, uint8_t index) {
- if (g_pwm_buffer_update_required[index]) {
- AW20216_write(cs_pin, AW_PAGE_PWM, 0, g_pwm_buffer[index], AW_PWM_REGISTER_COUNT);
- }
- g_pwm_buffer_update_required[index] = false;
-}
diff --git a/drivers/awinic/aw20216.h b/drivers/awinic/aw20216.h
deleted file mode 100644
index c55d9605fc..0000000000
--- a/drivers/awinic/aw20216.h
+++ /dev/null
@@ -1,252 +0,0 @@
-/* Copyright 2021 Jasper Chan (Gigahawk)
- *
- * 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 .
- */
-
-#pragma once
-
-#include
-#include
-#include "gpio.h"
-
-typedef struct aw_led {
- uint8_t driver : 2;
- uint8_t r;
- uint8_t g;
- uint8_t b;
-} aw_led;
-
-extern const aw_led g_aw_leds[DRIVER_LED_TOTAL];
-
-void AW20216_init(pin_t cs_pin, pin_t en_pin);
-void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
-void AW20216_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
-void AW20216_update_pwm_buffers(pin_t cs_pin, uint8_t index);
-
-#define CS1_SW1 0x00
-#define CS2_SW1 0x01
-#define CS3_SW1 0x02
-#define CS4_SW1 0x03
-#define CS5_SW1 0x04
-#define CS6_SW1 0x05
-#define CS7_SW1 0x06
-#define CS8_SW1 0x07
-#define CS9_SW1 0x08
-#define CS10_SW1 0x09
-#define CS11_SW1 0x0A
-#define CS12_SW1 0x0B
-#define CS13_SW1 0x0C
-#define CS14_SW1 0x0D
-#define CS15_SW1 0x0E
-#define CS16_SW1 0x0F
-#define CS17_SW1 0x10
-#define CS18_SW1 0x11
-#define CS1_SW2 0x12
-#define CS2_SW2 0x13
-#define CS3_SW2 0x14
-#define CS4_SW2 0x15
-#define CS5_SW2 0x16
-#define CS6_SW2 0x17
-#define CS7_SW2 0x18
-#define CS8_SW2 0x19
-#define CS9_SW2 0x1A
-#define CS10_SW2 0x1B
-#define CS11_SW2 0x1C
-#define CS12_SW2 0x1D
-#define CS13_SW2 0x1E
-#define CS14_SW2 0x1F
-#define CS15_SW2 0x20
-#define CS16_SW2 0x21
-#define CS17_SW2 0x22
-#define CS18_SW2 0x23
-#define CS1_SW3 0x24
-#define CS2_SW3 0x25
-#define CS3_SW3 0x26
-#define CS4_SW3 0x27
-#define CS5_SW3 0x28
-#define CS6_SW3 0x29
-#define CS7_SW3 0x2A
-#define CS8_SW3 0x2B
-#define CS9_SW3 0x2C
-#define CS10_SW3 0x2D
-#define CS11_SW3 0x2E
-#define CS12_SW3 0x2F
-#define CS13_SW3 0x30
-#define CS14_SW3 0x31
-#define CS15_SW3 0x32
-#define CS16_SW3 0x33
-#define CS17_SW3 0x34
-#define CS18_SW3 0x35
-#define CS1_SW4 0x36
-#define CS2_SW4 0x37
-#define CS3_SW4 0x38
-#define CS4_SW4 0x39
-#define CS5_SW4 0x3A
-#define CS6_SW4 0x3B
-#define CS7_SW4 0x3C
-#define CS8_SW4 0x3D
-#define CS9_SW4 0x3E
-#define CS10_SW4 0x3F
-#define CS11_SW4 0x40
-#define CS12_SW4 0x41
-#define CS13_SW4 0x42
-#define CS14_SW4 0x43
-#define CS15_SW4 0x44
-#define CS16_SW4 0x45
-#define CS17_SW4 0x46
-#define CS18_SW4 0x47
-#define CS1_SW5 0x48
-#define CS2_SW5 0x49
-#define CS3_SW5 0x4A
-#define CS4_SW5 0x4B
-#define CS5_SW5 0x4C
-#define CS6_SW5 0x4D
-#define CS7_SW5 0x4E
-#define CS8_SW5 0x4F
-#define CS9_SW5 0x50
-#define CS10_SW5 0x51
-#define CS11_SW5 0x52
-#define CS12_SW5 0x53
-#define CS13_SW5 0x54
-#define CS14_SW5 0x55
-#define CS15_SW5 0x56
-#define CS16_SW5 0x57
-#define CS17_SW5 0x58
-#define CS18_SW5 0x59
-#define CS1_SW6 0x5A
-#define CS2_SW6 0x5B
-#define CS3_SW6 0x5C
-#define CS4_SW6 0x5D
-#define CS5_SW6 0x5E
-#define CS6_SW6 0x5F
-#define CS7_SW6 0x60
-#define CS8_SW6 0x61
-#define CS9_SW6 0x62
-#define CS10_SW6 0x63
-#define CS11_SW6 0x64
-#define CS12_SW6 0x65
-#define CS13_SW6 0x66
-#define CS14_SW6 0x67
-#define CS15_SW6 0x68
-#define CS16_SW6 0x69
-#define CS17_SW6 0x6A
-#define CS18_SW6 0x6B
-#define CS1_SW7 0x6C
-#define CS2_SW7 0x6D
-#define CS3_SW7 0x6E
-#define CS4_SW7 0x6F
-#define CS5_SW7 0x70
-#define CS6_SW7 0x71
-#define CS7_SW7 0x72
-#define CS8_SW7 0x73
-#define CS9_SW7 0x74
-#define CS10_SW7 0x75
-#define CS11_SW7 0x76
-#define CS12_SW7 0x77
-#define CS13_SW7 0x78
-#define CS14_SW7 0x79
-#define CS15_SW7 0x7A
-#define CS16_SW7 0x7B
-#define CS17_SW7 0x7C
-#define CS18_SW7 0x7D
-#define CS1_SW8 0x7E
-#define CS2_SW8 0x7F
-#define CS3_SW8 0x80
-#define CS4_SW8 0x81
-#define CS5_SW8 0x82
-#define CS6_SW8 0x83
-#define CS7_SW8 0x84
-#define CS8_SW8 0x85
-#define CS9_SW8 0x86
-#define CS10_SW8 0x87
-#define CS11_SW8 0x88
-#define CS12_SW8 0x89
-#define CS13_SW8 0x8A
-#define CS14_SW8 0x8B
-#define CS15_SW8 0x8C
-#define CS16_SW8 0x8D
-#define CS17_SW8 0x8E
-#define CS18_SW8 0x8F
-#define CS1_SW9 0x90
-#define CS2_SW9 0x91
-#define CS3_SW9 0x92
-#define CS4_SW9 0x93
-#define CS5_SW9 0x94
-#define CS6_SW9 0x95
-#define CS7_SW9 0x96
-#define CS8_SW9 0x97
-#define CS9_SW9 0x98
-#define CS10_SW9 0x99
-#define CS11_SW9 0x9A
-#define CS12_SW9 0x9B
-#define CS13_SW9 0x9C
-#define CS14_SW9 0x9D
-#define CS15_SW9 0x9E
-#define CS16_SW9 0x9F
-#define CS17_SW9 0xA0
-#define CS18_SW9 0xA1
-#define CS1_SW10 0xA2
-#define CS2_SW10 0xA3
-#define CS3_SW10 0xA4
-#define CS4_SW10 0xA5
-#define CS5_SW10 0xA6
-#define CS6_SW10 0xA7
-#define CS7_SW10 0xA8
-#define CS8_SW10 0xA9
-#define CS9_SW10 0xAA
-#define CS10_SW10 0xAB
-#define CS11_SW10 0xAC
-#define CS12_SW10 0xAD
-#define CS13_SW10 0xAE
-#define CS14_SW10 0xAF
-#define CS15_SW10 0xB0
-#define CS16_SW10 0xB1
-#define CS17_SW10 0xB2
-#define CS18_SW10 0xB3
-#define CS1_SW11 0xB4
-#define CS2_SW11 0xB5
-#define CS3_SW11 0xB6
-#define CS4_SW11 0xB7
-#define CS5_SW11 0xB8
-#define CS6_SW11 0xB9
-#define CS7_SW11 0xBA
-#define CS8_SW11 0xBB
-#define CS9_SW11 0xBC
-#define CS10_SW11 0xBD
-#define CS11_SW11 0xBE
-#define CS12_SW11 0xBF
-#define CS13_SW11 0xC0
-#define CS14_SW11 0xC1
-#define CS15_SW11 0xC2
-#define CS16_SW11 0xC3
-#define CS17_SW11 0xC4
-#define CS18_SW11 0xC5
-#define CS1_SW12 0xC6
-#define CS2_SW12 0xC7
-#define CS3_SW12 0xC8
-#define CS4_SW12 0xC9
-#define CS5_SW12 0xCA
-#define CS6_SW12 0xCB
-#define CS7_SW12 0xCC
-#define CS8_SW12 0xCD
-#define CS9_SW12 0xCE
-#define CS10_SW12 0xCF
-#define CS11_SW12 0xD0
-#define CS12_SW12 0xD1
-#define CS13_SW12 0xD2
-#define CS14_SW12 0xD3
-#define CS15_SW12 0xD4
-#define CS16_SW12 0xD5
-#define CS17_SW12 0xD6
-#define CS18_SW12 0xD7
diff --git a/drivers/issi/is31fl3218.c b/drivers/issi/is31fl3218.c
deleted file mode 100644
index d43863ac4b..0000000000
--- a/drivers/issi/is31fl3218.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Copyright 2018 Jason Williams (Wilba)
- *
- * 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 "is31fl3218.h"
-#include "i2c_master.h"
-
-// This is the full 8-bit address
-#define ISSI_ADDRESS 0b10101000
-
-// These are the register addresses
-#define ISSI_REG_SHUTDOWN 0x00
-#define ISSI_REG_PWM 0x01
-#define ISSI_REG_CONTROL 0x13
-#define ISSI_REG_UPDATE 0x16
-#define ISSI_REG_RESET 0x17
-
-// Default timeout if no I2C response
-#define ISSI_TIMEOUT 100
-
-// Reusable buffer for transfers
-uint8_t g_twi_transfer_buffer[20];
-
-// IS31FL3218 has 18 PWM outputs and a fixed I2C address, so no chaining.
-// If used as RGB LED driver, LEDs are assigned RGB,RGB,RGB,RGB,RGB,RGB
-uint8_t g_pwm_buffer[18];
-bool g_pwm_buffer_update_required = false;
-
-void IS31FL3218_write_register(uint8_t reg, uint8_t data) {
- g_twi_transfer_buffer[0] = reg;
- g_twi_transfer_buffer[1] = data;
- i2c_transmit(ISSI_ADDRESS, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
-}
-
-void IS31FL3218_write_pwm_buffer(uint8_t *pwm_buffer) {
- g_twi_transfer_buffer[0] = ISSI_REG_PWM;
- for (int i = 0; i < 18; i++) {
- g_twi_transfer_buffer[1 + i] = pwm_buffer[i];
- }
-
- i2c_transmit(ISSI_ADDRESS, g_twi_transfer_buffer, 19, ISSI_TIMEOUT);
-}
-
-void IS31FL3218_init(void) {
- // In case we ever want to reinitialize (?)
- IS31FL3218_write_register(ISSI_REG_RESET, 0x00);
-
- // Turn off software shutdown
- IS31FL3218_write_register(ISSI_REG_SHUTDOWN, 0x01);
-
- // Set all PWM values to zero
- for (uint8_t i = 0; i < 18; i++) {
- IS31FL3218_write_register(ISSI_REG_PWM + i, 0x00);
- }
-
- // Enable all channels
- for (uint8_t i = 0; i < 3; i++) {
- IS31FL3218_write_register(ISSI_REG_CONTROL + i, 0b00111111);
- }
-
- // Load PWM registers and LED Control register data
- IS31FL3218_write_register(ISSI_REG_UPDATE, 0x01);
-}
-
-void IS31FL3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
- g_pwm_buffer[index * 3 + 0] = red;
- g_pwm_buffer[index * 3 + 1] = green;
- g_pwm_buffer[index * 3 + 2] = blue;
- g_pwm_buffer_update_required = true;
-}
-
-void IS31FL3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
- for (int i = 0; i < 6; i++) {
- IS31FL3218_set_color(i, red, green, blue);
- }
-}
-
-void IS31FL3218_update_pwm_buffers(void) {
- if (g_pwm_buffer_update_required) {
- IS31FL3218_write_pwm_buffer(g_pwm_buffer);
- // Load PWM registers and LED Control register data
- IS31FL3218_write_register(ISSI_REG_UPDATE, 0x01);
- }
- g_pwm_buffer_update_required = false;
-}
diff --git a/drivers/issi/is31fl3218.h b/drivers/issi/is31fl3218.h
deleted file mode 100644
index fa760da191..0000000000
--- a/drivers/issi/is31fl3218.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright 2018 Jason Williams (Wilba)
- *
- * 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 .
- */
-
-#pragma once
-
-#include
-#include
-
-void IS31FL3218_init(void);
-void IS31FL3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
-void IS31FL3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
-void IS31FL3218_update_pwm_buffers(void);
diff --git a/drivers/issi/is31fl3731-simple.c b/drivers/issi/is31fl3731-simple.c
deleted file mode 100644
index d295772f5e..0000000000
--- a/drivers/issi/is31fl3731-simple.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/* Copyright 2017 Jason Williams
- * Copyright 2018 Jack Humbert
- * Copyright 2019 Clueboard
- *
- * 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 "is31fl3731-simple.h"
-#include "i2c_master.h"
-#include "wait.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)
-// The address will vary depending on your wiring:
-// 0b1110100 AD <-> GND
-// 0b1110111 AD <-> VCC
-// 0b1110101 AD <-> SCL
-// 0b1110110 AD <-> SDA
-#define ISSI_ADDR_DEFAULT 0x74
-
-#define ISSI_REG_CONFIG 0x00
-#define ISSI_REG_CONFIG_PICTUREMODE 0x00
-#define ISSI_REG_CONFIG_AUTOPLAYMODE 0x08
-#define ISSI_REG_CONFIG_AUDIOPLAYMODE 0x18
-
-#define ISSI_CONF_PICTUREMODE 0x00
-#define ISSI_CONF_AUTOFRAMEMODE 0x04
-#define ISSI_CONF_AUDIOMODE 0x08
-
-#define ISSI_REG_PICTUREFRAME 0x01
-
-#define ISSI_REG_SHUTDOWN 0x0A
-#define ISSI_REG_AUDIOSYNC 0x06
-
-#define ISSI_COMMANDREGISTER 0xFD
-#define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine'
-
-#ifndef ISSI_TIMEOUT
-# define ISSI_TIMEOUT 100
-#endif
-
-#ifndef ISSI_PERSISTENCE
-# define ISSI_PERSISTENCE 0
-#endif
-
-// Transfer buffer for TWITransmitData()
-uint8_t g_twi_transfer_buffer[20];
-
-// These buffers match the IS31FL3731 PWM registers 0x24-0xB3.
-// Storing them like this is optimal for I2C transfers to the registers.
-// We could optimize this and take out the unused registers from these
-// buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's
-// probably not worth the extra complexity.
-uint8_t g_pwm_buffer[LED_DRIVER_COUNT][144];
-bool g_pwm_buffer_update_required[LED_DRIVER_COUNT] = {false};
-
-/* There's probably a better way to init this... */
-#if LED_DRIVER_COUNT == 1
-uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}};
-#elif LED_DRIVER_COUNT == 2
-uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}};
-#elif LED_DRIVER_COUNT == 3
-uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}};
-#elif LED_DRIVER_COUNT == 4
-uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}, {0}};
-#endif
-bool g_led_control_registers_update_required[LED_DRIVER_COUNT] = {false};
-
-// This is the bit pattern in the LED control registers
-// (for matrix A, add one to register for matrix B)
-//
-// reg - b7 b6 b5 b4 b3 b2 b1 b0
-// 0x00 - R08,R07,R06,R05,R04,R03,R02,R01
-// 0x02 - G08,G07,G06,G05,G04,G03,G02,R00
-// 0x04 - B08,B07,B06,B05,B04,B03,G01,G00
-// 0x06 - - , - , - , - , - ,B02,B01,B00
-// 0x08 - - , - , - , - , - , - , - , -
-// 0x0A - B17,B16,B15, - , - , - , - , -
-// 0x0C - G17,G16,B14,B13,B12,B11,B10,B09
-// 0x0E - R17,G15,G14,G13,G12,G11,G10,G09
-// 0x10 - R16,R15,R14,R13,R12,R11,R10,R09
-
-void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
- g_twi_transfer_buffer[0] = reg;
- g_twi_transfer_buffer[1] = data;
-
-#if ISSI_PERSISTENCE > 0
- for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) {
- break;
- }
- }
-#else
- i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
-#endif
-}
-
-void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
- // assumes bank is already selected
-
- // transmit PWM registers in 9 transfers of 16 bytes
- // g_twi_transfer_buffer[] is 20 bytes
-
- // iterate over the pwm_buffer contents at 16 byte intervals
- for (int i = 0; i < 144; i += 16) {
- // set the first register, e.g. 0x24, 0x34, 0x44, etc.
- g_twi_transfer_buffer[0] = 0x24 + i;
- // copy the data from i to i+15
- // device will auto-increment register for data after the first byte
- // thus this sets registers 0x24-0x33, 0x34-0x43, etc. in one transfer
- for (int j = 0; j < 16; j++) {
- g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
- }
-
-#if ISSI_PERSISTENCE > 0
- for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) break;
- }
-#else
- i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT);
-#endif
- }
-}
-
-void IS31FL3731_init(uint8_t addr) {
- // In order to avoid the LEDs being driven with garbage data
- // in the LED driver's PWM registers, first enable software shutdown,
- // then set up the mode and other settings, clear the PWM registers,
- // then disable software shutdown.
-
- // select "function register" bank
- IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG);
-
- // enable software shutdown
- IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00);
-
- // this delay was copied from other drivers, might not be needed
- wait_ms(10);
-
- // picture mode
- IS31FL3731_write_register(addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE);
- // display frame 0
- IS31FL3731_write_register(addr, ISSI_REG_PICTUREFRAME, 0x00);
- // audio sync off
- IS31FL3731_write_register(addr, ISSI_REG_AUDIOSYNC, 0x00);
-
- // select bank 0
- IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
-
- // turn off all LEDs in the LED control register
- for (int i = 0x00; i <= 0x11; i++) {
- IS31FL3731_write_register(addr, i, 0x00);
- }
-
- // turn off all LEDs in the blink control register (not really needed)
- for (int i = 0x12; i <= 0x23; i++) {
- IS31FL3731_write_register(addr, i, 0x00);
- }
-
- // set PWM on all LEDs to 0
- for (int i = 0x24; i <= 0xB3; i++) {
- IS31FL3731_write_register(addr, i, 0x00);
- }
-
- // select "function register" bank
- IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG);
-
- // disable software shutdown
- IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x01);
-
- // select bank 0 and leave it selected.
- // most usage after initialization is just writing PWM buffers in bank 0
- // as there's not much point in double-buffering
- IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
-}
-
-void IS31FL3731_set_value(int index, uint8_t value) {
- 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
- g_pwm_buffer[led.driver][led.v - 0x24] = value;
- g_pwm_buffer_update_required[led.driver] = true;
- }
-}
-
-void IS31FL3731_set_value_all(uint8_t value) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
- IS31FL3731_set_value(i, value);
- }
-}
-
-void IS31FL3731_set_led_control_register(uint8_t index, bool value) {
- is31_led led = g_is31_leds[index];
-
- uint8_t control_register = (led.v - 0x24) / 8;
- uint8_t bit_value = (led.v - 0x24) % 8;
-
- if (value) {
- g_led_control_registers[led.driver][control_register] |= (1 << bit_value);
- } else {
- g_led_control_registers[led.driver][control_register] &= ~(1 << bit_value);
- }
-
- g_led_control_registers_update_required[led.driver] = true;
-}
-
-void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index) {
- if (g_pwm_buffer_update_required[index]) {
- IS31FL3731_write_pwm_buffer(addr, g_pwm_buffer[index]);
- g_pwm_buffer_update_required[index] = false;
- }
-}
-
-void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index) {
- if (g_led_control_registers_update_required[index]) {
- for (int i = 0; i < 18; i++) {
- IS31FL3731_write_register(addr, i, g_led_control_registers[index][i]);
- }
- g_led_control_registers_update_required[index] = false;
- }
-}
diff --git a/drivers/issi/is31fl3731-simple.h b/drivers/issi/is31fl3731-simple.h
deleted file mode 100644
index 9665d6ed35..0000000000
--- a/drivers/issi/is31fl3731-simple.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/* Copyright 2017 Jason Williams
- * Copyright 2018 Jack Humbert
- * Copyright 2019 Clueboard
- *
- * 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 .
- */
-
-#pragma once
-
-#include
-#include
-
-typedef struct is31_led {
- uint8_t driver : 2;
- uint8_t v;
-} __attribute__((packed)) is31_led;
-
-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);
-void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
-
-void IS31FL3731_set_value(int index, uint8_t value);
-void IS31FL3731_set_value_all(uint8_t value);
-
-void IS31FL3731_set_led_control_register(uint8_t index, bool value);
-
-// This should not be called from an interrupt
-// (eg. from a timer interrupt).
-// Call this while idle (in between matrix scans).
-// If the buffer is dirty, it will update the driver with the buffer.
-void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index);
-void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index);
-
-#define C1_1 0x24
-#define C1_2 0x25
-#define C1_3 0x26
-#define C1_4 0x27
-#define C1_5 0x28
-#define C1_6 0x29
-#define C1_7 0x2A
-#define C1_8 0x2B
-
-#define C1_9 0x2C
-#define C1_10 0x2D
-#define C1_11 0x2E
-#define C1_12 0x2F
-#define C1_13 0x30
-#define C1_14 0x31
-#define C1_15 0x32
-#define C1_16 0x33
-
-#define C2_1 0x34
-#define C2_2 0x35
-#define C2_3 0x36
-#define C2_4 0x37
-#define C2_5 0x38
-#define C2_6 0x39
-#define C2_7 0x3A
-#define C2_8 0x3B
-
-#define C2_9 0x3C
-#define C2_10 0x3D
-#define C2_11 0x3E
-#define C2_12 0x3F
-#define C2_13 0x40
-#define C2_14 0x41
-#define C2_15 0x42
-#define C2_16 0x43
-
-#define C3_1 0x44
-#define C3_2 0x45
-#define C3_3 0x46
-#define C3_4 0x47
-#define C3_5 0x48
-#define C3_6 0x49
-#define C3_7 0x4A
-#define C3_8 0x4B
-
-#define C3_9 0x4C
-#define C3_10 0x4D
-#define C3_11 0x4E
-#define C3_12 0x4F
-#define C3_13 0x50
-#define C3_14 0x51
-#define C3_15 0x52
-#define C3_16 0x53
-
-#define C4_1 0x54
-#define C4_2 0x55
-#define C4_3 0x56
-#define C4_4 0x57
-#define C4_5 0x58
-#define C4_6 0x59
-#define C4_7 0x5A
-#define C4_8 0x5B
-
-#define C4_9 0x5C
-#define C4_10 0x5D
-#define C4_11 0x5E
-#define C4_12 0x5F
-#define C4_13 0x60
-#define C4_14 0x61
-#define C4_15 0x62
-#define C4_16 0x63
-
-#define C5_1 0x64
-#define C5_2 0x65
-#define C5_3 0x66
-#define C5_4 0x67
-#define C5_5 0x68
-#define C5_6 0x69
-#define C5_7 0x6A
-#define C5_8 0x6B
-
-#define C5_9 0x6C
-#define C5_10 0x6D
-#define C5_11 0x6E
-#define C5_12 0x6F
-#define C5_13 0x70
-#define C5_14 0x71
-#define C5_15 0x72
-#define C5_16 0x73
-
-#define C6_1 0x74
-#define C6_2 0x75
-#define C6_3 0x76
-#define C6_4 0x77
-#define C6_5 0x78
-#define C6_6 0x79
-#define C6_7 0x7A
-#define C6_8 0x7B
-
-#define C6_9 0x7C
-#define C6_10 0x7D
-#define C6_11 0x7E
-#define C6_12 0x7F
-#define C6_13 0x80
-#define C6_14 0x81
-#define C6_15 0x82
-#define C6_16 0x83
-
-#define C7_1 0x84
-#define C7_2 0x85
-#define C7_3 0x86
-#define C7_4 0x87
-#define C7_5 0x88
-#define C7_6 0x89
-#define C7_7 0x8A
-#define C7_8 0x8B
-
-#define C7_9 0x8C
-#define C7_10 0x8D
-#define C7_11 0x8E
-#define C7_12 0x8F
-#define C7_13 0x90
-#define C7_14 0x91
-#define C7_15 0x92
-#define C7_16 0x93
-
-#define C8_1 0x94
-#define C8_2 0x95
-#define C8_3 0x96
-#define C8_4 0x97
-#define C8_5 0x98
-#define C8_6 0x99
-#define C8_7 0x9A
-#define C8_8 0x9B
-
-#define C8_9 0x9C
-#define C8_10 0x9D
-#define C8_11 0x9E
-#define C8_12 0x9F
-#define C8_13 0xA0
-#define C8_14 0xA1
-#define C8_15 0xA2
-#define C8_16 0xA3
-
-#define C9_1 0xA4
-#define C9_2 0xA5
-#define C9_3 0xA6
-#define C9_4 0xA7
-#define C9_5 0xA8
-#define C9_6 0xA9
-#define C9_7 0xAA
-#define C9_8 0xAB
-
-#define C9_9 0xAC
-#define C9_10 0xAD
-#define C9_11 0xAE
-#define C9_12 0xAF
-#define C9_13 0xB0
-#define C9_14 0xB1
-#define C9_15 0xB2
-#define C9_16 0xB3
diff --git a/drivers/issi/is31fl3731.c b/drivers/issi/is31fl3731.c
deleted file mode 100644
index 110bdc1be4..0000000000
--- a/drivers/issi/is31fl3731.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/* Copyright 2017 Jason Williams
- * Copyright 2018 Jack Humbert
- *
- * 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 "is31fl3731.h"
-#include "i2c_master.h"
-#include "wait.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)
-// The address will vary depending on your wiring:
-// 0b1110100 AD <-> GND
-// 0b1110111 AD <-> VCC
-// 0b1110101 AD <-> SCL
-// 0b1110110 AD <-> SDA
-#define ISSI_ADDR_DEFAULT 0x74
-
-#define ISSI_REG_CONFIG 0x00
-#define ISSI_REG_CONFIG_PICTUREMODE 0x00
-#define ISSI_REG_CONFIG_AUTOPLAYMODE 0x08
-#define ISSI_REG_CONFIG_AUDIOPLAYMODE 0x18
-
-#define ISSI_CONF_PICTUREMODE 0x00
-#define ISSI_CONF_AUTOFRAMEMODE 0x04
-#define ISSI_CONF_AUDIOMODE 0x08
-
-#define ISSI_REG_PICTUREFRAME 0x01
-
-#define ISSI_REG_SHUTDOWN 0x0A
-#define ISSI_REG_AUDIOSYNC 0x06
-
-#define ISSI_COMMANDREGISTER 0xFD
-#define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine'
-
-#ifndef ISSI_TIMEOUT
-# define ISSI_TIMEOUT 100
-#endif
-
-#ifndef ISSI_PERSISTENCE
-# define ISSI_PERSISTENCE 0
-#endif
-
-// Transfer buffer for TWITransmitData()
-uint8_t g_twi_transfer_buffer[20];
-
-// These buffers match the IS31FL3731 PWM registers 0x24-0xB3.
-// Storing them like this is optimal for I2C transfers to the registers.
-// We could optimize this and take out the unused registers from these
-// buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's
-// probably not worth the extra complexity.
-uint8_t g_pwm_buffer[DRIVER_COUNT][144];
-bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
-
-uint8_t g_led_control_registers[DRIVER_COUNT][18] = {{0}};
-bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
-
-// This is the bit pattern in the LED control registers
-// (for matrix A, add one to register for matrix B)
-//
-// reg - b7 b6 b5 b4 b3 b2 b1 b0
-// 0x00 - R08,R07,R06,R05,R04,R03,R02,R01
-// 0x02 - G08,G07,G06,G05,G04,G03,G02,R00
-// 0x04 - B08,B07,B06,B05,B04,B03,G01,G00
-// 0x06 - - , - , - , - , - ,B02,B01,B00
-// 0x08 - - , - , - , - , - , - , - , -
-// 0x0A - B17,B16,B15, - , - , - , - , -
-// 0x0C - G17,G16,B14,B13,B12,B11,B10,B09
-// 0x0E - R17,G15,G14,G13,G12,G11,G10,G09
-// 0x10 - R16,R15,R14,R13,R12,R11,R10,R09
-
-void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
- g_twi_transfer_buffer[0] = reg;
- g_twi_transfer_buffer[1] = data;
-
-#if ISSI_PERSISTENCE > 0
- for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
- }
-#else
- i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
-#endif
-}
-
-void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
- // assumes bank is already selected
-
- // transmit PWM registers in 9 transfers of 16 bytes
- // g_twi_transfer_buffer[] is 20 bytes
-
- // iterate over the pwm_buffer contents at 16 byte intervals
- for (int i = 0; i < 144; i += 16) {
- // set the first register, e.g. 0x24, 0x34, 0x44, etc.
- g_twi_transfer_buffer[0] = 0x24 + i;
- // copy the data from i to i+15
- // device will auto-increment register for data after the first byte
- // thus this sets registers 0x24-0x33, 0x34-0x43, etc. in one transfer
- for (int j = 0; j < 16; j++) {
- g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
- }
-
-#if ISSI_PERSISTENCE > 0
- for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) break;
- }
-#else
- i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT);
-#endif
- }
-}
-
-void IS31FL3731_init(uint8_t addr) {
- // In order to avoid the LEDs being driven with garbage data
- // in the LED driver's PWM registers, first enable software shutdown,
- // then set up the mode and other settings, clear the PWM registers,
- // then disable software shutdown.
-
- // select "function register" bank
- IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG);
-
- // enable software shutdown
- IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00);
-
- // this delay was copied from other drivers, might not be needed
- wait_ms(10);
-
- // picture mode
- IS31FL3731_write_register(addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE);
- // display frame 0
- IS31FL3731_write_register(addr, ISSI_REG_PICTUREFRAME, 0x00);
- // audio sync off
- IS31FL3731_write_register(addr, ISSI_REG_AUDIOSYNC, 0x00);
-
- // select bank 0
- IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
-
- // turn off all LEDs in the LED control register
- for (int i = 0x00; i <= 0x11; i++) {
- IS31FL3731_write_register(addr, i, 0x00);
- }
-
- // turn off all LEDs in the blink control register (not really needed)
- for (int i = 0x12; i <= 0x23; i++) {
- IS31FL3731_write_register(addr, i, 0x00);
- }
-
- // set PWM on all LEDs to 0
- for (int i = 0x24; i <= 0xB3; i++) {
- IS31FL3731_write_register(addr, i, 0x00);
- }
-
- // select "function register" bank
- IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG);
-
- // disable software shutdown
- IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x01);
-
- // select bank 0 and leave it selected.
- // most usage after initialization is just writing PWM buffers in bank 0
- // as there's not much point in double-buffering
- IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
-}
-
-void IS31FL3731_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];
-
- // Subtract 0x24 to get the second index of g_pwm_buffer
- g_pwm_buffer[led.driver][led.r - 0x24] = red;
- g_pwm_buffer[led.driver][led.g - 0x24] = green;
- g_pwm_buffer[led.driver][led.b - 0x24] = blue;
- g_pwm_buffer_update_required[led.driver] = true;
- }
-}
-
-void IS31FL3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
- IS31FL3731_set_color(i, red, green, blue);
- }
-}
-
-void IS31FL3731_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
- is31_led led = g_is31_leds[index];
-
- uint8_t control_register_r = (led.r - 0x24) / 8;
- uint8_t control_register_g = (led.g - 0x24) / 8;
- uint8_t control_register_b = (led.b - 0x24) / 8;
- uint8_t bit_r = (led.r - 0x24) % 8;
- uint8_t bit_g = (led.g - 0x24) % 8;
- uint8_t bit_b = (led.b - 0x24) % 8;
-
- if (red) {
- g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r);
- } else {
- g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r);
- }
- if (green) {
- g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g);
- } else {
- g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g);
- }
- if (blue) {
- g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b);
- } else {
- g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b);
- }
-
- g_led_control_registers_update_required[led.driver] = true;
-}
-
-void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index) {
- if (g_pwm_buffer_update_required[index]) {
- IS31FL3731_write_pwm_buffer(addr, g_pwm_buffer[index]);
- }
- g_pwm_buffer_update_required[index] = false;
-}
-
-void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index) {
- if (g_led_control_registers_update_required[index]) {
- for (int i = 0; i < 18; i++) {
- IS31FL3731_write_register(addr, i, g_led_control_registers[index][i]);
- }
- }
- g_led_control_registers_update_required[index] = false;
-}
diff --git a/drivers/issi/is31fl3731.h b/drivers/issi/is31fl3731.h
deleted file mode 100644
index 19e8e6251f..0000000000
--- a/drivers/issi/is31fl3731.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/* Copyright 2017 Jason Williams
- * Copyright 2018 Jack Humbert
- *
- * 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 .
- */
-
-#pragma once
-
-#include
-#include
-
-typedef struct is31_led {
- uint8_t driver : 2;
- uint8_t r;
- uint8_t g;
- uint8_t b;
-} __attribute__((packed)) is31_led;
-
-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);
-void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
-
-void IS31FL3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
-void IS31FL3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
-
-void IS31FL3731_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
-
-// This should not be called from an interrupt
-// (eg. from a timer interrupt).
-// Call this while idle (in between matrix scans).
-// If the buffer is dirty, it will update the driver with the buffer.
-void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index);
-void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index);
-
-#define C1_1 0x24
-#define C1_2 0x25
-#define C1_3 0x26
-#define C1_4 0x27
-#define C1_5 0x28
-#define C1_6 0x29
-#define C1_7 0x2A
-#define C1_8 0x2B
-
-#define C1_9 0x2C
-#define C1_10 0x2D
-#define C1_11 0x2E
-#define C1_12 0x2F
-#define C1_13 0x30
-#define C1_14 0x31
-#define C1_15 0x32
-#define C1_16 0x33
-
-#define C2_1 0x34
-#define C2_2 0x35
-#define C2_3 0x36
-#define C2_4 0x37
-#define C2_5 0x38
-#define C2_6 0x39
-#define C2_7 0x3A
-#define C2_8 0x3B
-
-#define C2_9 0x3C
-#define C2_10 0x3D
-#define C2_11 0x3E
-#define C2_12 0x3F
-#define C2_13 0x40
-#define C2_14 0x41
-#define C2_15 0x42
-#define C2_16 0x43
-
-#define C3_1 0x44
-#define C3_2 0x45
-#define C3_3 0x46
-#define C3_4 0x47
-#define C3_5 0x48
-#define C3_6 0x49
-#define C3_7 0x4A
-#define C3_8 0x4B
-
-#define C3_9 0x4C
-#define C3_10 0x4D
-#define C3_11 0x4E
-#define C3_12 0x4F
-#define C3_13 0x50
-#define C3_14 0x51
-#define C3_15 0x52
-#define C3_16 0x53
-
-#define C4_1 0x54
-#define C4_2 0x55
-#define C4_3 0x56
-#define C4_4 0x57
-#define C4_5 0x58
-#define C4_6 0x59
-#define C4_7 0x5A
-#define C4_8 0x5B
-
-#define C4_9 0x5C
-#define C4_10 0x5D
-#define C4_11 0x5E
-#define C4_12 0x5F
-#define C4_13 0x60
-#define C4_14 0x61
-#define C4_15 0x62
-#define C4_16 0x63
-
-#define C5_1 0x64
-#define C5_2 0x65
-#define C5_3 0x66
-#define C5_4 0x67
-#define C5_5 0x68
-#define C5_6 0x69
-#define C5_7 0x6A
-#define C5_8 0x6B
-
-#define C5_9 0x6C
-#define C5_10 0x6D
-#define C5_11 0x6E
-#define C5_12 0x6F
-#define C5_13 0x70
-#define C5_14 0x71
-#define C5_15 0x72
-#define C5_16 0x73
-
-#define C6_1 0x74
-#define C6_2 0x75
-#define C6_3 0x76
-#define C6_4 0x77
-#define C6_5 0x78
-#define C6_6 0x79
-#define C6_7 0x7A
-#define C6_8 0x7B
-
-#define C6_9 0x7C
-#define C6_10 0x7D
-#define C6_11 0x7E
-#define C6_12 0x7F
-#define C6_13 0x80
-#define C6_14 0x81
-#define C6_15 0x82
-#define C6_16 0x83
-
-#define C7_1 0x84
-#define C7_2 0x85
-#define C7_3 0x86
-#define C7_4 0x87
-#define C7_5 0x88
-#define C7_6 0x89
-#define C7_7 0x8A
-#define C7_8 0x8B
-
-#define C7_9 0x8C
-#define C7_10 0x8D
-#define C7_11 0x8E
-#define C7_12 0x8F
-#define C7_13 0x90
-#define C7_14 0x91
-#define C7_15 0x92
-#define C7_16 0x93
-
-#define C8_1 0x94
-#define C8_2 0x95
-#define C8_3 0x96
-#define C8_4 0x97
-#define C8_5 0x98
-#define C8_6 0x99
-#define C8_7 0x9A
-#define C8_8 0x9B
-
-#define C8_9 0x9C
-#define C8_10 0x9D
-#define C8_11 0x9E
-#define C8_12 0x9F
-#define C8_13 0xA0
-#define C8_14 0xA1
-#define C8_15 0xA2
-#define C8_16 0xA3
-
-#define C9_1 0xA4
-#define C9_2 0xA5
-#define C9_3 0xA6
-#define C9_4 0xA7
-#define C9_5 0xA8
-#define C9_6 0xA9
-#define C9_7 0xAA
-#define C9_8 0xAB
-
-#define C9_9 0xAC
-#define C9_10 0xAD
-#define C9_11 0xAE
-#define C9_12 0xAF
-#define C9_13 0xB0
-#define C9_14 0xB1
-#define C9_15 0xB2
-#define C9_16 0xB3
diff --git a/drivers/issi/is31fl3733.c b/drivers/issi/is31fl3733.c
deleted file mode 100644
index d99e5339c9..0000000000
--- a/drivers/issi/is31fl3733.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/* Copyright 2017 Jason Williams
- * Copyright 2018 Jack Humbert
- * Copyright 2018 Yiancar
- *
- * 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 "is31fl3733.h"
-#include "i2c_master.h"
-#include "wait.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)
-// The address will vary depending on your wiring:
-// 00 <-> GND
-// 01 <-> SCL
-// 10 <-> SDA
-// 11 <-> VCC
-// ADDR1 represents A1:A0 of the 7-bit address.
-// ADDR2 represents A3:A2 of the 7-bit address.
-// The result is: 0b101(ADDR2)(ADDR1)
-#define ISSI_ADDR_DEFAULT 0x50
-
-#define ISSI_COMMANDREGISTER 0xFD
-#define ISSI_COMMANDREGISTER_WRITELOCK 0xFE
-#define ISSI_INTERRUPTMASKREGISTER 0xF0
-#define ISSI_INTERRUPTSTATUSREGISTER 0xF1
-
-#define ISSI_PAGE_LEDCONTROL 0x00 // PG0
-#define ISSI_PAGE_PWM 0x01 // PG1
-#define ISSI_PAGE_AUTOBREATH 0x02 // PG2
-#define ISSI_PAGE_FUNCTION 0x03 // PG3
-
-#define ISSI_REG_CONFIGURATION 0x00 // PG3
-#define ISSI_REG_GLOBALCURRENT 0x01 // PG3
-#define ISSI_REG_RESET 0x11 // PG3
-#define ISSI_REG_SWPULLUP 0x0F // PG3
-#define ISSI_REG_CSPULLUP 0x10 // PG3
-
-#ifndef ISSI_TIMEOUT
-# define ISSI_TIMEOUT 100
-#endif
-
-#ifndef ISSI_PERSISTENCE
-# define ISSI_PERSISTENCE 0
-#endif
-
-// Transfer buffer for TWITransmitData()
-uint8_t g_twi_transfer_buffer[20];
-
-// These buffers match the IS31FL3733 PWM registers.
-// The control buffers match the PG0 LED On/Off registers.
-// Storing them like this is optimal for I2C transfers to the registers.
-// We could optimize this and take out the unused registers from these
-// buffers and the transfers in IS31FL3733_write_pwm_buffer() but it's
-// probably not worth the extra complexity.
-uint8_t g_pwm_buffer[DRIVER_COUNT][192];
-bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
-
-uint8_t g_led_control_registers[DRIVER_COUNT][24] = {0};
-bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
-
-bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
- // If the transaction fails function returns false.
- g_twi_transfer_buffer[0] = reg;
- g_twi_transfer_buffer[1] = data;
-
-#if ISSI_PERSISTENCE > 0
- for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) != 0) {
- return false;
- }
- }
-#else
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) != 0) {
- return false;
- }
-#endif
- return true;
-}
-
-bool IS31FL3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
- // Assumes PG1 is already selected.
- // If any of the transactions fails function returns false.
- // Transmit PWM registers in 12 transfers of 16 bytes.
- // g_twi_transfer_buffer[] is 20 bytes
-
- // Iterate over the pwm_buffer contents at 16 byte intervals.
- for (int i = 0; i < 192; i += 16) {
- g_twi_transfer_buffer[0] = i;
- // Copy the data from i to i+15.
- // Device will auto-increment register for data after the first byte
- // Thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer.
- for (int j = 0; j < 16; j++) {
- g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
- }
-
-#if ISSI_PERSISTENCE > 0
- for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) != 0) {
- return false;
- }
- }
-#else
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) != 0) {
- return false;
- }
-#endif
- }
- return true;
-}
-
-void IS31FL3733_init(uint8_t addr, uint8_t sync) {
- // In order to avoid the LEDs being driven with garbage data
- // in the LED driver's PWM registers, shutdown is enabled last.
- // Set up the mode and other settings, clear the PWM registers,
- // then disable software shutdown.
- // Sync is passed so set it according to the datasheet.
-
- // Unlock the command register.
- IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
-
- // Select PG0
- IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
- // Turn off all LEDs.
- for (int i = 0x00; i <= 0x17; i++) {
- IS31FL3733_write_register(addr, i, 0x00);
- }
-
- // Unlock the command register.
- IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
-
- // Select PG1
- IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
- // Set PWM on all LEDs to 0
- // No need to setup Breath registers to PWM as that is the default.
- for (int i = 0x00; i <= 0xBF; i++) {
- IS31FL3733_write_register(addr, i, 0x00);
- }
-
- // Unlock the command register.
- IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
-
- // Select PG3
- IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
- // Set global current to maximum.
- IS31FL3733_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
- // Disable software shutdown.
- IS31FL3733_write_register(addr, ISSI_REG_CONFIGURATION, (sync << 6) | 0x01);
-
- // Wait 10ms to ensure the device has woken up.
- wait_ms(10);
-}
-
-void IS31FL3733_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];
-
- g_pwm_buffer[led.driver][led.r] = red;
- g_pwm_buffer[led.driver][led.g] = green;
- g_pwm_buffer[led.driver][led.b] = blue;
- g_pwm_buffer_update_required[led.driver] = true;
- }
-}
-
-void IS31FL3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
- IS31FL3733_set_color(i, red, green, blue);
- }
-}
-
-void IS31FL3733_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
- is31_led led = g_is31_leds[index];
-
- uint8_t control_register_r = led.r / 8;
- uint8_t control_register_g = led.g / 8;
- uint8_t control_register_b = led.b / 8;
- uint8_t bit_r = led.r % 8;
- uint8_t bit_g = led.g % 8;
- uint8_t bit_b = led.b % 8;
-
- if (red) {
- g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r);
- } else {
- g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r);
- }
- if (green) {
- g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g);
- } else {
- g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g);
- }
- if (blue) {
- g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b);
- } else {
- g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b);
- }
-
- g_led_control_registers_update_required[led.driver] = true;
-}
-
-void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index) {
- if (g_pwm_buffer_update_required[index]) {
- // Firstly we need to unlock the command register and select PG1.
- IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
- IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
-
- // If any of the transactions fail we risk writing dirty PG0,
- // refresh page 0 just in case.
- if (!IS31FL3733_write_pwm_buffer(addr, g_pwm_buffer[index])) {
- g_led_control_registers_update_required[index] = true;
- }
- }
- g_pwm_buffer_update_required[index] = false;
-}
-
-void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index) {
- if (g_led_control_registers_update_required[index]) {
- // Firstly we need to unlock the command register and select PG0
- IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
- IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
- for (int i = 0; i < 24; i++) {
- IS31FL3733_write_register(addr, i, g_led_control_registers[index][i]);
- }
- }
- g_led_control_registers_update_required[index] = false;
-}
diff --git a/drivers/issi/is31fl3733.h b/drivers/issi/is31fl3733.h
deleted file mode 100644
index 603d505a13..0000000000
--- a/drivers/issi/is31fl3733.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/* Copyright 2017 Jason Williams
- * Copyright 2018 Jack Humbert
- * Copyright 2018 Yiancar
- *
- * 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 .
- */
-
-#pragma once
-
-#include
-#include
-
-typedef struct is31_led {
- uint8_t driver : 2;
- uint8_t r;
- uint8_t g;
- uint8_t b;
-} __attribute__((packed)) is31_led;
-
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
-
-void IS31FL3733_init(uint8_t addr, uint8_t sync);
-bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data);
-bool IS31FL3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
-
-void IS31FL3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
-void IS31FL3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
-
-void IS31FL3733_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
-
-// This should not be called from an interrupt
-// (eg. from a timer interrupt).
-// Call this while idle (in between matrix scans).
-// If the buffer is dirty, it will update the driver with the buffer.
-void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index);
-void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index);
-
-#define A_1 0x00
-#define A_2 0x01
-#define A_3 0x02
-#define A_4 0x03
-#define A_5 0x04
-#define A_6 0x05
-#define A_7 0x06
-#define A_8 0x07
-#define A_9 0x08
-#define A_10 0x09
-#define A_11 0x0A
-#define A_12 0x0B
-#define A_13 0x0C
-#define A_14 0x0D
-#define A_15 0x0E
-#define A_16 0x0F
-
-#define B_1 0x10
-#define B_2 0x11
-#define B_3 0x12
-#define B_4 0x13
-#define B_5 0x14
-#define B_6 0x15
-#define B_7 0x16
-#define B_8 0x17
-#define B_9 0x18
-#define B_10 0x19
-#define B_11 0x1A
-#define B_12 0x1B
-#define B_13 0x1C
-#define B_14 0x1D
-#define B_15 0x1E
-#define B_16 0x1F
-
-#define C_1 0x20
-#define C_2 0x21
-#define C_3 0x22
-#define C_4 0x23
-#define C_5 0x24
-#define C_6 0x25
-#define C_7 0x26
-#define C_8 0x27
-#define C_9 0x28
-#define C_10 0x29
-#define C_11 0x2A
-#define C_12 0x2B
-#define C_13 0x2C
-#define C_14 0x2D
-#define C_15 0x2E
-#define C_16 0x2F
-
-#define D_1 0x30
-#define D_2 0x31
-#define D_3 0x32
-#define D_4 0x33
-#define D_5 0x34
-#define D_6 0x35
-#define D_7 0x36
-#define D_8 0x37
-#define D_9 0x38
-#define D_10 0x39
-#define D_11 0x3A
-#define D_12 0x3B
-#define D_13 0x3C
-#define D_14 0x3D
-#define D_15 0x3E
-#define D_16 0x3F
-
-#define E_1 0x40
-#define E_2 0x41
-#define E_3 0x42
-#define E_4 0x43
-#define E_5 0x44
-#define E_6 0x45
-#define E_7 0x46
-#define E_8 0x47
-#define E_9 0x48
-#define E_10 0x49
-#define E_11 0x4A
-#define E_12 0x4B
-#define E_13 0x4C
-#define E_14 0x4D
-#define E_15 0x4E
-#define E_16 0x4F
-
-#define F_1 0x50
-#define F_2 0x51
-#define F_3 0x52
-#define F_4 0x53
-#define F_5 0x54
-#define F_6 0x55
-#define F_7 0x56
-#define F_8 0x57
-#define F_9 0x58
-#define F_10 0x59
-#define F_11 0x5A
-#define F_12 0x5B
-#define F_13 0x5C
-#define F_14 0x5D
-#define F_15 0x5E
-#define F_16 0x5F
-
-#define G_1 0x60
-#define G_2 0x61
-#define G_3 0x62
-#define G_4 0x63
-#define G_5 0x64
-#define G_6 0x65
-#define G_7 0x66
-#define G_8 0x67
-#define G_9 0x68
-#define G_10 0x69
-#define G_11 0x6A
-#define G_12 0x6B
-#define G_13 0x6C
-#define G_14 0x6D
-#define G_15 0x6E
-#define G_16 0x6F
-
-#define H_1 0x70
-#define H_2 0x71
-#define H_3 0x72
-#define H_4 0x73
-#define H_5 0x74
-#define H_6 0x75
-#define H_7 0x76
-#define H_8 0x77
-#define H_9 0x78
-#define H_10 0x79
-#define H_11 0x7A
-#define H_12 0x7B
-#define H_13 0x7C
-#define H_14 0x7D
-#define H_15 0x7E
-#define H_16 0x7F
-
-#define I_1 0x80
-#define I_2 0x81
-#define I_3 0x82
-#define I_4 0x83
-#define I_5 0x84
-#define I_6 0x85
-#define I_7 0x86
-#define I_8 0x87
-#define I_9 0x88
-#define I_10 0x89
-#define I_11 0x8A
-#define I_12 0x8B
-#define I_13 0x8C
-#define I_14 0x8D
-#define I_15 0x8E
-#define I_16 0x8F
-
-#define J_1 0x90
-#define J_2 0x91
-#define J_3 0x92
-#define J_4 0x93
-#define J_5 0x94
-#define J_6 0x95
-#define J_7 0x96
-#define J_8 0x97
-#define J_9 0x98
-#define J_10 0x99
-#define J_11 0x9A
-#define J_12 0x9B
-#define J_13 0x9C
-#define J_14 0x9D
-#define J_15 0x9E
-#define J_16 0x9F
-
-#define K_1 0xA0
-#define K_2 0xA1
-#define K_3 0xA2
-#define K_4 0xA3
-#define K_5 0xA4
-#define K_6 0xA5
-#define K_7 0xA6
-#define K_8 0xA7
-#define K_9 0xA8
-#define K_10 0xA9
-#define K_11 0xAA
-#define K_12 0xAB
-#define K_13 0xAC
-#define K_14 0xAD
-#define K_15 0xAE
-#define K_16 0xAF
-
-#define L_1 0xB0
-#define L_2 0xB1
-#define L_3 0xB2
-#define L_4 0xB3
-#define L_5 0xB4
-#define L_6 0xB5
-#define L_7 0xB6
-#define L_8 0xB7
-#define L_9 0xB8
-#define L_10 0xB9
-#define L_11 0xBA
-#define L_12 0xBB
-#define L_13 0xBC
-#define L_14 0xBD
-#define L_15 0xBE
-#define L_16 0xBF
diff --git a/drivers/issi/is31fl3736.c b/drivers/issi/is31fl3736.c
deleted file mode 100644
index 7dece1b1eb..0000000000
--- a/drivers/issi/is31fl3736.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/* Copyright 2018 Jason Williams (Wilba)
- *
- * 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 "is31fl3736.h"
-#include "i2c_master.h"
-#include "wait.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)
-// The address will vary depending on your wiring:
-// 00 <-> GND
-// 01 <-> SCL
-// 10 <-> SDA
-// 11 <-> VCC
-// ADDR1 represents A1:A0 of the 7-bit address.
-// ADDR2 represents A3:A2 of the 7-bit address.
-// The result is: 0b101(ADDR2)(ADDR1)
-#define ISSI_ADDR_DEFAULT 0x50
-
-#define ISSI_COMMANDREGISTER 0xFD
-#define ISSI_COMMANDREGISTER_WRITELOCK 0xFE
-#define ISSI_INTERRUPTMASKREGISTER 0xF0
-#define ISSI_INTERRUPTSTATUSREGISTER 0xF1
-
-#define ISSI_PAGE_LEDCONTROL 0x00 // PG0
-#define ISSI_PAGE_PWM 0x01 // PG1
-#define ISSI_PAGE_AUTOBREATH 0x02 // PG2
-#define ISSI_PAGE_FUNCTION 0x03 // PG3
-
-#define ISSI_REG_CONFIGURATION 0x00 // PG3
-#define ISSI_REG_GLOBALCURRENT 0x01 // PG3
-#define ISSI_REG_RESET 0x11 // PG3
-#define ISSI_REG_SWPULLUP 0x0F // PG3
-#define ISSI_REG_CSPULLUP 0x10 // PG3
-
-#ifndef ISSI_TIMEOUT
-# define ISSI_TIMEOUT 100
-#endif
-
-#ifndef ISSI_PERSISTENCE
-# define ISSI_PERSISTENCE 0
-#endif
-
-// Transfer buffer for TWITransmitData()
-uint8_t g_twi_transfer_buffer[20];
-
-// These buffers match the IS31FL3736 PWM registers.
-// The control buffers match the PG0 LED On/Off registers.
-// Storing them like this is optimal for I2C transfers to the registers.
-// We could optimize this and take out the unused registers from these
-// buffers and the transfers in IS31FL3736_write_pwm_buffer() but it's
-// probably not worth the extra complexity.
-uint8_t g_pwm_buffer[DRIVER_COUNT][192];
-bool g_pwm_buffer_update_required = false;
-
-uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}, {0}};
-bool g_led_control_registers_update_required = false;
-
-void IS31FL3736_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
- g_twi_transfer_buffer[0] = reg;
- g_twi_transfer_buffer[1] = data;
-
-#if ISSI_PERSISTENCE > 0
- for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
- }
-#else
- i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
-#endif
-}
-
-void IS31FL3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
- // assumes PG1 is already selected
-
- // transmit PWM registers in 12 transfers of 16 bytes
- // g_twi_transfer_buffer[] is 20 bytes
-
- // iterate over the pwm_buffer contents at 16 byte intervals
- for (int i = 0; i < 192; i += 16) {
- g_twi_transfer_buffer[0] = i;
- // copy the data from i to i+15
- // device will auto-increment register for data after the first byte
- // thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer
- for (int j = 0; j < 16; j++) {
- g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
- }
-
-#if ISSI_PERSISTENCE > 0
- for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) break;
- }
-#else
- i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT);
-#endif
- }
-}
-
-void IS31FL3736_init(uint8_t addr) {
- // In order to avoid the LEDs being driven with garbage data
- // in the LED driver's PWM registers, shutdown is enabled last.
- // Set up the mode and other settings, clear the PWM registers,
- // then disable software shutdown.
-
- // Unlock the command register.
- IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
-
- // Select PG0
- IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
- // Turn off all LEDs.
- for (int i = 0x00; i <= 0x17; i++) {
- IS31FL3736_write_register(addr, i, 0x00);
- }
-
- // Unlock the command register.
- IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
-
- // Select PG1
- IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
- // Set PWM on all LEDs to 0
- // No need to setup Breath registers to PWM as that is the default.
- for (int i = 0x00; i <= 0xBF; i++) {
- IS31FL3736_write_register(addr, i, 0x00);
- }
-
- // Unlock the command register.
- IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
-
- // Select PG3
- IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
- // Set global current to maximum.
- IS31FL3736_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
- // Disable software shutdown.
- IS31FL3736_write_register(addr, ISSI_REG_CONFIGURATION, 0x01);
-
- // Wait 10ms to ensure the device has woken up.
- wait_ms(10);
-}
-
-void IS31FL3736_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];
-
- g_pwm_buffer[led.driver][led.r] = red;
- g_pwm_buffer[led.driver][led.g] = green;
- g_pwm_buffer[led.driver][led.b] = blue;
- g_pwm_buffer_update_required = true;
- }
-}
-
-void IS31FL3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
- IS31FL3736_set_color(i, red, green, blue);
- }
-}
-
-void IS31FL3736_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
- is31_led led = g_is31_leds[index];
-
- // IS31FL3733
- // The PWM register for a matrix position (0x00 to 0xBF) can be
- // divided by 8 to get the LED control register (0x00 to 0x17),
- // then mod 8 to get the bit position within that register.
-
- // IS31FL3736
- // The PWM register for a matrix position (0x00 to 0xBF) is interleaved, so:
- // A1=0x00 A2=0x02 A3=0x04 A4=0x06 A5=0x08 A6=0x0A A7=0x0C A8=0x0E
- // B1=0x10 B2=0x12 B3=0x14
- // But also, the LED control registers (0x00 to 0x17) are also interleaved, so:
- // A1-A4=0x00 A5-A8=0x01
- // So, the same math applies.
-
- uint8_t control_register_r = led.r / 8;
- uint8_t control_register_g = led.g / 8;
- uint8_t control_register_b = led.b / 8;
-
- uint8_t bit_r = led.r % 8;
- uint8_t bit_g = led.g % 8;
- uint8_t bit_b = led.b % 8;
-
- if (red) {
- g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r);
- } else {
- g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r);
- }
- if (green) {
- g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g);
- } else {
- g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g);
- }
- if (blue) {
- g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b);
- } else {
- g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b);
- }
-
- g_led_control_registers_update_required = true;
-}
-
-void IS31FL3736_mono_set_brightness(int index, uint8_t value) {
- if (index >= 0 && index < 96) {
- // Index in range 0..95 -> A1..A8, B1..B8, etc.
- // Map index 0..95 to registers 0x00..0xBE (interleaved)
- uint8_t pwm_register = index * 2;
- g_pwm_buffer[0][pwm_register] = value;
- g_pwm_buffer_update_required = true;
- }
-}
-
-void IS31FL3736_mono_set_brightness_all(uint8_t value) {
- for (int i = 0; i < 96; i++) {
- IS31FL3736_mono_set_brightness(i, value);
- }
-}
-
-void IS31FL3736_mono_set_led_control_register(uint8_t index, bool enabled) {
- // Index in range 0..95 -> A1..A8, B1..B8, etc.
-
- // Map index 0..95 to registers 0x00..0xBE (interleaved)
- uint8_t pwm_register = index * 2;
- // Map register 0x00..0xBE (interleaved) into control register and bit
- uint8_t control_register = pwm_register / 8;
- uint8_t bit = pwm_register % 8;
-
- if (enabled) {
- g_led_control_registers[0][control_register] |= (1 << bit);
- } else {
- g_led_control_registers[0][control_register] &= ~(1 << bit);
- }
-
- g_led_control_registers_update_required = true;
-}
-
-void IS31FL3736_update_pwm_buffers(uint8_t addr1, uint8_t addr2) {
- if (g_pwm_buffer_update_required) {
- // Firstly we need to unlock the command register and select PG1
- IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
- IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
-
- IS31FL3736_write_pwm_buffer(addr1, g_pwm_buffer[0]);
- // IS31FL3736_write_pwm_buffer(addr2, g_pwm_buffer[1]);
- }
- g_pwm_buffer_update_required = false;
-}
-
-void IS31FL3736_update_led_control_registers(uint8_t addr1, uint8_t addr2) {
- if (g_led_control_registers_update_required) {
- // Firstly we need to unlock the command register and select PG0
- IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
- IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
- for (int i = 0; i < 24; i++) {
- IS31FL3736_write_register(addr1, i, g_led_control_registers[0][i]);
- // IS31FL3736_write_register(addr2, i, g_led_control_registers[1][i]);
- }
- g_led_control_registers_update_required = false;
- }
-}
diff --git a/drivers/issi/is31fl3736.h b/drivers/issi/is31fl3736.h
deleted file mode 100644
index e48e31c279..0000000000
--- a/drivers/issi/is31fl3736.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/* Copyright 2018 Jason Williams (Wilba)
- *
- * 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 .
- */
-
-#pragma once
-
-#include
-#include
-
-// Simple interface option.
-// If these aren't defined, just define them to make it compile
-
-#ifndef DRIVER_COUNT
-# define DRIVER_COUNT 2
-#endif
-
-#ifndef DRIVER_LED_TOTAL
-# define DRIVER_LED_TOTAL 96
-#endif
-
-typedef struct is31_led {
- uint8_t driver : 2;
- uint8_t r;
- uint8_t g;
- uint8_t b;
-} __attribute__((packed)) is31_led;
-
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
-
-void IS31FL3736_init(uint8_t addr);
-void IS31FL3736_write_register(uint8_t addr, uint8_t reg, uint8_t data);
-void IS31FL3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
-
-void IS31FL3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
-void IS31FL3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
-
-void IS31FL3736_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
-
-void IS31FL3736_mono_set_brightness(int index, uint8_t value);
-void IS31FL3736_mono_set_brightness_all(uint8_t value);
-void IS31FL3736_mono_set_led_control_register(uint8_t index, bool enabled);
-
-// This should not be called from an interrupt
-// (eg. from a timer interrupt).
-// Call this while idle (in between matrix scans).
-// If the buffer is dirty, it will update the driver with the buffer.
-void IS31FL3736_update_pwm_buffers(uint8_t addr1, uint8_t addr2);
-void IS31FL3736_update_led_control_registers(uint8_t addr1, uint8_t addr2);
-
-#define A_1 0x00
-#define A_2 0x02
-#define A_3 0x04
-#define A_4 0x06
-#define A_5 0x08
-#define A_6 0x0A
-#define A_7 0x0C
-#define A_8 0x0E
-
-#define B_1 0x10
-#define B_2 0x12
-#define B_3 0x14
-#define B_4 0x16
-#define B_5 0x18
-#define B_6 0x1A
-#define B_7 0x1C
-#define B_8 0x1E
-
-#define C_1 0x20
-#define C_2 0x22
-#define C_3 0x24
-#define C_4 0x26
-#define C_5 0x28
-#define C_6 0x2A
-#define C_7 0x2C
-#define C_8 0x2E
-
-#define D_1 0x30
-#define D_2 0x32
-#define D_3 0x34
-#define D_4 0x36
-#define D_5 0x38
-#define D_6 0x3A
-#define D_7 0x3C
-#define D_8 0x3E
-
-#define E_1 0x40
-#define E_2 0x42
-#define E_3 0x44
-#define E_4 0x46
-#define E_5 0x48
-#define E_6 0x4A
-#define E_7 0x4C
-#define E_8 0x4E
-
-#define F_1 0x50
-#define F_2 0x52
-#define F_3 0x54
-#define F_4 0x56
-#define F_5 0x58
-#define F_6 0x5A
-#define F_7 0x5C
-#define F_8 0x5E
-
-#define G_1 0x60
-#define G_2 0x62
-#define G_3 0x64
-#define G_4 0x66
-#define G_5 0x68
-#define G_6 0x6A
-#define G_7 0x6C
-#define G_8 0x6E
-
-#define H_1 0x70
-#define H_2 0x72
-#define H_3 0x74
-#define H_4 0x76
-#define H_5 0x78
-#define H_6 0x7A
-#define H_7 0x7C
-#define H_8 0x7E
-
-#define I_1 0x80
-#define I_2 0x82
-#define I_3 0x84
-#define I_4 0x86
-#define I_5 0x88
-#define I_6 0x8A
-#define I_7 0x8C
-#define I_8 0x8E
-
-#define J_1 0x90
-#define J_2 0x92
-#define J_3 0x94
-#define J_4 0x96
-#define J_5 0x98
-#define J_6 0x9A
-#define J_7 0x9C
-#define J_8 0x9E
-
-#define K_1 0xA0
-#define K_2 0xA2
-#define K_3 0xA4
-#define K_4 0xA6
-#define K_5 0xA8
-#define K_6 0xAA
-#define K_7 0xAC
-#define K_8 0xAE
-
-#define L_1 0xB0
-#define L_2 0xB2
-#define L_3 0xB4
-#define L_4 0xB6
-#define L_5 0xB8
-#define L_6 0xBA
-#define L_7 0xBC
-#define L_8 0xBE
diff --git a/drivers/issi/is31fl3737.c b/drivers/issi/is31fl3737.c
deleted file mode 100644
index 30906b4840..0000000000
--- a/drivers/issi/is31fl3737.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* Copyright 2017 Jason Williams
- * Copyright 2018 Jack Humbert
- * Copyright 2018 Yiancar
- *
- * 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 "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)
-// The address will vary depending on your wiring:
-// 00 <-> GND
-// 01 <-> SCL
-// 10 <-> SDA
-// 11 <-> VCC
-// ADDR1 represents A1:A0 of the 7-bit address.
-// ADDR2 represents A3:A2 of the 7-bit address.
-// The result is: 0b101(ADDR2)(ADDR1)
-#define ISSI_ADDR_DEFAULT 0x50
-
-#define ISSI_COMMANDREGISTER 0xFD
-#define ISSI_COMMANDREGISTER_WRITELOCK 0xFE
-#define ISSI_INTERRUPTMASKREGISTER 0xF0
-#define ISSI_INTERRUPTSTATUSREGISTER 0xF1
-
-#define ISSI_PAGE_LEDCONTROL 0x00 // PG0
-#define ISSI_PAGE_PWM 0x01 // PG1
-#define ISSI_PAGE_AUTOBREATH 0x02 // PG2
-#define ISSI_PAGE_FUNCTION 0x03 // PG3
-
-#define ISSI_REG_CONFIGURATION 0x00 // PG3
-#define ISSI_REG_GLOBALCURRENT 0x01 // PG3
-#define ISSI_REG_RESET 0x11 // PG3
-#define ISSI_REG_SWPULLUP 0x0F // PG3
-#define ISSI_REG_CSPULLUP 0x10 // PG3
-
-#ifndef ISSI_TIMEOUT
-# define ISSI_TIMEOUT 100
-#endif
-
-#ifndef ISSI_PERSISTENCE
-# define ISSI_PERSISTENCE 0
-#endif
-
-// Transfer buffer for TWITransmitData()
-uint8_t g_twi_transfer_buffer[20];
-
-// These buffers match the IS31FL3737 PWM registers.
-// The control buffers match the PG0 LED On/Off registers.
-// Storing them like this is optimal for I2C transfers to the registers.
-// We could optimize this and take out the unused registers from these
-// buffers and the transfers in IS31FL3737_write_pwm_buffer() but it's
-// probably not worth the extra complexity.
-
-uint8_t g_pwm_buffer[DRIVER_COUNT][192];
-bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
-
-uint8_t g_led_control_registers[DRIVER_COUNT][24] = {0};
-bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
-
-void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
- g_twi_transfer_buffer[0] = reg;
- g_twi_transfer_buffer[1] = data;
-
-#if ISSI_PERSISTENCE > 0
- for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
- }
-#else
- i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
-#endif
-}
-
-void IS31FL3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
- // assumes PG1 is already selected
-
- // transmit PWM registers in 12 transfers of 16 bytes
- // g_twi_transfer_buffer[] is 20 bytes
-
- // iterate over the pwm_buffer contents at 16 byte intervals
- for (int i = 0; i < 192; i += 16) {
- g_twi_transfer_buffer[0] = i;
- // copy the data from i to i+15
- // device will auto-increment register for data after the first byte
- // thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer
- for (int j = 0; j < 16; j++) {
- g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
- }
-
-#if ISSI_PERSISTENCE > 0
- for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) break;
- }
-#else
- i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT);
-#endif
- }
-}
-
-void IS31FL3737_init(uint8_t addr) {
- // In order to avoid the LEDs being driven with garbage data
- // in the LED driver's PWM registers, shutdown is enabled last.
- // Set up the mode and other settings, clear the PWM registers,
- // then disable software shutdown.
-
- // Unlock the command register.
- IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
-
- // Select PG0
- IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
- // Turn off all LEDs.
- for (int i = 0x00; i <= 0x17; i++) {
- IS31FL3737_write_register(addr, i, 0x00);
- }
-
- // Unlock the command register.
- IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
-
- // Select PG1
- IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
- // Set PWM on all LEDs to 0
- // No need to setup Breath registers to PWM as that is the default.
- for (int i = 0x00; i <= 0xBF; i++) {
- IS31FL3737_write_register(addr, i, 0x00);
- }
-
- // Unlock the command register.
- IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
-
- // Select PG3
- IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
- // Set global current to maximum.
- IS31FL3737_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
- // Disable software shutdown.
- IS31FL3737_write_register(addr, ISSI_REG_CONFIGURATION, 0x01);
-
- // Wait 10ms to ensure the device has woken up.
- wait_ms(10);
-}
-
-void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
- if (index >= 0 && index < DRIVER_LED_TOTAL) {
- // copy the led config from progmem to SRAM
- 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;
- g_pwm_buffer[led.driver][led.b] = blue;
- g_pwm_buffer_update_required[led.driver] = true;
- }
-}
-
-void IS31FL3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
- IS31FL3737_set_color(i, red, green, blue);
- }
-}
-
-void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
- // copy the led config from progmem to SRAM
- 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;
- uint8_t control_register_b = led.b / 8;
- uint8_t bit_r = led.r % 8;
- uint8_t bit_g = led.g % 8;
- uint8_t bit_b = led.b % 8;
-
- if (red) {
- g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r);
- } else {
- g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r);
- }
- if (green) {
- g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g);
- } else {
- g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g);
- }
- if (blue) {
- g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b);
- } else {
- g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b);
- }
-
- g_led_control_registers_update_required[led.driver] = true;
-}
-
-void IS31FL3737_update_pwm_buffers(uint8_t addr, uint8_t index) {
- if (g_pwm_buffer_update_required[index]) {
- // Firstly we need to unlock the command register and select PG1
- IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
- IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
-
- IS31FL3737_write_pwm_buffer(addr, g_pwm_buffer[index]);
- }
- g_pwm_buffer_update_required[index] = false;
-}
-
-void IS31FL3737_update_led_control_registers(uint8_t addr, uint8_t index) {
- if (g_led_control_registers_update_required[index]) {
- // Firstly we need to unlock the command register and select PG0
- IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
- IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
- for (int i = 0; i < 24; i++) {
- IS31FL3737_write_register(addr, i, g_led_control_registers[index][i]);
- }
- }
- g_led_control_registers_update_required[index] = false;
-}
diff --git a/drivers/issi/is31fl3737.h b/drivers/issi/is31fl3737.h
deleted file mode 100644
index a1d2281778..0000000000
--- a/drivers/issi/is31fl3737.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/* Copyright 2017 Jason Williams
- * Copyright 2018 Jack Humbert
- * Copyright 2018 Yiancar
- *
- * 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 .
- */
-
-#pragma once
-
-#include
-#include
-
-typedef struct is31_led {
- uint8_t driver : 2;
- uint8_t r;
- uint8_t g;
- uint8_t b;
-} __attribute__((packed)) is31_led;
-
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
-
-void IS31FL3737_init(uint8_t addr);
-void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data);
-void IS31FL3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
-
-void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
-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);
-
-// This should not be called from an interrupt
-// (eg. from a timer interrupt).
-// Call this while idle (in between matrix scans).
-// If the buffer is dirty, it will update the driver with the buffer.
-void IS31FL3737_update_pwm_buffers(uint8_t addr1, uint8_t addr2);
-void IS31FL3737_update_led_control_registers(uint8_t addr1, uint8_t addr2);
-
-#define A_1 0x00
-#define A_2 0x01
-#define A_3 0x02
-#define A_4 0x03
-#define A_5 0x04
-#define A_6 0x05
-#define A_7 0x08
-#define A_8 0x09
-#define A_9 0x0A
-#define A_10 0x0B
-#define A_11 0x0C
-#define A_12 0x0D
-
-#define B_1 0x10
-#define B_2 0x11
-#define B_3 0x12
-#define B_4 0x13
-#define B_5 0x14
-#define B_6 0x15
-#define B_7 0x18
-#define B_8 0x19
-#define B_9 0x1A
-#define B_10 0x1B
-#define B_11 0x1C
-#define B_12 0x1D
-
-#define C_1 0x20
-#define C_2 0x21
-#define C_3 0x22
-#define C_4 0x23
-#define C_5 0x24
-#define C_6 0x25
-#define C_7 0x28
-#define C_8 0x29
-#define C_9 0x2A
-#define C_10 0x2B
-#define C_11 0x2C
-#define C_12 0x2D
-
-#define D_1 0x30
-#define D_2 0x31
-#define D_3 0x32
-#define D_4 0x33
-#define D_5 0x34
-#define D_6 0x35
-#define D_7 0x38
-#define D_8 0x39
-#define D_9 0x3A
-#define D_10 0x3B
-#define D_11 0x3C
-#define D_12 0x3D
-
-#define E_1 0x40
-#define E_2 0x41
-#define E_3 0x42
-#define E_4 0x43
-#define E_5 0x44
-#define E_6 0x45
-#define E_7 0x48
-#define E_8 0x49
-#define E_9 0x4A
-#define E_10 0x4B
-#define E_11 0x4C
-#define E_12 0x4D
-
-#define F_1 0x50
-#define F_2 0x51
-#define F_3 0x52
-#define F_4 0x53
-#define F_5 0x54
-#define F_6 0x55
-#define F_7 0x58
-#define F_8 0x59
-#define F_9 0x5A
-#define F_10 0x5B
-#define F_11 0x5C
-#define F_12 0x5D
-
-#define G_1 0x60
-#define G_2 0x61
-#define G_3 0x62
-#define G_4 0x63
-#define G_5 0x64
-#define G_6 0x65
-#define G_7 0x68
-#define G_8 0x69
-#define G_9 0x6A
-#define G_10 0x6B
-#define G_11 0x6C
-#define G_12 0x6D
-
-#define H_1 0x70
-#define H_2 0x71
-#define H_3 0x72
-#define H_4 0x73
-#define H_5 0x74
-#define H_6 0x75
-#define H_7 0x78
-#define H_8 0x79
-#define H_9 0x7A
-#define H_10 0x7B
-#define H_11 0x7C
-#define H_12 0x7D
-
-#define I_1 0x80
-#define I_2 0x81
-#define I_3 0x82
-#define I_4 0x83
-#define I_5 0x84
-#define I_6 0x85
-#define I_7 0x88
-#define I_8 0x89
-#define I_9 0x8A
-#define I_10 0x8B
-#define I_11 0x8C
-#define I_12 0x8D
-
-#define J_1 0x90
-#define J_2 0x91
-#define J_3 0x92
-#define J_4 0x93
-#define J_5 0x94
-#define J_6 0x95
-#define J_7 0x98
-#define J_8 0x99
-#define J_9 0x9A
-#define J_10 0x9B
-#define J_11 0x9C
-#define J_12 0x9D
-
-#define K_1 0xA0
-#define K_2 0xA1
-#define K_3 0xA2
-#define K_4 0xA3
-#define K_5 0xA4
-#define K_6 0xA5
-#define K_7 0xA8
-#define K_8 0xA9
-#define K_9 0xAA
-#define K_10 0xAB
-#define K_11 0xAC
-#define K_12 0xAD
-
-#define L_1 0xB0
-#define L_2 0xB1
-#define L_3 0xB2
-#define L_4 0xB3
-#define L_5 0xB4
-#define L_6 0xB5
-#define L_7 0xB8
-#define L_8 0xB9
-#define L_9 0xBA
-#define L_10 0xBB
-#define L_11 0xBC
-#define L_12 0xBD
diff --git a/drivers/issi/is31fl3741.c b/drivers/issi/is31fl3741.c
deleted file mode 100644
index 1b533c9b6a..0000000000
--- a/drivers/issi/is31fl3741.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/* Copyright 2017 Jason Williams
- * Copyright 2018 Jack Humbert
- * Copyright 2018 Yiancar
- * Copyright 2020 MelGeek
- *
- * 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 "wait.h"
-
-#include "is31fl3741.h"
-#include
-#include "i2c_master.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)
-// The address will vary depending on your wiring:
-// 00 <-> GND
-// 01 <-> SCL
-// 10 <-> SDA
-// 11 <-> VCC
-// ADDR1 represents A1:A0 of the 7-bit address.
-// ADDR2 represents A3:A2 of the 7-bit address.
-// The result is: 0b101(ADDR2)(ADDR1)
-#define ISSI_ADDR_DEFAULT 0x60
-
-#define ISSI_COMMANDREGISTER 0xFD
-#define ISSI_COMMANDREGISTER_WRITELOCK 0xFE
-#define ISSI_INTERRUPTMASKREGISTER 0xF0
-#define ISSI_INTERRUPTSTATUSREGISTER 0xF1
-#define ISSI_IDREGISTER 0xFC
-
-#define ISSI_PAGE_PWM0 0x00 // PG0
-#define ISSI_PAGE_PWM1 0x01 // PG1
-#define ISSI_PAGE_SCALING_0 0x02 // PG2
-#define ISSI_PAGE_SCALING_1 0x03 // PG3
-#define ISSI_PAGE_FUNCTION 0x04 // PG4
-
-#define ISSI_REG_CONFIGURATION 0x00 // PG4
-#define ISSI_REG_GLOBALCURRENT 0x01 // PG4
-#define ISSI_REG_PULLDOWNUP 0x02 // PG4
-#define ISSI_REG_RESET 0x3F // PG4
-
-#ifndef ISSI_TIMEOUT
-# define ISSI_TIMEOUT 100
-#endif
-
-#ifndef ISSI_PERSISTENCE
-# define ISSI_PERSISTENCE 0
-#endif
-
-#define ISSI_MAX_LEDS 351
-
-// Transfer buffer for TWITransmitData()
-uint8_t g_twi_transfer_buffer[20] = {0xFF};
-
-// These buffers match the IS31FL3741 and IS31FL3741A PWM registers.
-// The scaling buffers match the PG2 and PG3 LED On/Off registers.
-// Storing them like this is optimal for I2C transfers to the registers.
-// We could optimize this and take out the unused registers from these
-// buffers and the transfers in IS31FL3741_write_pwm_buffer() but it's
-// probably not worth the extra complexity.
-uint8_t g_pwm_buffer[DRIVER_COUNT][ISSI_MAX_LEDS];
-bool g_pwm_buffer_update_required = false;
-bool g_scaling_registers_update_required[DRIVER_COUNT] = {false};
-
-uint8_t g_scaling_registers[DRIVER_COUNT][ISSI_MAX_LEDS];
-
-void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
- g_twi_transfer_buffer[0] = reg;
- g_twi_transfer_buffer[1] = data;
-
-#if ISSI_PERSISTENCE > 0
- for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
- }
-#else
- i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
-#endif
-}
-
-bool IS31FL3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
- // unlock the command register and select PG2
- IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
- IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM0);
-
- for (int i = 0; i < 342; i += 18) {
- if (i == 180) {
- // unlock the command register and select PG2
- IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
- IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM1);
- }
-
- g_twi_transfer_buffer[0] = i % 180;
- memcpy(g_twi_transfer_buffer + 1, pwm_buffer + i, 18);
-
-#if ISSI_PERSISTENCE > 0
- for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 19, ISSI_TIMEOUT) != 0) {
- return false;
- }
- }
-#else
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 19, ISSI_TIMEOUT) != 0) {
- return false;
- }
-#endif
- }
-
- // transfer the left cause the total number is 351
- g_twi_transfer_buffer[0] = 162;
- memcpy(g_twi_transfer_buffer + 1, pwm_buffer + 342, 9);
-
-#if ISSI_PERSISTENCE > 0
- for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 10, ISSI_TIMEOUT) != 0) {
- return false;
- }
- }
-#else
- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 10, ISSI_TIMEOUT) != 0) {
- return false;
- }
-#endif
-
- return true;
-}
-
-void IS31FL3741_init(uint8_t addr) {
- // In order to avoid the LEDs being driven with garbage data
- // in the LED driver's PWM registers, shutdown is enabled last.
- // Set up the mode and other settings, clear the PWM registers,
- // then disable software shutdown.
- // Unlock the command register.
-
- // Unlock the command register.
- IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
-
- // Select PG4
- IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
-
- // Set to Normal operation
- IS31FL3741_write_register(addr, ISSI_REG_CONFIGURATION, 0x01);
-
- // Set Golbal Current Control Register
- IS31FL3741_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
- // Set Pull up & Down for SWx CSy
- IS31FL3741_write_register(addr, ISSI_REG_PULLDOWNUP, 0x77);
-
- // IS31FL3741_update_led_scaling_registers(addr, 0xFF, 0xFF, 0xFF);
-
- // Wait 10ms to ensure the device has woken up.
- wait_ms(10);
-}
-
-void IS31FL3741_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];
-
- g_pwm_buffer[led.driver][led.r] = red;
- g_pwm_buffer[led.driver][led.g] = green;
- g_pwm_buffer[led.driver][led.b] = blue;
- g_pwm_buffer_update_required = true;
- }
-}
-
-void IS31FL3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
- IS31FL3741_set_color(i, red, green, blue);
- }
-}
-
-void IS31FL3741_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
- is31_led led = g_is31_leds[index];
-
- if (red) {
- g_scaling_registers[led.driver][led.r] = 0xFF;
- } else {
- g_scaling_registers[led.driver][led.r] = 0x00;
- }
-
- if (green) {
- g_scaling_registers[led.driver][led.g] = 0xFF;
- } else {
- g_scaling_registers[led.driver][led.g] = 0x00;
- }
-
- if (blue) {
- g_scaling_registers[led.driver][led.b] = 0xFF;
- } else {
- g_scaling_registers[led.driver][led.b] = 0x00;
- }
-
- g_scaling_registers_update_required[led.driver] = true;
-}
-
-void IS31FL3741_update_pwm_buffers(uint8_t addr1, uint8_t addr2) {
- if (g_pwm_buffer_update_required) {
- IS31FL3741_write_pwm_buffer(addr1, g_pwm_buffer[0]);
- }
-
- g_pwm_buffer_update_required = false;
-}
-
-void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue) {
- g_pwm_buffer[pled->driver][pled->r] = red;
- g_pwm_buffer[pled->driver][pled->g] = green;
- g_pwm_buffer[pled->driver][pled->b] = blue;
-
- g_pwm_buffer_update_required = true;
-}
-
-void IS31FL3741_update_led_control_registers(uint8_t addr, uint8_t index) {
- if (g_scaling_registers_update_required[index]) {
- // unlock the command register and select PG2
- IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
- IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_SCALING_0);
-
- // CS1_SW1 to CS30_SW6 are on PG2
- for (int i = CS1_SW1; i <= CS30_SW6; ++i) {
- IS31FL3741_write_register(addr, i, g_scaling_registers[0][i]);
- }
-
- // unlock the command register and select PG3
- IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
- IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_SCALING_1);
-
- // CS1_SW7 to CS39_SW9 are on PG3
- for (int i = CS1_SW7; i <= CS39_SW9; ++i) {
- IS31FL3741_write_register(addr, i - CS1_SW7, g_scaling_registers[0][i]);
- }
-
- g_scaling_registers_update_required[index] = false;
- }
-}
-
-void IS31FL3741_set_scaling_registers(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue) {
- g_scaling_registers[pled->driver][pled->r] = red;
- g_scaling_registers[pled->driver][pled->g] = green;
- g_scaling_registers[pled->driver][pled->b] = blue;
-
- g_scaling_registers_update_required[pled->driver] = true;
-}
diff --git a/drivers/issi/is31fl3741.h b/drivers/issi/is31fl3741.h
deleted file mode 100644
index 2df0c5b1a7..0000000000
--- a/drivers/issi/is31fl3741.h
+++ /dev/null
@@ -1,420 +0,0 @@
-/* Copyright 2017 Jason Williams
- * Copyright 2018 Jack Humbert
- * Copyright 2018 Yiancar
- * Copyright 2020 MelGeek
- *
- * 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 .
- */
-
-#pragma once
-
-#include
-#include
-
-typedef struct is31_led {
- uint32_t driver : 2;
- uint32_t r : 10;
- uint32_t g : 10;
- uint32_t b : 10;
-} __attribute__((packed)) is31_led;
-
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
-
-void IS31FL3741_init(uint8_t addr);
-void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data);
-bool IS31FL3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
-
-void IS31FL3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
-void IS31FL3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
-
-void IS31FL3741_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
-
-// This should not be called from an interrupt
-// (eg. from a timer interrupt).
-// Call this while idle (in between matrix scans).
-// If the buffer is dirty, it will update the driver with the buffer.
-void IS31FL3741_update_pwm_buffers(uint8_t addr1, uint8_t addr2);
-void IS31FL3741_update_led_control_registers(uint8_t addr1, uint8_t addr2);
-void IS31FL3741_set_scaling_registers(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue);
-
-void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue);
-
-#define CS1_SW1 0x00
-#define CS2_SW1 0x01
-#define CS3_SW1 0x02
-#define CS4_SW1 0x03
-#define CS5_SW1 0x04
-#define CS6_SW1 0x05
-#define CS7_SW1 0x06
-#define CS8_SW1 0x07
-#define CS9_SW1 0x08
-#define CS10_SW1 0x09
-#define CS11_SW1 0x0A
-#define CS12_SW1 0x0B
-#define CS13_SW1 0x0C
-#define CS14_SW1 0x0D
-#define CS15_SW1 0x0E
-#define CS16_SW1 0x0F
-#define CS17_SW1 0x10
-#define CS18_SW1 0x11
-#define CS19_SW1 0x12
-#define CS20_SW1 0x13
-#define CS21_SW1 0x14
-#define CS22_SW1 0x15
-#define CS23_SW1 0x16
-#define CS24_SW1 0x17
-#define CS25_SW1 0x18
-#define CS26_SW1 0x19
-#define CS27_SW1 0x1A
-#define CS28_SW1 0x1B
-#define CS29_SW1 0x1C
-#define CS30_SW1 0x1D
-
-#define CS1_SW2 0x1E
-#define CS2_SW2 0x1F
-#define CS3_SW2 0x20
-#define CS4_SW2 0x21
-#define CS5_SW2 0x22
-#define CS6_SW2 0x23
-#define CS7_SW2 0x24
-#define CS8_SW2 0x25
-#define CS9_SW2 0x26
-#define CS10_SW2 0x27
-#define CS11_SW2 0x28
-#define CS12_SW2 0x29
-#define CS13_SW2 0x2A
-#define CS14_SW2 0x2B
-#define CS15_SW2 0x2C
-#define CS16_SW2 0x2D
-#define CS17_SW2 0x2E
-#define CS18_SW2 0x2F
-#define CS19_SW2 0x30
-#define CS20_SW2 0x31
-#define CS21_SW2 0x32
-#define CS22_SW2 0x33
-#define CS23_SW2 0x34
-#define CS24_SW2 0x35
-#define CS25_SW2 0x36
-#define CS26_SW2 0x37
-#define CS27_SW2 0x38
-#define CS28_SW2 0x39
-#define CS29_SW2 0x3A
-#define CS30_SW2 0x3B
-
-#define CS1_SW3 0x3C
-#define CS2_SW3 0x3D
-#define CS3_SW3 0x3E
-#define CS4_SW3 0x3F
-#define CS5_SW3 0x40
-#define CS6_SW3 0x41
-#define CS7_SW3 0x42
-#define CS8_SW3 0x43
-#define CS9_SW3 0x44
-#define CS10_SW3 0x45
-#define CS11_SW3 0x46
-#define CS12_SW3 0x47
-#define CS13_SW3 0x48
-#define CS14_SW3 0x49
-#define CS15_SW3 0x4A
-#define CS16_SW3 0x4B
-#define CS17_SW3 0x4C
-#define CS18_SW3 0x4D
-#define CS19_SW3 0x4E
-#define CS20_SW3 0x4F
-#define CS21_SW3 0x50
-#define CS22_SW3 0x51
-#define CS23_SW3 0x52
-#define CS24_SW3 0x53
-#define CS25_SW3 0x54
-#define CS26_SW3 0x55
-#define CS27_SW3 0x56
-#define CS28_SW3 0x57
-#define CS29_SW3 0x58
-#define CS30_SW3 0x59
-
-#define CS1_SW4 0x5A
-#define CS2_SW4 0x5B
-#define CS3_SW4 0x5C
-#define CS4_SW4 0x5D
-#define CS5_SW4 0x5E
-#define CS6_SW4 0x5F
-#define CS7_SW4 0x60
-#define CS8_SW4 0x61
-#define CS9_SW4 0x62
-#define CS10_SW4 0x63
-#define CS11_SW4 0x64
-#define CS12_SW4 0x65
-#define CS13_SW4 0x66
-#define CS14_SW4 0x67
-#define CS15_SW4 0x68
-#define CS16_SW4 0x69
-#define CS17_SW4 0x6A
-#define CS18_SW4 0x6B
-#define CS19_SW4 0x6C
-#define CS20_SW4 0x6D
-#define CS21_SW4 0x6E
-#define CS22_SW4 0x6F
-#define CS23_SW4 0x70
-#define CS24_SW4 0x71
-#define CS25_SW4 0x72
-#define CS26_SW4 0x73
-#define CS27_SW4 0x74
-#define CS28_SW4 0x75
-#define CS29_SW4 0x76
-#define CS30_SW4 0x77
-
-#define CS1_SW5 0x78
-#define CS2_SW5 0x79
-#define CS3_SW5 0x7A
-#define CS4_SW5 0x7B
-#define CS5_SW5 0x7C
-#define CS6_SW5 0x7D
-#define CS7_SW5 0x7E
-#define CS8_SW5 0x7F
-#define CS9_SW5 0x80
-#define CS10_SW5 0x81
-#define CS11_SW5 0x82
-#define CS12_SW5 0x83
-#define CS13_SW5 0x84
-#define CS14_SW5 0x85
-#define CS15_SW5 0x86
-#define CS16_SW5 0x87
-#define CS17_SW5 0x88
-#define CS18_SW5 0x89
-#define CS19_SW5 0x8A
-#define CS20_SW5 0x8B
-#define CS21_SW5 0x8C
-#define CS22_SW5 0x8D
-#define CS23_SW5 0x8E
-#define CS24_SW5 0x8F
-#define CS25_SW5 0x90
-#define CS26_SW5 0x91
-#define CS27_SW5 0x92
-#define CS28_SW5 0x93
-#define CS29_SW5 0x94
-#define CS30_SW5 0x95
-
-#define CS1_SW6 0x96
-#define CS2_SW6 0x97
-#define CS3_SW6 0x98
-#define CS4_SW6 0x99
-#define CS5_SW6 0x9A
-#define CS6_SW6 0x9B
-#define CS7_SW6 0x9C
-#define CS8_SW6 0x9D
-#define CS9_SW6 0x9E
-#define CS10_SW6 0x9F
-#define CS11_SW6 0xA0
-#define CS12_SW6 0xA1
-#define CS13_SW6 0xA2
-#define CS14_SW6 0xA3
-#define CS15_SW6 0xA4
-#define CS16_SW6 0xA5
-#define CS17_SW6 0xA6
-#define CS18_SW6 0xA7
-#define CS19_SW6 0xA8
-#define CS20_SW6 0xA9
-#define CS21_SW6 0xAA
-#define CS22_SW6 0xAB
-#define CS23_SW6 0xAC
-#define CS24_SW6 0xAD
-#define CS25_SW6 0xAE
-#define CS26_SW6 0xAF
-#define CS27_SW6 0xB0
-#define CS28_SW6 0xB1
-#define CS29_SW6 0xB2
-#define CS30_SW6 0xB3
-
-#define CS1_SW7 0xB4
-#define CS2_SW7 0xB5
-#define CS3_SW7 0xB6
-#define CS4_SW7 0xB7
-#define CS5_SW7 0xB8
-#define CS6_SW7 0xB9
-#define CS7_SW7 0xBA
-#define CS8_SW7 0xBB
-#define CS9_SW7 0xBC
-#define CS10_SW7 0xBD
-#define CS11_SW7 0xBE
-#define CS12_SW7 0xBF
-#define CS13_SW7 0xC0
-#define CS14_SW7 0xC1
-#define CS15_SW7 0xC2
-#define CS16_SW7 0xC3
-#define CS17_SW7 0xC4
-#define CS18_SW7 0xC5
-#define CS19_SW7 0xC6
-#define CS20_SW7 0xC7
-#define CS21_SW7 0xC8
-#define CS22_SW7 0xC9
-#define CS23_SW7 0xCA
-#define CS24_SW7 0xCB
-#define CS25_SW7 0xCC
-#define CS26_SW7 0xCD
-#define CS27_SW7 0xCE
-#define CS28_SW7 0xCF
-#define CS29_SW7 0xD0
-#define CS30_SW7 0xD1
-
-#define CS1_SW8 0xD2
-#define CS2_SW8 0xD3
-#define CS3_SW8 0xD4
-#define CS4_SW8 0xD5
-#define CS5_SW8 0xD6
-#define CS6_SW8 0xD7
-#define CS7_SW8 0xD8
-#define CS8_SW8 0xD9
-#define CS9_SW8 0xDA
-#define CS10_SW8 0xDB
-#define CS11_SW8 0xDC
-#define CS12_SW8 0xDD
-#define CS13_SW8 0xDE
-#define CS14_SW8 0xDF
-#define CS15_SW8 0xE0
-#define CS16_SW8 0xE1
-#define CS17_SW8 0xE2
-#define CS18_SW8 0xE3
-#define CS19_SW8 0xE4
-#define CS20_SW8 0xE5
-#define CS21_SW8 0xE6
-#define CS22_SW8 0xE7
-#define CS23_SW8 0xE8
-#define CS24_SW8 0xE9
-#define CS25_SW8 0xEA
-#define CS26_SW8 0xEB
-#define CS27_SW8 0xEC
-#define CS28_SW8 0xED
-#define CS29_SW8 0xEE
-#define CS30_SW8 0xEF
-
-#define CS1_SW9 0xF0
-#define CS2_SW9 0xF1
-#define CS3_SW9 0xF2
-#define CS4_SW9 0xF3
-#define CS5_SW9 0xF4
-#define CS6_SW9 0xF5
-#define CS7_SW9 0xF6
-#define CS8_SW9 0xF7
-#define CS9_SW9 0xF8
-#define CS10_SW9 0xF9
-#define CS11_SW9 0xFA
-#define CS12_SW9 0xFB
-#define CS13_SW9 0xFC
-#define CS14_SW9 0xFD
-#define CS15_SW9 0xFE
-#define CS16_SW9 0xFF
-#define CS17_SW9 0x100
-#define CS18_SW9 0x101
-#define CS19_SW9 0x102
-#define CS20_SW9 0x103
-#define CS21_SW9 0x104
-#define CS22_SW9 0x105
-#define CS23_SW9 0x106
-#define CS24_SW9 0x107
-#define CS25_SW9 0x108
-#define CS26_SW9 0x109
-#define CS27_SW9 0x10A
-#define CS28_SW9 0x10B
-#define CS29_SW9 0x10C
-#define CS30_SW9 0x10D
-
-#define CS31_SW1 0x10E
-#define CS32_SW1 0x10F
-#define CS33_SW1 0x110
-#define CS34_SW1 0x111
-#define CS35_SW1 0x112
-#define CS36_SW1 0x113
-#define CS37_SW1 0x114
-#define CS38_SW1 0x115
-#define CS39_SW1 0x116
-
-#define CS31_SW2 0x117
-#define CS32_SW2 0x118
-#define CS33_SW2 0x119
-#define CS34_SW2 0x11A
-#define CS35_SW2 0x11B
-#define CS36_SW2 0x11C
-#define CS37_SW2 0x11D
-#define CS38_SW2 0x11E
-#define CS39_SW2 0x11F
-
-#define CS31_SW3 0x120
-#define CS32_SW3 0x121
-#define CS33_SW3 0x122
-#define CS34_SW3 0x123
-#define CS35_SW3 0x124
-#define CS36_SW3 0x125
-#define CS37_SW3 0x126
-#define CS38_SW3 0x127
-#define CS39_SW3 0x128
-
-#define CS31_SW4 0x129
-#define CS32_SW4 0x12A
-#define CS33_SW4 0x12B
-#define CS34_SW4 0x12C
-#define CS35_SW4 0x12D
-#define CS36_SW4 0x12E
-#define CS37_SW4 0x12F
-#define CS38_SW4 0x130
-#define CS39_SW4 0x131
-
-#define CS31_SW5 0x132
-#define CS32_SW5 0x133
-#define CS33_SW5 0x134
-#define CS34_SW5 0x135
-#define CS35_SW5 0x136
-#define CS36_SW5 0x137
-#define CS37_SW5 0x138
-#define CS38_SW5 0x139
-#define CS39_SW5 0x13A
-
-#define CS31_SW6 0x13B
-#define CS32_SW6 0x13C
-#define CS33_SW6 0x13D
-#define CS34_SW6 0x13E
-#define CS35_SW6 0x13F
-#define CS36_SW6 0x140
-#define CS37_SW6 0x141
-#define CS38_SW6 0x142
-#define CS39_SW6 0x143
-
-#define CS31_SW7 0x144
-#define CS32_SW7 0x145
-#define CS33_SW7 0x146
-#define CS34_SW7 0x147
-#define CS35_SW7 0x148
-#define CS36_SW7 0x149
-#define CS37_SW7 0x14A
-#define CS38_SW7 0x14B
-#define CS39_SW7 0x14C
-
-#define CS31_SW8 0x14D
-#define CS32_SW8 0x14E
-#define CS33_SW8 0x14F
-#define CS34_SW8 0x150
-#define CS35_SW8 0x151
-#define CS36_SW8 0x152
-#define CS37_SW8 0x153
-#define CS38_SW8 0x154
-#define CS39_SW8 0x155
-
-#define CS31_SW9 0x156
-#define CS32_SW9 0x157
-#define CS33_SW9 0x158
-#define CS34_SW9 0x159
-#define CS35_SW9 0x15A
-#define CS36_SW9 0x15B
-#define CS37_SW9 0x15C
-#define CS38_SW9 0x15D
-#define CS39_SW9 0x15E
diff --git a/drivers/led/apa102.c b/drivers/led/apa102.c
new file mode 100644
index 0000000000..7396dc3c55
--- /dev/null
+++ b/drivers/led/apa102.c
@@ -0,0 +1,151 @@
+/* Copyright 2020 Aldehir Rojas
+ * Copyright 2017 Mikkel (Duckle29)
+ *
+ * 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 "apa102.h"
+#include "quantum.h"
+
+#ifndef APA102_NOPS
+# if defined(__AVR__)
+# define APA102_NOPS 0 // AVR at 16 MHz already spends 62.5 ns per clock, so no extra delay is needed
+# elif defined(PROTOCOL_CHIBIOS)
+
+# include "hal.h"
+# if defined(STM32F0XX) || defined(STM32F1XX) || defined(STM32F3XX) || defined(STM32F4XX) || defined(STM32L0XX)
+# define APA102_NOPS (100 / (1000000000L / (STM32_SYSCLK / 4))) // This calculates how many loops of 4 nops to run to delay 100 ns
+# else
+# error("APA102_NOPS configuration required")
+# define APA102_NOPS 0 // this just pleases the compile so the above error is easier to spot
+# endif
+# endif
+#endif
+
+#define io_wait \
+ do { \
+ for (int i = 0; i < APA102_NOPS; i++) { \
+ __asm__ volatile("nop\n\t" \
+ "nop\n\t" \
+ "nop\n\t" \
+ "nop\n\t"); \
+ } \
+ } while (0)
+
+#define APA102_SEND_BIT(byte, bit) \
+ do { \
+ writePin(RGB_DI_PIN, (byte >> bit) & 1); \
+ io_wait; \
+ writePinHigh(RGB_CI_PIN); \
+ io_wait; \
+ writePinLow(RGB_CI_PIN); \
+ io_wait; \
+ } while (0)
+
+uint8_t apa102_led_brightness = APA102_DEFAULT_BRIGHTNESS;
+
+void static apa102_start_frame(void);
+void static apa102_end_frame(uint16_t num_leds);
+
+void static apa102_send_frame(uint8_t red, uint8_t green, uint8_t blue, uint8_t brightness);
+void static apa102_send_byte(uint8_t byte);
+
+void apa102_setleds(LED_TYPE *start_led, uint16_t num_leds) {
+ LED_TYPE *end = start_led + num_leds;
+
+ apa102_start_frame();
+ for (LED_TYPE *led = start_led; led < end; led++) {
+ apa102_send_frame(led->r, led->g, led->b, apa102_led_brightness);
+ }
+ apa102_end_frame(num_leds);
+}
+
+// Overwrite the default rgblight_call_driver to use apa102 driver
+void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { apa102_setleds(start_led, num_leds); }
+
+void static apa102_init(void) {
+ setPinOutput(RGB_DI_PIN);
+ setPinOutput(RGB_CI_PIN);
+
+ writePinLow(RGB_DI_PIN);
+ writePinLow(RGB_CI_PIN);
+}
+
+void apa102_set_brightness(uint8_t brightness) {
+ if (brightness > APA102_MAX_BRIGHTNESS) {
+ apa102_led_brightness = APA102_MAX_BRIGHTNESS;
+ } else if (brightness < 0) {
+ apa102_led_brightness = 0;
+ } else {
+ apa102_led_brightness = brightness;
+ }
+}
+
+void static apa102_send_frame(uint8_t red, uint8_t green, uint8_t blue, uint8_t brightness) {
+ apa102_send_byte(0b11100000 | brightness);
+ apa102_send_byte(blue);
+ apa102_send_byte(green);
+ apa102_send_byte(red);
+}
+
+void static apa102_start_frame(void) {
+ apa102_init();
+ for (uint16_t i = 0; i < 4; i++) {
+ apa102_send_byte(0);
+ }
+}
+
+void static apa102_end_frame(uint16_t num_leds) {
+ // This function has been taken from: https://github.com/pololu/apa102-arduino/blob/master/APA102.h
+ // and adapted. The code is MIT licensed. I think thats compatible?
+ //
+ // The data stream seen by the last LED in the chain will be delayed by
+ // (count - 1) clock edges, because each LED before it inverts the clock
+ // line and delays the data by one clock edge. Therefore, to make sure
+ // the last LED actually receives the data we wrote, the number of extra
+ // edges we send at the end of the frame must be at least (count - 1).
+ //
+ // Assuming we only want to send these edges in groups of size K, the
+ // C/C++ expression for the minimum number of groups to send is:
+ //
+ // ((count - 1) + (K - 1)) / K
+ //
+ // The C/C++ expression above is just (count - 1) divided by K,
+ // rounded up to the nearest whole number if there is a remainder.
+ //
+ // We set K to 16 and use the formula above as the number of frame-end
+ // bytes to transfer. Each byte has 16 clock edges.
+ //
+ // We are ignoring the specification for the end frame in the APA102
+ // datasheet, which says to send 0xFF four times, because it does not work
+ // when you have 66 LEDs or more, and also it results in unwanted white
+ // pixels if you try to update fewer LEDs than are on your LED strip.
+ uint16_t iterations = (num_leds + 14) / 16;
+ for (uint16_t i = 0; i < iterations; i++) {
+ apa102_send_byte(0);
+ }
+
+ apa102_init();
+}
+
+void static apa102_send_byte(uint8_t byte) {
+ APA102_SEND_BIT(byte, 7);
+ APA102_SEND_BIT(byte, 6);
+ APA102_SEND_BIT(byte, 5);
+ APA102_SEND_BIT(byte, 4);
+ APA102_SEND_BIT(byte, 3);
+ APA102_SEND_BIT(byte, 2);
+ APA102_SEND_BIT(byte, 1);
+ APA102_SEND_BIT(byte, 0);
+}
diff --git a/drivers/led/apa102.h b/drivers/led/apa102.h
new file mode 100644
index 0000000000..58cf020c1e
--- /dev/null
+++ b/drivers/led/apa102.h
@@ -0,0 +1,41 @@
+/* Copyright 2020 Aldehir Rojas
+ * Copyright 2017 Mikkel (Duckle29)
+ *
+ * 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 .
+ */
+
+#pragma once
+
+#include "color.h"
+
+#ifndef APA102_DEFAULT_BRIGHTNESS
+# define APA102_DEFAULT_BRIGHTNESS 31
+#endif
+
+#define APA102_MAX_BRIGHTNESS 31
+
+extern uint8_t apa102_led_brightness;
+
+/* User Interface
+ *
+ * Input:
+ * start_led: An array of GRB data describing the LED colors
+ * num_leds: The number of LEDs to write
+ *
+ * The functions will perform the following actions:
+ * - Set the data-out pin as output
+ * - Send out the LED data
+ */
+void apa102_setleds(LED_TYPE *start_led, uint16_t num_leds);
+void apa102_set_brightness(uint8_t brightness);
diff --git a/drivers/led/aw20216.c b/drivers/led/aw20216.c
new file mode 100644
index 0000000000..c608c0ab44
--- /dev/null
+++ b/drivers/led/aw20216.c
@@ -0,0 +1,141 @@
+/* Copyright 2021 Jasper Chan
+ *
+ * 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 "aw20216.h"
+#include "spi_master.h"
+
+/* The AW20216 appears to be somewhat similar to the IS31FL743, although quite
+ * a few things are different, such as the command byte format and page ordering.
+ * The LED addresses start from 0x00 instead of 0x01.
+ */
+#define AWINIC_ID 0b1010 << 4
+
+#define AW_PAGE_FUNCTION 0x00 << 1 // PG0, Function registers
+#define AW_PAGE_PWM 0x01 << 1 // PG1, LED PWM control
+#define AW_PAGE_SCALING 0x02 << 1 // PG2, LED current scaling control
+#define AW_PAGE_PATCHOICE 0x03 << 1 // PG3, Pattern choice?
+#define AW_PAGE_PWMSCALING 0x04 << 1 // PG4, LED PWM + Scaling control?
+
+#define AW_WRITE 0
+#define AW_READ 1
+
+#define AW_REG_CONFIGURATION 0x00 // PG0
+#define AW_REG_GLOBALCURRENT 0x01 // PG0
+
+// Default value of AW_REG_CONFIGURATION
+// D7:D4 = 1011, SWSEL (SW1~SW12 active)
+// D3 = 0?, reserved (apparently this should be 1 but it doesn't seem to matter)
+// D2:D1 = 00, OSDE (open/short detection enable)
+// D0 = 0, CHIPEN (write 1 to enable LEDs when hardware enable pulled high)
+#define AW_CONFIG_DEFAULT 0b10110000
+#define AW_CHIPEN 1
+
+#define AW_PWM_REGISTER_COUNT 216
+
+#ifndef AW_SCALING_MAX
+# define AW_SCALING_MAX 150
+#endif
+
+#ifndef AW_GLOBAL_CURRENT_MAX
+# define AW_GLOBAL_CURRENT_MAX 150
+#endif
+
+#ifndef AW_SPI_DIVISOR
+# define AW_SPI_DIVISOR 4
+#endif
+
+uint8_t g_pwm_buffer[DRIVER_COUNT][AW_PWM_REGISTER_COUNT];
+bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
+
+bool AW20216_write(pin_t cs_pin, uint8_t page, uint8_t reg, uint8_t* data, uint8_t len) {
+ static uint8_t s_spi_transfer_buffer[2] = {0};
+
+ if (!spi_start(cs_pin, false, 0, AW_SPI_DIVISOR)) {
+ spi_stop();
+ return false;
+ }
+
+ s_spi_transfer_buffer[0] = (AWINIC_ID | page | AW_WRITE);
+ s_spi_transfer_buffer[1] = reg;
+
+ if (spi_transmit(s_spi_transfer_buffer, 2) != SPI_STATUS_SUCCESS) {
+ spi_stop();
+ return false;
+ }
+
+ if (spi_transmit(data, len) != SPI_STATUS_SUCCESS) {
+ spi_stop();
+ return false;
+ }
+
+ spi_stop();
+ return true;
+}
+
+static inline bool AW20216_write_register(pin_t cs_pin, uint8_t page, uint8_t reg, uint8_t value) {
+ // Little wrapper so callers need not care about sending a buffer
+ return AW20216_write(cs_pin, page, reg, &value, 1);
+}
+
+static void AW20216_init_scaling(pin_t cs_pin) {
+ // Set constant current to the max, control brightness with PWM
+ for (uint8_t i = 0; i < AW_PWM_REGISTER_COUNT; i++) {
+ AW20216_write_register(cs_pin, AW_PAGE_SCALING, i, AW_SCALING_MAX);
+ }
+}
+
+static inline void AW20216_init_current_limit(pin_t cs_pin) {
+ // Push config
+ AW20216_write_register(cs_pin, AW_PAGE_FUNCTION, AW_REG_GLOBALCURRENT, AW_GLOBAL_CURRENT_MAX);
+}
+
+static inline void AW20216_soft_enable(pin_t cs_pin) {
+ // Push config
+ AW20216_write_register(cs_pin, AW_PAGE_FUNCTION, AW_REG_CONFIGURATION, AW_CONFIG_DEFAULT | AW_CHIPEN);
+}
+
+void AW20216_init(pin_t cs_pin, pin_t en_pin) {
+ setPinOutput(en_pin);
+ writePinHigh(en_pin);
+
+ // Drivers should start with all scaling and PWM registers as off
+ AW20216_init_current_limit(cs_pin);
+ AW20216_init_scaling(cs_pin);
+
+ AW20216_soft_enable(cs_pin);
+}
+
+void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
+ aw_led led = g_aw_leds[index];
+
+ g_pwm_buffer[led.driver][led.r] = red;
+ g_pwm_buffer[led.driver][led.g] = green;
+ g_pwm_buffer[led.driver][led.b] = blue;
+ g_pwm_buffer_update_required[led.driver] = true;
+}
+
+void AW20216_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
+ for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
+ AW20216_set_color(i, red, green, blue);
+ }
+}
+
+void AW20216_update_pwm_buffers(pin_t cs_pin, uint8_t index) {
+ if (g_pwm_buffer_update_required[index]) {
+ AW20216_write(cs_pin, AW_PAGE_PWM, 0, g_pwm_buffer[index], AW_PWM_REGISTER_COUNT);
+ }
+ g_pwm_buffer_update_required[index] = false;
+}
diff --git a/drivers/led/aw20216.h b/drivers/led/aw20216.h
new file mode 100644
index 0000000000..c55d9605fc
--- /dev/null
+++ b/drivers/led/aw20216.h
@@ -0,0 +1,252 @@
+/* Copyright 2021 Jasper Chan (Gigahawk)
+ *
+ * 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 .
+ */
+
+#pragma once
+
+#include
+#include
+#include "gpio.h"
+
+typedef struct aw_led {
+ uint8_t driver : 2;
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+} aw_led;
+
+extern const aw_led g_aw_leds[DRIVER_LED_TOTAL];
+
+void AW20216_init(pin_t cs_pin, pin_t en_pin);
+void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
+void AW20216_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
+void AW20216_update_pwm_buffers(pin_t cs_pin, uint8_t index);
+
+#define CS1_SW1 0x00
+#define CS2_SW1 0x01
+#define CS3_SW1 0x02
+#define CS4_SW1 0x03
+#define CS5_SW1 0x04
+#define CS6_SW1 0x05
+#define CS7_SW1 0x06
+#define CS8_SW1 0x07
+#define CS9_SW1 0x08
+#define CS10_SW1 0x09
+#define CS11_SW1 0x0A
+#define CS12_SW1 0x0B
+#define CS13_SW1 0x0C
+#define CS14_SW1 0x0D
+#define CS15_SW1 0x0E
+#define CS16_SW1 0x0F
+#define CS17_SW1 0x10
+#define CS18_SW1 0x11
+#define CS1_SW2 0x12
+#define CS2_SW2 0x13
+#define CS3_SW2 0x14
+#define CS4_SW2 0x15
+#define CS5_SW2 0x16
+#define CS6_SW2 0x17
+#define CS7_SW2 0x18
+#define CS8_SW2 0x19
+#define CS9_SW2 0x1A
+#define CS10_SW2 0x1B
+#define CS11_SW2 0x1C
+#define CS12_SW2 0x1D
+#define CS13_SW2 0x1E
+#define CS14_SW2 0x1F
+#define CS15_SW2 0x20
+#define CS16_SW2 0x21
+#define CS17_SW2 0x22
+#define CS18_SW2 0x23
+#define CS1_SW3 0x24
+#define CS2_SW3 0x25
+#define CS3_SW3 0x26
+#define CS4_SW3 0x27
+#define CS5_SW3 0x28
+#define CS6_SW3 0x29
+#define CS7_SW3 0x2A
+#define CS8_SW3 0x2B
+#define CS9_SW3 0x2C
+#define CS10_SW3 0x2D
+#define CS11_SW3 0x2E
+#define CS12_SW3 0x2F
+#define CS13_SW3 0x30
+#define CS14_SW3 0x31
+#define CS15_SW3 0x32
+#define CS16_SW3 0x33
+#define CS17_SW3 0x34
+#define CS18_SW3 0x35
+#define CS1_SW4 0x36
+#define CS2_SW4 0x37
+#define CS3_SW4 0x38
+#define CS4_SW4 0x39
+#define CS5_SW4 0x3A
+#define CS6_SW4 0x3B
+#define CS7_SW4 0x3C
+#define CS8_SW4 0x3D
+#define CS9_SW4 0x3E
+#define CS10_SW4 0x3F
+#define CS11_SW4 0x40
+#define CS12_SW4 0x41
+#define CS13_SW4 0x42
+#define CS14_SW4 0x43
+#define CS15_SW4 0x44
+#define CS16_SW4 0x45
+#define CS17_SW4 0x46
+#define CS18_SW4 0x47
+#define CS1_SW5 0x48
+#define CS2_SW5 0x49
+#define CS3_SW5 0x4A
+#define CS4_SW5 0x4B
+#define CS5_SW5 0x4C
+#define CS6_SW5 0x4D
+#define CS7_SW5 0x4E
+#define CS8_SW5 0x4F
+#define CS9_SW5 0x50
+#define CS10_SW5 0x51
+#define CS11_SW5 0x52
+#define CS12_SW5 0x53
+#define CS13_SW5 0x54
+#define CS14_SW5 0x55
+#define CS15_SW5 0x56
+#define CS16_SW5 0x57
+#define CS17_SW5 0x58
+#define CS18_SW5 0x59
+#define CS1_SW6 0x5A
+#define CS2_SW6 0x5B
+#define CS3_SW6 0x5C
+#define CS4_SW6 0x5D
+#define CS5_SW6 0x5E
+#define CS6_SW6 0x5F
+#define CS7_SW6 0x60
+#define CS8_SW6 0x61
+#define CS9_SW6 0x62
+#define CS10_SW6 0x63
+#define CS11_SW6 0x64
+#define CS12_SW6 0x65
+#define CS13_SW6 0x66
+#define CS14_SW6 0x67
+#define CS15_SW6 0x68
+#define CS16_SW6 0x69
+#define CS17_SW6 0x6A
+#define CS18_SW6 0x6B
+#define CS1_SW7 0x6C
+#define CS2_SW7 0x6D
+#define CS3_SW7 0x6E
+#define CS4_SW7 0x6F
+#define CS5_SW7 0x70
+#define CS6_SW7 0x71
+#define CS7_SW7 0x72
+#define CS8_SW7 0x73
+#define CS9_SW7 0x74
+#define CS10_SW7 0x75
+#define CS11_SW7 0x76
+#define CS12_SW7 0x77
+#define CS13_SW7 0x78
+#define CS14_SW7 0x79
+#define CS15_SW7 0x7A
+#define CS16_SW7 0x7B
+#define CS17_SW7 0x7C
+#define CS18_SW7 0x7D
+#define CS1_SW8 0x7E
+#define CS2_SW8 0x7F
+#define CS3_SW8 0x80
+#define CS4_SW8 0x81
+#define CS5_SW8 0x82
+#define CS6_SW8 0x83
+#define CS7_SW8 0x84
+#define CS8_SW8 0x85
+#define CS9_SW8 0x86
+#define CS10_SW8 0x87
+#define CS11_SW8 0x88
+#define CS12_SW8 0x89
+#define CS13_SW8 0x8A
+#define CS14_SW8 0x8B
+#define CS15_SW8 0x8C
+#define CS16_SW8 0x8D
+#define CS17_SW8 0x8E
+#define CS18_SW8 0x8F
+#define CS1_SW9 0x90
+#define CS2_SW9 0x91
+#define CS3_SW9 0x92
+#define CS4_SW9 0x93
+#define CS5_SW9 0x94
+#define CS6_SW9 0x95
+#define CS7_SW9 0x96
+#define CS8_SW9 0x97
+#define CS9_SW9 0x98
+#define CS10_SW9 0x99
+#define CS11_SW9 0x9A
+#define CS12_SW9 0x9B
+#define CS13_SW9 0x9C
+#define CS14_SW9 0x9D
+#define CS15_SW9 0x9E
+#define CS16_SW9 0x9F
+#define CS17_SW9 0xA0
+#define CS18_SW9 0xA1
+#define CS1_SW10 0xA2
+#define CS2_SW10 0xA3
+#define CS3_SW10 0xA4
+#define CS4_SW10 0xA5
+#define CS5_SW10 0xA6
+#define CS6_SW10 0xA7
+#define CS7_SW10 0xA8
+#define CS8_SW10 0xA9
+#define CS9_SW10 0xAA
+#define CS10_SW10 0xAB
+#define CS11_SW10 0xAC
+#define CS12_SW10 0xAD
+#define CS13_SW10 0xAE
+#define CS14_SW10 0xAF
+#define CS15_SW10 0xB0
+#define CS16_SW10 0xB1
+#define CS17_SW10 0xB2
+#define CS18_SW10 0xB3
+#define CS1_SW11 0xB4
+#define CS2_SW11 0xB5
+#define CS3_SW11 0xB6
+#define CS4_SW11 0xB7
+#define CS5_SW11 0xB8
+#define CS6_SW11 0xB9
+#define CS7_SW11 0xBA
+#define CS8_SW11 0xBB
+#define CS9_SW11 0xBC
+#define CS10_SW11 0xBD
+#define CS11_SW11 0xBE
+#define CS12_SW11 0xBF
+#define CS13_SW11 0xC0
+#define CS14_SW11 0xC1
+#define CS15_SW11 0xC2
+#define CS16_SW11 0xC3
+#define CS17_SW11 0xC4
+#define CS18_SW11 0xC5
+#define CS1_SW12 0xC6
+#define CS2_SW12 0xC7
+#define CS3_SW12 0xC8
+#define CS4_SW12 0xC9
+#define CS5_SW12 0xCA
+#define CS6_SW12 0xCB
+#define CS7_SW12 0xCC
+#define CS8_SW12 0xCD
+#define CS9_SW12 0xCE
+#define CS10_SW12 0xCF
+#define CS11_SW12 0xD0
+#define CS12_SW12 0xD1
+#define CS13_SW12 0xD2
+#define CS14_SW12 0xD3
+#define CS15_SW12 0xD4
+#define CS16_SW12 0xD5
+#define CS17_SW12 0xD6
+#define CS18_SW12 0xD7
diff --git a/drivers/led/issi/is31fl3218.c b/drivers/led/issi/is31fl3218.c
new file mode 100644
index 0000000000..d43863ac4b
--- /dev/null
+++ b/drivers/led/issi/is31fl3218.c
@@ -0,0 +1,96 @@
+/* Copyright 2018 Jason Williams (Wilba)
+ *
+ * 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 "is31fl3218.h"
+#include "i2c_master.h"
+
+// This is the full 8-bit address
+#define ISSI_ADDRESS 0b10101000
+
+// These are the register addresses
+#define ISSI_REG_SHUTDOWN 0x00
+#define ISSI_REG_PWM 0x01
+#define ISSI_REG_CONTROL 0x13
+#define ISSI_REG_UPDATE 0x16
+#define ISSI_REG_RESET 0x17
+
+// Default timeout if no I2C response
+#define ISSI_TIMEOUT 100
+
+// Reusable buffer for transfers
+uint8_t g_twi_transfer_buffer[20];
+
+// IS31FL3218 has 18 PWM outputs and a fixed I2C address, so no chaining.
+// If used as RGB LED driver, LEDs are assigned RGB,RGB,RGB,RGB,RGB,RGB
+uint8_t g_pwm_buffer[18];
+bool g_pwm_buffer_update_required = false;
+
+void IS31FL3218_write_register(uint8_t reg, uint8_t data) {
+ g_twi_transfer_buffer[0] = reg;
+ g_twi_transfer_buffer[1] = data;
+ i2c_transmit(ISSI_ADDRESS, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
+}
+
+void IS31FL3218_write_pwm_buffer(uint8_t *pwm_buffer) {
+ g_twi_transfer_buffer[0] = ISSI_REG_PWM;
+ for (int i = 0; i < 18; i++) {
+ g_twi_transfer_buffer[1 + i] = pwm_buffer[i];
+ }
+
+ i2c_transmit(ISSI_ADDRESS, g_twi_transfer_buffer, 19, ISSI_TIMEOUT);
+}
+
+void IS31FL3218_init(void) {
+ // In case we ever want to reinitialize (?)
+ IS31FL3218_write_register(ISSI_REG_RESET, 0x00);
+
+ // Turn off software shutdown
+ IS31FL3218_write_register(ISSI_REG_SHUTDOWN, 0x01);
+
+ // Set all PWM values to zero
+ for (uint8_t i = 0; i < 18; i++) {
+ IS31FL3218_write_register(ISSI_REG_PWM + i, 0x00);
+ }
+
+ // Enable all channels
+ for (uint8_t i = 0; i < 3; i++) {
+ IS31FL3218_write_register(ISSI_REG_CONTROL + i, 0b00111111);
+ }
+
+ // Load PWM registers and LED Control register data
+ IS31FL3218_write_register(ISSI_REG_UPDATE, 0x01);
+}
+
+void IS31FL3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
+ g_pwm_buffer[index * 3 + 0] = red;
+ g_pwm_buffer[index * 3 + 1] = green;
+ g_pwm_buffer[index * 3 + 2] = blue;
+ g_pwm_buffer_update_required = true;
+}
+
+void IS31FL3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
+ for (int i = 0; i < 6; i++) {
+ IS31FL3218_set_color(i, red, green, blue);
+ }
+}
+
+void IS31FL3218_update_pwm_buffers(void) {
+ if (g_pwm_buffer_update_required) {
+ IS31FL3218_write_pwm_buffer(g_pwm_buffer);
+ // Load PWM registers and LED Control register data
+ IS31FL3218_write_register(ISSI_REG_UPDATE, 0x01);
+ }
+ g_pwm_buffer_update_required = false;
+}
diff --git a/drivers/led/issi/is31fl3218.h b/drivers/led/issi/is31fl3218.h
new file mode 100644
index 0000000000..fa760da191
--- /dev/null
+++ b/drivers/led/issi/is31fl3218.h
@@ -0,0 +1,25 @@
+/* Copyright 2018 Jason Williams (Wilba)
+ *
+ * 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 .
+ */
+
+#pragma once
+
+#include
+#include
+
+void IS31FL3218_init(void);
+void IS31FL3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
+void IS31FL3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
+void IS31FL3218_update_pwm_buffers(void);
diff --git a/drivers/led/issi/is31fl3731-simple.c b/drivers/led/issi/is31fl3731-simple.c
new file mode 100644
index 0000000000..d295772f5e
--- /dev/null
+++ b/drivers/led/issi/is31fl3731-simple.c
@@ -0,0 +1,233 @@
+/* Copyright 2017 Jason Williams
+ * Copyright 2018 Jack Humbert
+ * Copyright 2019 Clueboard
+ *
+ * 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 "is31fl3731-simple.h"
+#include "i2c_master.h"
+#include "wait.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)
+// The address will vary depending on your wiring:
+// 0b1110100 AD <-> GND
+// 0b1110111 AD <-> VCC
+// 0b1110101 AD <-> SCL
+// 0b1110110 AD <-> SDA
+#define ISSI_ADDR_DEFAULT 0x74
+
+#define ISSI_REG_CONFIG 0x00
+#define ISSI_REG_CONFIG_PICTUREMODE 0x00
+#define ISSI_REG_CONFIG_AUTOPLAYMODE 0x08
+#define ISSI_REG_CONFIG_AUDIOPLAYMODE 0x18
+
+#define ISSI_CONF_PICTUREMODE 0x00
+#define ISSI_CONF_AUTOFRAMEMODE 0x04
+#define ISSI_CONF_AUDIOMODE 0x08
+
+#define ISSI_REG_PICTUREFRAME 0x01
+
+#define ISSI_REG_SHUTDOWN 0x0A
+#define ISSI_REG_AUDIOSYNC 0x06
+
+#define ISSI_COMMANDREGISTER 0xFD
+#define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine'
+
+#ifndef ISSI_TIMEOUT
+# define ISSI_TIMEOUT 100
+#endif
+
+#ifndef ISSI_PERSISTENCE
+# define ISSI_PERSISTENCE 0
+#endif
+
+// Transfer buffer for TWITransmitData()
+uint8_t g_twi_transfer_buffer[20];
+
+// These buffers match the IS31FL3731 PWM registers 0x24-0xB3.
+// Storing them like this is optimal for I2C transfers to the registers.
+// We could optimize this and take out the unused registers from these
+// buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's
+// probably not worth the extra complexity.
+uint8_t g_pwm_buffer[LED_DRIVER_COUNT][144];
+bool g_pwm_buffer_update_required[LED_DRIVER_COUNT] = {false};
+
+/* There's probably a better way to init this... */
+#if LED_DRIVER_COUNT == 1
+uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}};
+#elif LED_DRIVER_COUNT == 2
+uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}};
+#elif LED_DRIVER_COUNT == 3
+uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}};
+#elif LED_DRIVER_COUNT == 4
+uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}, {0}};
+#endif
+bool g_led_control_registers_update_required[LED_DRIVER_COUNT] = {false};
+
+// This is the bit pattern in the LED control registers
+// (for matrix A, add one to register for matrix B)
+//
+// reg - b7 b6 b5 b4 b3 b2 b1 b0
+// 0x00 - R08,R07,R06,R05,R04,R03,R02,R01
+// 0x02 - G08,G07,G06,G05,G04,G03,G02,R00
+// 0x04 - B08,B07,B06,B05,B04,B03,G01,G00
+// 0x06 - - , - , - , - , - ,B02,B01,B00
+// 0x08 - - , - , - , - , - , - , - , -
+// 0x0A - B17,B16,B15, - , - , - , - , -
+// 0x0C - G17,G16,B14,B13,B12,B11,B10,B09
+// 0x0E - R17,G15,G14,G13,G12,G11,G10,G09
+// 0x10 - R16,R15,R14,R13,R12,R11,R10,R09
+
+void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
+ g_twi_transfer_buffer[0] = reg;
+ g_twi_transfer_buffer[1] = data;
+
+#if ISSI_PERSISTENCE > 0
+ for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) {
+ break;
+ }
+ }
+#else
+ i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
+#endif
+}
+
+void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
+ // assumes bank is already selected
+
+ // transmit PWM registers in 9 transfers of 16 bytes
+ // g_twi_transfer_buffer[] is 20 bytes
+
+ // iterate over the pwm_buffer contents at 16 byte intervals
+ for (int i = 0; i < 144; i += 16) {
+ // set the first register, e.g. 0x24, 0x34, 0x44, etc.
+ g_twi_transfer_buffer[0] = 0x24 + i;
+ // copy the data from i to i+15
+ // device will auto-increment register for data after the first byte
+ // thus this sets registers 0x24-0x33, 0x34-0x43, etc. in one transfer
+ for (int j = 0; j < 16; j++) {
+ g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
+ }
+
+#if ISSI_PERSISTENCE > 0
+ for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) break;
+ }
+#else
+ i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT);
+#endif
+ }
+}
+
+void IS31FL3731_init(uint8_t addr) {
+ // In order to avoid the LEDs being driven with garbage data
+ // in the LED driver's PWM registers, first enable software shutdown,
+ // then set up the mode and other settings, clear the PWM registers,
+ // then disable software shutdown.
+
+ // select "function register" bank
+ IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG);
+
+ // enable software shutdown
+ IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00);
+
+ // this delay was copied from other drivers, might not be needed
+ wait_ms(10);
+
+ // picture mode
+ IS31FL3731_write_register(addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE);
+ // display frame 0
+ IS31FL3731_write_register(addr, ISSI_REG_PICTUREFRAME, 0x00);
+ // audio sync off
+ IS31FL3731_write_register(addr, ISSI_REG_AUDIOSYNC, 0x00);
+
+ // select bank 0
+ IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
+
+ // turn off all LEDs in the LED control register
+ for (int i = 0x00; i <= 0x11; i++) {
+ IS31FL3731_write_register(addr, i, 0x00);
+ }
+
+ // turn off all LEDs in the blink control register (not really needed)
+ for (int i = 0x12; i <= 0x23; i++) {
+ IS31FL3731_write_register(addr, i, 0x00);
+ }
+
+ // set PWM on all LEDs to 0
+ for (int i = 0x24; i <= 0xB3; i++) {
+ IS31FL3731_write_register(addr, i, 0x00);
+ }
+
+ // select "function register" bank
+ IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG);
+
+ // disable software shutdown
+ IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x01);
+
+ // select bank 0 and leave it selected.
+ // most usage after initialization is just writing PWM buffers in bank 0
+ // as there's not much point in double-buffering
+ IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
+}
+
+void IS31FL3731_set_value(int index, uint8_t value) {
+ 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
+ g_pwm_buffer[led.driver][led.v - 0x24] = value;
+ g_pwm_buffer_update_required[led.driver] = true;
+ }
+}
+
+void IS31FL3731_set_value_all(uint8_t value) {
+ for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ IS31FL3731_set_value(i, value);
+ }
+}
+
+void IS31FL3731_set_led_control_register(uint8_t index, bool value) {
+ is31_led led = g_is31_leds[index];
+
+ uint8_t control_register = (led.v - 0x24) / 8;
+ uint8_t bit_value = (led.v - 0x24) % 8;
+
+ if (value) {
+ g_led_control_registers[led.driver][control_register] |= (1 << bit_value);
+ } else {
+ g_led_control_registers[led.driver][control_register] &= ~(1 << bit_value);
+ }
+
+ g_led_control_registers_update_required[led.driver] = true;
+}
+
+void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index) {
+ if (g_pwm_buffer_update_required[index]) {
+ IS31FL3731_write_pwm_buffer(addr, g_pwm_buffer[index]);
+ g_pwm_buffer_update_required[index] = false;
+ }
+}
+
+void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index) {
+ if (g_led_control_registers_update_required[index]) {
+ for (int i = 0; i < 18; i++) {
+ IS31FL3731_write_register(addr, i, g_led_control_registers[index][i]);
+ }
+ g_led_control_registers_update_required[index] = false;
+ }
+}
diff --git a/drivers/led/issi/is31fl3731-simple.h b/drivers/led/issi/is31fl3731-simple.h
new file mode 100644
index 0000000000..9665d6ed35
--- /dev/null
+++ b/drivers/led/issi/is31fl3731-simple.h
@@ -0,0 +1,207 @@
+/* Copyright 2017 Jason Williams
+ * Copyright 2018 Jack Humbert
+ * Copyright 2019 Clueboard
+ *
+ * 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 .
+ */
+
+#pragma once
+
+#include
+#include
+
+typedef struct is31_led {
+ uint8_t driver : 2;
+ uint8_t v;
+} __attribute__((packed)) is31_led;
+
+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);
+void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
+
+void IS31FL3731_set_value(int index, uint8_t value);
+void IS31FL3731_set_value_all(uint8_t value);
+
+void IS31FL3731_set_led_control_register(uint8_t index, bool value);
+
+// This should not be called from an interrupt
+// (eg. from a timer interrupt).
+// Call this while idle (in between matrix scans).
+// If the buffer is dirty, it will update the driver with the buffer.
+void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index);
+void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index);
+
+#define C1_1 0x24
+#define C1_2 0x25
+#define C1_3 0x26
+#define C1_4 0x27
+#define C1_5 0x28
+#define C1_6 0x29
+#define C1_7 0x2A
+#define C1_8 0x2B
+
+#define C1_9 0x2C
+#define C1_10 0x2D
+#define C1_11 0x2E
+#define C1_12 0x2F
+#define C1_13 0x30
+#define C1_14 0x31
+#define C1_15 0x32
+#define C1_16 0x33
+
+#define C2_1 0x34
+#define C2_2 0x35
+#define C2_3 0x36
+#define C2_4 0x37
+#define C2_5 0x38
+#define C2_6 0x39
+#define C2_7 0x3A
+#define C2_8 0x3B
+
+#define C2_9 0x3C
+#define C2_10 0x3D
+#define C2_11 0x3E
+#define C2_12 0x3F
+#define C2_13 0x40
+#define C2_14 0x41
+#define C2_15 0x42
+#define C2_16 0x43
+
+#define C3_1 0x44
+#define C3_2 0x45
+#define C3_3 0x46
+#define C3_4 0x47
+#define C3_5 0x48
+#define C3_6 0x49
+#define C3_7 0x4A
+#define C3_8 0x4B
+
+#define C3_9 0x4C
+#define C3_10 0x4D
+#define C3_11 0x4E
+#define C3_12 0x4F
+#define C3_13 0x50
+#define C3_14 0x51
+#define C3_15 0x52
+#define C3_16 0x53
+
+#define C4_1 0x54
+#define C4_2 0x55
+#define C4_3 0x56
+#define C4_4 0x57
+#define C4_5 0x58
+#define C4_6 0x59
+#define C4_7 0x5A
+#define C4_8 0x5B
+
+#define C4_9 0x5C
+#define C4_10 0x5D
+#define C4_11 0x5E
+#define C4_12 0x5F
+#define C4_13 0x60
+#define C4_14 0x61
+#define C4_15 0x62
+#define C4_16 0x63
+
+#define C5_1 0x64
+#define C5_2 0x65
+#define C5_3 0x66
+#define C5_4 0x67
+#define C5_5 0x68
+#define C5_6 0x69
+#define C5_7 0x6A
+#define C5_8 0x6B
+
+#define C5_9 0x6C
+#define C5_10 0x6D
+#define C5_11 0x6E
+#define C5_12 0x6F
+#define C5_13 0x70
+#define C5_14 0x71
+#define C5_15 0x72
+#define C5_16 0x73
+
+#define C6_1 0x74
+#define C6_2 0x75
+#define C6_3 0x76
+#define C6_4 0x77
+#define C6_5 0x78
+#define C6_6 0x79
+#define C6_7 0x7A
+#define C6_8 0x7B
+
+#define C6_9 0x7C
+#define C6_10 0x7D
+#define C6_11 0x7E
+#define C6_12 0x7F
+#define C6_13 0x80
+#define C6_14 0x81
+#define C6_15 0x82
+#define C6_16 0x83
+
+#define C7_1 0x84
+#define C7_2 0x85
+#define C7_3 0x86
+#define C7_4 0x87
+#define C7_5 0x88
+#define C7_6 0x89
+#define C7_7 0x8A
+#define C7_8 0x8B
+
+#define C7_9 0x8C
+#define C7_10 0x8D
+#define C7_11 0x8E
+#define C7_12 0x8F
+#define C7_13 0x90
+#define C7_14 0x91
+#define C7_15 0x92
+#define C7_16 0x93
+
+#define C8_1 0x94
+#define C8_2 0x95
+#define C8_3 0x96
+#define C8_4 0x97
+#define C8_5 0x98
+#define C8_6 0x99
+#define C8_7 0x9A
+#define C8_8 0x9B
+
+#define C8_9 0x9C
+#define C8_10 0x9D
+#define C8_11 0x9E
+#define C8_12 0x9F
+#define C8_13 0xA0
+#define C8_14 0xA1
+#define C8_15 0xA2
+#define C8_16 0xA3
+
+#define C9_1 0xA4
+#define C9_2 0xA5
+#define C9_3 0xA6
+#define C9_4 0xA7
+#define C9_5 0xA8
+#define C9_6 0xA9
+#define C9_7 0xAA
+#define C9_8 0xAB
+
+#define C9_9 0xAC
+#define C9_10 0xAD
+#define C9_11 0xAE
+#define C9_12 0xAF
+#define C9_13 0xB0
+#define C9_14 0xB1
+#define C9_15 0xB2
+#define C9_16 0xB3
diff --git a/drivers/led/issi/is31fl3731.c b/drivers/led/issi/is31fl3731.c
new file mode 100644
index 0000000000..110bdc1be4
--- /dev/null
+++ b/drivers/led/issi/is31fl3731.c
@@ -0,0 +1,237 @@
+/* Copyright 2017 Jason Williams
+ * Copyright 2018 Jack Humbert
+ *
+ * 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 "is31fl3731.h"
+#include "i2c_master.h"
+#include "wait.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)
+// The address will vary depending on your wiring:
+// 0b1110100 AD <-> GND
+// 0b1110111 AD <-> VCC
+// 0b1110101 AD <-> SCL
+// 0b1110110 AD <-> SDA
+#define ISSI_ADDR_DEFAULT 0x74
+
+#define ISSI_REG_CONFIG 0x00
+#define ISSI_REG_CONFIG_PICTUREMODE 0x00
+#define ISSI_REG_CONFIG_AUTOPLAYMODE 0x08
+#define ISSI_REG_CONFIG_AUDIOPLAYMODE 0x18
+
+#define ISSI_CONF_PICTUREMODE 0x00
+#define ISSI_CONF_AUTOFRAMEMODE 0x04
+#define ISSI_CONF_AUDIOMODE 0x08
+
+#define ISSI_REG_PICTUREFRAME 0x01
+
+#define ISSI_REG_SHUTDOWN 0x0A
+#define ISSI_REG_AUDIOSYNC 0x06
+
+#define ISSI_COMMANDREGISTER 0xFD
+#define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine'
+
+#ifndef ISSI_TIMEOUT
+# define ISSI_TIMEOUT 100
+#endif
+
+#ifndef ISSI_PERSISTENCE
+# define ISSI_PERSISTENCE 0
+#endif
+
+// Transfer buffer for TWITransmitData()
+uint8_t g_twi_transfer_buffer[20];
+
+// These buffers match the IS31FL3731 PWM registers 0x24-0xB3.
+// Storing them like this is optimal for I2C transfers to the registers.
+// We could optimize this and take out the unused registers from these
+// buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's
+// probably not worth the extra complexity.
+uint8_t g_pwm_buffer[DRIVER_COUNT][144];
+bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
+
+uint8_t g_led_control_registers[DRIVER_COUNT][18] = {{0}};
+bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
+
+// This is the bit pattern in the LED control registers
+// (for matrix A, add one to register for matrix B)
+//
+// reg - b7 b6 b5 b4 b3 b2 b1 b0
+// 0x00 - R08,R07,R06,R05,R04,R03,R02,R01
+// 0x02 - G08,G07,G06,G05,G04,G03,G02,R00
+// 0x04 - B08,B07,B06,B05,B04,B03,G01,G00
+// 0x06 - - , - , - , - , - ,B02,B01,B00
+// 0x08 - - , - , - , - , - , - , - , -
+// 0x0A - B17,B16,B15, - , - , - , - , -
+// 0x0C - G17,G16,B14,B13,B12,B11,B10,B09
+// 0x0E - R17,G15,G14,G13,G12,G11,G10,G09
+// 0x10 - R16,R15,R14,R13,R12,R11,R10,R09
+
+void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
+ g_twi_transfer_buffer[0] = reg;
+ g_twi_transfer_buffer[1] = data;
+
+#if ISSI_PERSISTENCE > 0
+ for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
+ }
+#else
+ i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
+#endif
+}
+
+void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
+ // assumes bank is already selected
+
+ // transmit PWM registers in 9 transfers of 16 bytes
+ // g_twi_transfer_buffer[] is 20 bytes
+
+ // iterate over the pwm_buffer contents at 16 byte intervals
+ for (int i = 0; i < 144; i += 16) {
+ // set the first register, e.g. 0x24, 0x34, 0x44, etc.
+ g_twi_transfer_buffer[0] = 0x24 + i;
+ // copy the data from i to i+15
+ // device will auto-increment register for data after the first byte
+ // thus this sets registers 0x24-0x33, 0x34-0x43, etc. in one transfer
+ for (int j = 0; j < 16; j++) {
+ g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
+ }
+
+#if ISSI_PERSISTENCE > 0
+ for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) break;
+ }
+#else
+ i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT);
+#endif
+ }
+}
+
+void IS31FL3731_init(uint8_t addr) {
+ // In order to avoid the LEDs being driven with garbage data
+ // in the LED driver's PWM registers, first enable software shutdown,
+ // then set up the mode and other settings, clear the PWM registers,
+ // then disable software shutdown.
+
+ // select "function register" bank
+ IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG);
+
+ // enable software shutdown
+ IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00);
+
+ // this delay was copied from other drivers, might not be needed
+ wait_ms(10);
+
+ // picture mode
+ IS31FL3731_write_register(addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE);
+ // display frame 0
+ IS31FL3731_write_register(addr, ISSI_REG_PICTUREFRAME, 0x00);
+ // audio sync off
+ IS31FL3731_write_register(addr, ISSI_REG_AUDIOSYNC, 0x00);
+
+ // select bank 0
+ IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
+
+ // turn off all LEDs in the LED control register
+ for (int i = 0x00; i <= 0x11; i++) {
+ IS31FL3731_write_register(addr, i, 0x00);
+ }
+
+ // turn off all LEDs in the blink control register (not really needed)
+ for (int i = 0x12; i <= 0x23; i++) {
+ IS31FL3731_write_register(addr, i, 0x00);
+ }
+
+ // set PWM on all LEDs to 0
+ for (int i = 0x24; i <= 0xB3; i++) {
+ IS31FL3731_write_register(addr, i, 0x00);
+ }
+
+ // select "function register" bank
+ IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG);
+
+ // disable software shutdown
+ IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x01);
+
+ // select bank 0 and leave it selected.
+ // most usage after initialization is just writing PWM buffers in bank 0
+ // as there's not much point in double-buffering
+ IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0);
+}
+
+void IS31FL3731_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];
+
+ // Subtract 0x24 to get the second index of g_pwm_buffer
+ g_pwm_buffer[led.driver][led.r - 0x24] = red;
+ g_pwm_buffer[led.driver][led.g - 0x24] = green;
+ g_pwm_buffer[led.driver][led.b - 0x24] = blue;
+ g_pwm_buffer_update_required[led.driver] = true;
+ }
+}
+
+void IS31FL3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
+ for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ IS31FL3731_set_color(i, red, green, blue);
+ }
+}
+
+void IS31FL3731_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
+ is31_led led = g_is31_leds[index];
+
+ uint8_t control_register_r = (led.r - 0x24) / 8;
+ uint8_t control_register_g = (led.g - 0x24) / 8;
+ uint8_t control_register_b = (led.b - 0x24) / 8;
+ uint8_t bit_r = (led.r - 0x24) % 8;
+ uint8_t bit_g = (led.g - 0x24) % 8;
+ uint8_t bit_b = (led.b - 0x24) % 8;
+
+ if (red) {
+ g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r);
+ } else {
+ g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r);
+ }
+ if (green) {
+ g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g);
+ } else {
+ g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g);
+ }
+ if (blue) {
+ g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b);
+ } else {
+ g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b);
+ }
+
+ g_led_control_registers_update_required[led.driver] = true;
+}
+
+void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index) {
+ if (g_pwm_buffer_update_required[index]) {
+ IS31FL3731_write_pwm_buffer(addr, g_pwm_buffer[index]);
+ }
+ g_pwm_buffer_update_required[index] = false;
+}
+
+void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index) {
+ if (g_led_control_registers_update_required[index]) {
+ for (int i = 0; i < 18; i++) {
+ IS31FL3731_write_register(addr, i, g_led_control_registers[index][i]);
+ }
+ }
+ g_led_control_registers_update_required[index] = false;
+}
diff --git a/drivers/led/issi/is31fl3731.h b/drivers/led/issi/is31fl3731.h
new file mode 100644
index 0000000000..19e8e6251f
--- /dev/null
+++ b/drivers/led/issi/is31fl3731.h
@@ -0,0 +1,208 @@
+/* Copyright 2017 Jason Williams
+ * Copyright 2018 Jack Humbert
+ *
+ * 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 .
+ */
+
+#pragma once
+
+#include
+#include
+
+typedef struct is31_led {
+ uint8_t driver : 2;
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+} __attribute__((packed)) is31_led;
+
+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);
+void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
+
+void IS31FL3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
+void IS31FL3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
+
+void IS31FL3731_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
+
+// This should not be called from an interrupt
+// (eg. from a timer interrupt).
+// Call this while idle (in between matrix scans).
+// If the buffer is dirty, it will update the driver with the buffer.
+void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index);
+void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index);
+
+#define C1_1 0x24
+#define C1_2 0x25
+#define C1_3 0x26
+#define C1_4 0x27
+#define C1_5 0x28
+#define C1_6 0x29
+#define C1_7 0x2A
+#define C1_8 0x2B
+
+#define C1_9 0x2C
+#define C1_10 0x2D
+#define C1_11 0x2E
+#define C1_12 0x2F
+#define C1_13 0x30
+#define C1_14 0x31
+#define C1_15 0x32
+#define C1_16 0x33
+
+#define C2_1 0x34
+#define C2_2 0x35
+#define C2_3 0x36
+#define C2_4 0x37
+#define C2_5 0x38
+#define C2_6 0x39
+#define C2_7 0x3A
+#define C2_8 0x3B
+
+#define C2_9 0x3C
+#define C2_10 0x3D
+#define C2_11 0x3E
+#define C2_12 0x3F
+#define C2_13 0x40
+#define C2_14 0x41
+#define C2_15 0x42
+#define C2_16 0x43
+
+#define C3_1 0x44
+#define C3_2 0x45
+#define C3_3 0x46
+#define C3_4 0x47
+#define C3_5 0x48
+#define C3_6 0x49
+#define C3_7 0x4A
+#define C3_8 0x4B
+
+#define C3_9 0x4C
+#define C3_10 0x4D
+#define C3_11 0x4E
+#define C3_12 0x4F
+#define C3_13 0x50
+#define C3_14 0x51
+#define C3_15 0x52
+#define C3_16 0x53
+
+#define C4_1 0x54
+#define C4_2 0x55
+#define C4_3 0x56
+#define C4_4 0x57
+#define C4_5 0x58
+#define C4_6 0x59
+#define C4_7 0x5A
+#define C4_8 0x5B
+
+#define C4_9 0x5C
+#define C4_10 0x5D
+#define C4_11 0x5E
+#define C4_12 0x5F
+#define C4_13 0x60
+#define C4_14 0x61
+#define C4_15 0x62
+#define C4_16 0x63
+
+#define C5_1 0x64
+#define C5_2 0x65
+#define C5_3 0x66
+#define C5_4 0x67
+#define C5_5 0x68
+#define C5_6 0x69
+#define C5_7 0x6A
+#define C5_8 0x6B
+
+#define C5_9 0x6C
+#define C5_10 0x6D
+#define C5_11 0x6E
+#define C5_12 0x6F
+#define C5_13 0x70
+#define C5_14 0x71
+#define C5_15 0x72
+#define C5_16 0x73
+
+#define C6_1 0x74
+#define C6_2 0x75
+#define C6_3 0x76
+#define C6_4 0x77
+#define C6_5 0x78
+#define C6_6 0x79
+#define C6_7 0x7A
+#define C6_8 0x7B
+
+#define C6_9 0x7C
+#define C6_10 0x7D
+#define C6_11 0x7E
+#define C6_12 0x7F
+#define C6_13 0x80
+#define C6_14 0x81
+#define C6_15 0x82
+#define C6_16 0x83
+
+#define C7_1 0x84
+#define C7_2 0x85
+#define C7_3 0x86
+#define C7_4 0x87
+#define C7_5 0x88
+#define C7_6 0x89
+#define C7_7 0x8A
+#define C7_8 0x8B
+
+#define C7_9 0x8C
+#define C7_10 0x8D
+#define C7_11 0x8E
+#define C7_12 0x8F
+#define C7_13 0x90
+#define C7_14 0x91
+#define C7_15 0x92
+#define C7_16 0x93
+
+#define C8_1 0x94
+#define C8_2 0x95
+#define C8_3 0x96
+#define C8_4 0x97
+#define C8_5 0x98
+#define C8_6 0x99
+#define C8_7 0x9A
+#define C8_8 0x9B
+
+#define C8_9 0x9C
+#define C8_10 0x9D
+#define C8_11 0x9E
+#define C8_12 0x9F
+#define C8_13 0xA0
+#define C8_14 0xA1
+#define C8_15 0xA2
+#define C8_16 0xA3
+
+#define C9_1 0xA4
+#define C9_2 0xA5
+#define C9_3 0xA6
+#define C9_4 0xA7
+#define C9_5 0xA8
+#define C9_6 0xA9
+#define C9_7 0xAA
+#define C9_8 0xAB
+
+#define C9_9 0xAC
+#define C9_10 0xAD
+#define C9_11 0xAE
+#define C9_12 0xAF
+#define C9_13 0xB0
+#define C9_14 0xB1
+#define C9_15 0xB2
+#define C9_16 0xB3
diff --git a/drivers/led/issi/is31fl3733.c b/drivers/led/issi/is31fl3733.c
new file mode 100644
index 0000000000..d99e5339c9
--- /dev/null
+++ b/drivers/led/issi/is31fl3733.c
@@ -0,0 +1,237 @@
+/* Copyright 2017 Jason Williams
+ * Copyright 2018 Jack Humbert
+ * Copyright 2018 Yiancar
+ *
+ * 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 "is31fl3733.h"
+#include "i2c_master.h"
+#include "wait.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)
+// The address will vary depending on your wiring:
+// 00 <-> GND
+// 01 <-> SCL
+// 10 <-> SDA
+// 11 <-> VCC
+// ADDR1 represents A1:A0 of the 7-bit address.
+// ADDR2 represents A3:A2 of the 7-bit address.
+// The result is: 0b101(ADDR2)(ADDR1)
+#define ISSI_ADDR_DEFAULT 0x50
+
+#define ISSI_COMMANDREGISTER 0xFD
+#define ISSI_COMMANDREGISTER_WRITELOCK 0xFE
+#define ISSI_INTERRUPTMASKREGISTER 0xF0
+#define ISSI_INTERRUPTSTATUSREGISTER 0xF1
+
+#define ISSI_PAGE_LEDCONTROL 0x00 // PG0
+#define ISSI_PAGE_PWM 0x01 // PG1
+#define ISSI_PAGE_AUTOBREATH 0x02 // PG2
+#define ISSI_PAGE_FUNCTION 0x03 // PG3
+
+#define ISSI_REG_CONFIGURATION 0x00 // PG3
+#define ISSI_REG_GLOBALCURRENT 0x01 // PG3
+#define ISSI_REG_RESET 0x11 // PG3
+#define ISSI_REG_SWPULLUP 0x0F // PG3
+#define ISSI_REG_CSPULLUP 0x10 // PG3
+
+#ifndef ISSI_TIMEOUT
+# define ISSI_TIMEOUT 100
+#endif
+
+#ifndef ISSI_PERSISTENCE
+# define ISSI_PERSISTENCE 0
+#endif
+
+// Transfer buffer for TWITransmitData()
+uint8_t g_twi_transfer_buffer[20];
+
+// These buffers match the IS31FL3733 PWM registers.
+// The control buffers match the PG0 LED On/Off registers.
+// Storing them like this is optimal for I2C transfers to the registers.
+// We could optimize this and take out the unused registers from these
+// buffers and the transfers in IS31FL3733_write_pwm_buffer() but it's
+// probably not worth the extra complexity.
+uint8_t g_pwm_buffer[DRIVER_COUNT][192];
+bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
+
+uint8_t g_led_control_registers[DRIVER_COUNT][24] = {0};
+bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
+
+bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
+ // If the transaction fails function returns false.
+ g_twi_transfer_buffer[0] = reg;
+ g_twi_transfer_buffer[1] = data;
+
+#if ISSI_PERSISTENCE > 0
+ for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) != 0) {
+ return false;
+ }
+ }
+#else
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) != 0) {
+ return false;
+ }
+#endif
+ return true;
+}
+
+bool IS31FL3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
+ // Assumes PG1 is already selected.
+ // If any of the transactions fails function returns false.
+ // Transmit PWM registers in 12 transfers of 16 bytes.
+ // g_twi_transfer_buffer[] is 20 bytes
+
+ // Iterate over the pwm_buffer contents at 16 byte intervals.
+ for (int i = 0; i < 192; i += 16) {
+ g_twi_transfer_buffer[0] = i;
+ // Copy the data from i to i+15.
+ // Device will auto-increment register for data after the first byte
+ // Thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer.
+ for (int j = 0; j < 16; j++) {
+ g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
+ }
+
+#if ISSI_PERSISTENCE > 0
+ for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) != 0) {
+ return false;
+ }
+ }
+#else
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) != 0) {
+ return false;
+ }
+#endif
+ }
+ return true;
+}
+
+void IS31FL3733_init(uint8_t addr, uint8_t sync) {
+ // In order to avoid the LEDs being driven with garbage data
+ // in the LED driver's PWM registers, shutdown is enabled last.
+ // Set up the mode and other settings, clear the PWM registers,
+ // then disable software shutdown.
+ // Sync is passed so set it according to the datasheet.
+
+ // Unlock the command register.
+ IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+
+ // Select PG0
+ IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
+ // Turn off all LEDs.
+ for (int i = 0x00; i <= 0x17; i++) {
+ IS31FL3733_write_register(addr, i, 0x00);
+ }
+
+ // Unlock the command register.
+ IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+
+ // Select PG1
+ IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
+ // Set PWM on all LEDs to 0
+ // No need to setup Breath registers to PWM as that is the default.
+ for (int i = 0x00; i <= 0xBF; i++) {
+ IS31FL3733_write_register(addr, i, 0x00);
+ }
+
+ // Unlock the command register.
+ IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+
+ // Select PG3
+ IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
+ // Set global current to maximum.
+ IS31FL3733_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
+ // Disable software shutdown.
+ IS31FL3733_write_register(addr, ISSI_REG_CONFIGURATION, (sync << 6) | 0x01);
+
+ // Wait 10ms to ensure the device has woken up.
+ wait_ms(10);
+}
+
+void IS31FL3733_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];
+
+ g_pwm_buffer[led.driver][led.r] = red;
+ g_pwm_buffer[led.driver][led.g] = green;
+ g_pwm_buffer[led.driver][led.b] = blue;
+ g_pwm_buffer_update_required[led.driver] = true;
+ }
+}
+
+void IS31FL3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
+ for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ IS31FL3733_set_color(i, red, green, blue);
+ }
+}
+
+void IS31FL3733_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
+ is31_led led = g_is31_leds[index];
+
+ uint8_t control_register_r = led.r / 8;
+ uint8_t control_register_g = led.g / 8;
+ uint8_t control_register_b = led.b / 8;
+ uint8_t bit_r = led.r % 8;
+ uint8_t bit_g = led.g % 8;
+ uint8_t bit_b = led.b % 8;
+
+ if (red) {
+ g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r);
+ } else {
+ g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r);
+ }
+ if (green) {
+ g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g);
+ } else {
+ g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g);
+ }
+ if (blue) {
+ g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b);
+ } else {
+ g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b);
+ }
+
+ g_led_control_registers_update_required[led.driver] = true;
+}
+
+void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index) {
+ if (g_pwm_buffer_update_required[index]) {
+ // Firstly we need to unlock the command register and select PG1.
+ IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+ IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
+
+ // If any of the transactions fail we risk writing dirty PG0,
+ // refresh page 0 just in case.
+ if (!IS31FL3733_write_pwm_buffer(addr, g_pwm_buffer[index])) {
+ g_led_control_registers_update_required[index] = true;
+ }
+ }
+ g_pwm_buffer_update_required[index] = false;
+}
+
+void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index) {
+ if (g_led_control_registers_update_required[index]) {
+ // Firstly we need to unlock the command register and select PG0
+ IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+ IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
+ for (int i = 0; i < 24; i++) {
+ IS31FL3733_write_register(addr, i, g_led_control_registers[index][i]);
+ }
+ }
+ g_led_control_registers_update_required[index] = false;
+}
diff --git a/drivers/led/issi/is31fl3733.h b/drivers/led/issi/is31fl3733.h
new file mode 100644
index 0000000000..603d505a13
--- /dev/null
+++ b/drivers/led/issi/is31fl3733.h
@@ -0,0 +1,251 @@
+/* Copyright 2017 Jason Williams
+ * Copyright 2018 Jack Humbert
+ * Copyright 2018 Yiancar
+ *
+ * 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 .
+ */
+
+#pragma once
+
+#include
+#include
+
+typedef struct is31_led {
+ uint8_t driver : 2;
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+} __attribute__((packed)) is31_led;
+
+extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+
+void IS31FL3733_init(uint8_t addr, uint8_t sync);
+bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data);
+bool IS31FL3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
+
+void IS31FL3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
+void IS31FL3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
+
+void IS31FL3733_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
+
+// This should not be called from an interrupt
+// (eg. from a timer interrupt).
+// Call this while idle (in between matrix scans).
+// If the buffer is dirty, it will update the driver with the buffer.
+void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index);
+void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index);
+
+#define A_1 0x00
+#define A_2 0x01
+#define A_3 0x02
+#define A_4 0x03
+#define A_5 0x04
+#define A_6 0x05
+#define A_7 0x06
+#define A_8 0x07
+#define A_9 0x08
+#define A_10 0x09
+#define A_11 0x0A
+#define A_12 0x0B
+#define A_13 0x0C
+#define A_14 0x0D
+#define A_15 0x0E
+#define A_16 0x0F
+
+#define B_1 0x10
+#define B_2 0x11
+#define B_3 0x12
+#define B_4 0x13
+#define B_5 0x14
+#define B_6 0x15
+#define B_7 0x16
+#define B_8 0x17
+#define B_9 0x18
+#define B_10 0x19
+#define B_11 0x1A
+#define B_12 0x1B
+#define B_13 0x1C
+#define B_14 0x1D
+#define B_15 0x1E
+#define B_16 0x1F
+
+#define C_1 0x20
+#define C_2 0x21
+#define C_3 0x22
+#define C_4 0x23
+#define C_5 0x24
+#define C_6 0x25
+#define C_7 0x26
+#define C_8 0x27
+#define C_9 0x28
+#define C_10 0x29
+#define C_11 0x2A
+#define C_12 0x2B
+#define C_13 0x2C
+#define C_14 0x2D
+#define C_15 0x2E
+#define C_16 0x2F
+
+#define D_1 0x30
+#define D_2 0x31
+#define D_3 0x32
+#define D_4 0x33
+#define D_5 0x34
+#define D_6 0x35
+#define D_7 0x36
+#define D_8 0x37
+#define D_9 0x38
+#define D_10 0x39
+#define D_11 0x3A
+#define D_12 0x3B
+#define D_13 0x3C
+#define D_14 0x3D
+#define D_15 0x3E
+#define D_16 0x3F
+
+#define E_1 0x40
+#define E_2 0x41
+#define E_3 0x42
+#define E_4 0x43
+#define E_5 0x44
+#define E_6 0x45
+#define E_7 0x46
+#define E_8 0x47
+#define E_9 0x48
+#define E_10 0x49
+#define E_11 0x4A
+#define E_12 0x4B
+#define E_13 0x4C
+#define E_14 0x4D
+#define E_15 0x4E
+#define E_16 0x4F
+
+#define F_1 0x50
+#define F_2 0x51
+#define F_3 0x52
+#define F_4 0x53
+#define F_5 0x54
+#define F_6 0x55
+#define F_7 0x56
+#define F_8 0x57
+#define F_9 0x58
+#define F_10 0x59
+#define F_11 0x5A
+#define F_12 0x5B
+#define F_13 0x5C
+#define F_14 0x5D
+#define F_15 0x5E
+#define F_16 0x5F
+
+#define G_1 0x60
+#define G_2 0x61
+#define G_3 0x62
+#define G_4 0x63
+#define G_5 0x64
+#define G_6 0x65
+#define G_7 0x66
+#define G_8 0x67
+#define G_9 0x68
+#define G_10 0x69
+#define G_11 0x6A
+#define G_12 0x6B
+#define G_13 0x6C
+#define G_14 0x6D
+#define G_15 0x6E
+#define G_16 0x6F
+
+#define H_1 0x70
+#define H_2 0x71
+#define H_3 0x72
+#define H_4 0x73
+#define H_5 0x74
+#define H_6 0x75
+#define H_7 0x76
+#define H_8 0x77
+#define H_9 0x78
+#define H_10 0x79
+#define H_11 0x7A
+#define H_12 0x7B
+#define H_13 0x7C
+#define H_14 0x7D
+#define H_15 0x7E
+#define H_16 0x7F
+
+#define I_1 0x80
+#define I_2 0x81
+#define I_3 0x82
+#define I_4 0x83
+#define I_5 0x84
+#define I_6 0x85
+#define I_7 0x86
+#define I_8 0x87
+#define I_9 0x88
+#define I_10 0x89
+#define I_11 0x8A
+#define I_12 0x8B
+#define I_13 0x8C
+#define I_14 0x8D
+#define I_15 0x8E
+#define I_16 0x8F
+
+#define J_1 0x90
+#define J_2 0x91
+#define J_3 0x92
+#define J_4 0x93
+#define J_5 0x94
+#define J_6 0x95
+#define J_7 0x96
+#define J_8 0x97
+#define J_9 0x98
+#define J_10 0x99
+#define J_11 0x9A
+#define J_12 0x9B
+#define J_13 0x9C
+#define J_14 0x9D
+#define J_15 0x9E
+#define J_16 0x9F
+
+#define K_1 0xA0
+#define K_2 0xA1
+#define K_3 0xA2
+#define K_4 0xA3
+#define K_5 0xA4
+#define K_6 0xA5
+#define K_7 0xA6
+#define K_8 0xA7
+#define K_9 0xA8
+#define K_10 0xA9
+#define K_11 0xAA
+#define K_12 0xAB
+#define K_13 0xAC
+#define K_14 0xAD
+#define K_15 0xAE
+#define K_16 0xAF
+
+#define L_1 0xB0
+#define L_2 0xB1
+#define L_3 0xB2
+#define L_4 0xB3
+#define L_5 0xB4
+#define L_6 0xB5
+#define L_7 0xB6
+#define L_8 0xB7
+#define L_9 0xB8
+#define L_10 0xB9
+#define L_11 0xBA
+#define L_12 0xBB
+#define L_13 0xBC
+#define L_14 0xBD
+#define L_15 0xBE
+#define L_16 0xBF
diff --git a/drivers/led/issi/is31fl3736.c b/drivers/led/issi/is31fl3736.c
new file mode 100644
index 0000000000..7dece1b1eb
--- /dev/null
+++ b/drivers/led/issi/is31fl3736.c
@@ -0,0 +1,269 @@
+/* Copyright 2018 Jason Williams (Wilba)
+ *
+ * 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 "is31fl3736.h"
+#include "i2c_master.h"
+#include "wait.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)
+// The address will vary depending on your wiring:
+// 00 <-> GND
+// 01 <-> SCL
+// 10 <-> SDA
+// 11 <-> VCC
+// ADDR1 represents A1:A0 of the 7-bit address.
+// ADDR2 represents A3:A2 of the 7-bit address.
+// The result is: 0b101(ADDR2)(ADDR1)
+#define ISSI_ADDR_DEFAULT 0x50
+
+#define ISSI_COMMANDREGISTER 0xFD
+#define ISSI_COMMANDREGISTER_WRITELOCK 0xFE
+#define ISSI_INTERRUPTMASKREGISTER 0xF0
+#define ISSI_INTERRUPTSTATUSREGISTER 0xF1
+
+#define ISSI_PAGE_LEDCONTROL 0x00 // PG0
+#define ISSI_PAGE_PWM 0x01 // PG1
+#define ISSI_PAGE_AUTOBREATH 0x02 // PG2
+#define ISSI_PAGE_FUNCTION 0x03 // PG3
+
+#define ISSI_REG_CONFIGURATION 0x00 // PG3
+#define ISSI_REG_GLOBALCURRENT 0x01 // PG3
+#define ISSI_REG_RESET 0x11 // PG3
+#define ISSI_REG_SWPULLUP 0x0F // PG3
+#define ISSI_REG_CSPULLUP 0x10 // PG3
+
+#ifndef ISSI_TIMEOUT
+# define ISSI_TIMEOUT 100
+#endif
+
+#ifndef ISSI_PERSISTENCE
+# define ISSI_PERSISTENCE 0
+#endif
+
+// Transfer buffer for TWITransmitData()
+uint8_t g_twi_transfer_buffer[20];
+
+// These buffers match the IS31FL3736 PWM registers.
+// The control buffers match the PG0 LED On/Off registers.
+// Storing them like this is optimal for I2C transfers to the registers.
+// We could optimize this and take out the unused registers from these
+// buffers and the transfers in IS31FL3736_write_pwm_buffer() but it's
+// probably not worth the extra complexity.
+uint8_t g_pwm_buffer[DRIVER_COUNT][192];
+bool g_pwm_buffer_update_required = false;
+
+uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}, {0}};
+bool g_led_control_registers_update_required = false;
+
+void IS31FL3736_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
+ g_twi_transfer_buffer[0] = reg;
+ g_twi_transfer_buffer[1] = data;
+
+#if ISSI_PERSISTENCE > 0
+ for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
+ }
+#else
+ i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
+#endif
+}
+
+void IS31FL3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
+ // assumes PG1 is already selected
+
+ // transmit PWM registers in 12 transfers of 16 bytes
+ // g_twi_transfer_buffer[] is 20 bytes
+
+ // iterate over the pwm_buffer contents at 16 byte intervals
+ for (int i = 0; i < 192; i += 16) {
+ g_twi_transfer_buffer[0] = i;
+ // copy the data from i to i+15
+ // device will auto-increment register for data after the first byte
+ // thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer
+ for (int j = 0; j < 16; j++) {
+ g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
+ }
+
+#if ISSI_PERSISTENCE > 0
+ for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) break;
+ }
+#else
+ i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT);
+#endif
+ }
+}
+
+void IS31FL3736_init(uint8_t addr) {
+ // In order to avoid the LEDs being driven with garbage data
+ // in the LED driver's PWM registers, shutdown is enabled last.
+ // Set up the mode and other settings, clear the PWM registers,
+ // then disable software shutdown.
+
+ // Unlock the command register.
+ IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+
+ // Select PG0
+ IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
+ // Turn off all LEDs.
+ for (int i = 0x00; i <= 0x17; i++) {
+ IS31FL3736_write_register(addr, i, 0x00);
+ }
+
+ // Unlock the command register.
+ IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+
+ // Select PG1
+ IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
+ // Set PWM on all LEDs to 0
+ // No need to setup Breath registers to PWM as that is the default.
+ for (int i = 0x00; i <= 0xBF; i++) {
+ IS31FL3736_write_register(addr, i, 0x00);
+ }
+
+ // Unlock the command register.
+ IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+
+ // Select PG3
+ IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
+ // Set global current to maximum.
+ IS31FL3736_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
+ // Disable software shutdown.
+ IS31FL3736_write_register(addr, ISSI_REG_CONFIGURATION, 0x01);
+
+ // Wait 10ms to ensure the device has woken up.
+ wait_ms(10);
+}
+
+void IS31FL3736_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];
+
+ g_pwm_buffer[led.driver][led.r] = red;
+ g_pwm_buffer[led.driver][led.g] = green;
+ g_pwm_buffer[led.driver][led.b] = blue;
+ g_pwm_buffer_update_required = true;
+ }
+}
+
+void IS31FL3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
+ for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ IS31FL3736_set_color(i, red, green, blue);
+ }
+}
+
+void IS31FL3736_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
+ is31_led led = g_is31_leds[index];
+
+ // IS31FL3733
+ // The PWM register for a matrix position (0x00 to 0xBF) can be
+ // divided by 8 to get the LED control register (0x00 to 0x17),
+ // then mod 8 to get the bit position within that register.
+
+ // IS31FL3736
+ // The PWM register for a matrix position (0x00 to 0xBF) is interleaved, so:
+ // A1=0x00 A2=0x02 A3=0x04 A4=0x06 A5=0x08 A6=0x0A A7=0x0C A8=0x0E
+ // B1=0x10 B2=0x12 B3=0x14
+ // But also, the LED control registers (0x00 to 0x17) are also interleaved, so:
+ // A1-A4=0x00 A5-A8=0x01
+ // So, the same math applies.
+
+ uint8_t control_register_r = led.r / 8;
+ uint8_t control_register_g = led.g / 8;
+ uint8_t control_register_b = led.b / 8;
+
+ uint8_t bit_r = led.r % 8;
+ uint8_t bit_g = led.g % 8;
+ uint8_t bit_b = led.b % 8;
+
+ if (red) {
+ g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r);
+ } else {
+ g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r);
+ }
+ if (green) {
+ g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g);
+ } else {
+ g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g);
+ }
+ if (blue) {
+ g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b);
+ } else {
+ g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b);
+ }
+
+ g_led_control_registers_update_required = true;
+}
+
+void IS31FL3736_mono_set_brightness(int index, uint8_t value) {
+ if (index >= 0 && index < 96) {
+ // Index in range 0..95 -> A1..A8, B1..B8, etc.
+ // Map index 0..95 to registers 0x00..0xBE (interleaved)
+ uint8_t pwm_register = index * 2;
+ g_pwm_buffer[0][pwm_register] = value;
+ g_pwm_buffer_update_required = true;
+ }
+}
+
+void IS31FL3736_mono_set_brightness_all(uint8_t value) {
+ for (int i = 0; i < 96; i++) {
+ IS31FL3736_mono_set_brightness(i, value);
+ }
+}
+
+void IS31FL3736_mono_set_led_control_register(uint8_t index, bool enabled) {
+ // Index in range 0..95 -> A1..A8, B1..B8, etc.
+
+ // Map index 0..95 to registers 0x00..0xBE (interleaved)
+ uint8_t pwm_register = index * 2;
+ // Map register 0x00..0xBE (interleaved) into control register and bit
+ uint8_t control_register = pwm_register / 8;
+ uint8_t bit = pwm_register % 8;
+
+ if (enabled) {
+ g_led_control_registers[0][control_register] |= (1 << bit);
+ } else {
+ g_led_control_registers[0][control_register] &= ~(1 << bit);
+ }
+
+ g_led_control_registers_update_required = true;
+}
+
+void IS31FL3736_update_pwm_buffers(uint8_t addr1, uint8_t addr2) {
+ if (g_pwm_buffer_update_required) {
+ // Firstly we need to unlock the command register and select PG1
+ IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+ IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
+
+ IS31FL3736_write_pwm_buffer(addr1, g_pwm_buffer[0]);
+ // IS31FL3736_write_pwm_buffer(addr2, g_pwm_buffer[1]);
+ }
+ g_pwm_buffer_update_required = false;
+}
+
+void IS31FL3736_update_led_control_registers(uint8_t addr1, uint8_t addr2) {
+ if (g_led_control_registers_update_required) {
+ // Firstly we need to unlock the command register and select PG0
+ IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+ IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
+ for (int i = 0; i < 24; i++) {
+ IS31FL3736_write_register(addr1, i, g_led_control_registers[0][i]);
+ // IS31FL3736_write_register(addr2, i, g_led_control_registers[1][i]);
+ }
+ g_led_control_registers_update_required = false;
+ }
+}
diff --git a/drivers/led/issi/is31fl3736.h b/drivers/led/issi/is31fl3736.h
new file mode 100644
index 0000000000..e48e31c279
--- /dev/null
+++ b/drivers/led/issi/is31fl3736.h
@@ -0,0 +1,168 @@
+/* Copyright 2018 Jason Williams (Wilba)
+ *
+ * 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 .
+ */
+
+#pragma once
+
+#include
+#include
+
+// Simple interface option.
+// If these aren't defined, just define them to make it compile
+
+#ifndef DRIVER_COUNT
+# define DRIVER_COUNT 2
+#endif
+
+#ifndef DRIVER_LED_TOTAL
+# define DRIVER_LED_TOTAL 96
+#endif
+
+typedef struct is31_led {
+ uint8_t driver : 2;
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+} __attribute__((packed)) is31_led;
+
+extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+
+void IS31FL3736_init(uint8_t addr);
+void IS31FL3736_write_register(uint8_t addr, uint8_t reg, uint8_t data);
+void IS31FL3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
+
+void IS31FL3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
+void IS31FL3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
+
+void IS31FL3736_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
+
+void IS31FL3736_mono_set_brightness(int index, uint8_t value);
+void IS31FL3736_mono_set_brightness_all(uint8_t value);
+void IS31FL3736_mono_set_led_control_register(uint8_t index, bool enabled);
+
+// This should not be called from an interrupt
+// (eg. from a timer interrupt).
+// Call this while idle (in between matrix scans).
+// If the buffer is dirty, it will update the driver with the buffer.
+void IS31FL3736_update_pwm_buffers(uint8_t addr1, uint8_t addr2);
+void IS31FL3736_update_led_control_registers(uint8_t addr1, uint8_t addr2);
+
+#define A_1 0x00
+#define A_2 0x02
+#define A_3 0x04
+#define A_4 0x06
+#define A_5 0x08
+#define A_6 0x0A
+#define A_7 0x0C
+#define A_8 0x0E
+
+#define B_1 0x10
+#define B_2 0x12
+#define B_3 0x14
+#define B_4 0x16
+#define B_5 0x18
+#define B_6 0x1A
+#define B_7 0x1C
+#define B_8 0x1E
+
+#define C_1 0x20
+#define C_2 0x22
+#define C_3 0x24
+#define C_4 0x26
+#define C_5 0x28
+#define C_6 0x2A
+#define C_7 0x2C
+#define C_8 0x2E
+
+#define D_1 0x30
+#define D_2 0x32
+#define D_3 0x34
+#define D_4 0x36
+#define D_5 0x38
+#define D_6 0x3A
+#define D_7 0x3C
+#define D_8 0x3E
+
+#define E_1 0x40
+#define E_2 0x42
+#define E_3 0x44
+#define E_4 0x46
+#define E_5 0x48
+#define E_6 0x4A
+#define E_7 0x4C
+#define E_8 0x4E
+
+#define F_1 0x50
+#define F_2 0x52
+#define F_3 0x54
+#define F_4 0x56
+#define F_5 0x58
+#define F_6 0x5A
+#define F_7 0x5C
+#define F_8 0x5E
+
+#define G_1 0x60
+#define G_2 0x62
+#define G_3 0x64
+#define G_4 0x66
+#define G_5 0x68
+#define G_6 0x6A
+#define G_7 0x6C
+#define G_8 0x6E
+
+#define H_1 0x70
+#define H_2 0x72
+#define H_3 0x74
+#define H_4 0x76
+#define H_5 0x78
+#define H_6 0x7A
+#define H_7 0x7C
+#define H_8 0x7E
+
+#define I_1 0x80
+#define I_2 0x82
+#define I_3 0x84
+#define I_4 0x86
+#define I_5 0x88
+#define I_6 0x8A
+#define I_7 0x8C
+#define I_8 0x8E
+
+#define J_1 0x90
+#define J_2 0x92
+#define J_3 0x94
+#define J_4 0x96
+#define J_5 0x98
+#define J_6 0x9A
+#define J_7 0x9C
+#define J_8 0x9E
+
+#define K_1 0xA0
+#define K_2 0xA2
+#define K_3 0xA4
+#define K_4 0xA6
+#define K_5 0xA8
+#define K_6 0xAA
+#define K_7 0xAC
+#define K_8 0xAE
+
+#define L_1 0xB0
+#define L_2 0xB2
+#define L_3 0xB4
+#define L_4 0xB6
+#define L_5 0xB8
+#define L_6 0xBA
+#define L_7 0xBC
+#define L_8 0xBE
diff --git a/drivers/led/issi/is31fl3737.c b/drivers/led/issi/is31fl3737.c
new file mode 100644
index 0000000000..30906b4840
--- /dev/null
+++ b/drivers/led/issi/is31fl3737.c
@@ -0,0 +1,227 @@
+/* Copyright 2017 Jason Williams
+ * Copyright 2018 Jack Humbert
+ * Copyright 2018 Yiancar
+ *
+ * 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 "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)
+// The address will vary depending on your wiring:
+// 00 <-> GND
+// 01 <-> SCL
+// 10 <-> SDA
+// 11 <-> VCC
+// ADDR1 represents A1:A0 of the 7-bit address.
+// ADDR2 represents A3:A2 of the 7-bit address.
+// The result is: 0b101(ADDR2)(ADDR1)
+#define ISSI_ADDR_DEFAULT 0x50
+
+#define ISSI_COMMANDREGISTER 0xFD
+#define ISSI_COMMANDREGISTER_WRITELOCK 0xFE
+#define ISSI_INTERRUPTMASKREGISTER 0xF0
+#define ISSI_INTERRUPTSTATUSREGISTER 0xF1
+
+#define ISSI_PAGE_LEDCONTROL 0x00 // PG0
+#define ISSI_PAGE_PWM 0x01 // PG1
+#define ISSI_PAGE_AUTOBREATH 0x02 // PG2
+#define ISSI_PAGE_FUNCTION 0x03 // PG3
+
+#define ISSI_REG_CONFIGURATION 0x00 // PG3
+#define ISSI_REG_GLOBALCURRENT 0x01 // PG3
+#define ISSI_REG_RESET 0x11 // PG3
+#define ISSI_REG_SWPULLUP 0x0F // PG3
+#define ISSI_REG_CSPULLUP 0x10 // PG3
+
+#ifndef ISSI_TIMEOUT
+# define ISSI_TIMEOUT 100
+#endif
+
+#ifndef ISSI_PERSISTENCE
+# define ISSI_PERSISTENCE 0
+#endif
+
+// Transfer buffer for TWITransmitData()
+uint8_t g_twi_transfer_buffer[20];
+
+// These buffers match the IS31FL3737 PWM registers.
+// The control buffers match the PG0 LED On/Off registers.
+// Storing them like this is optimal for I2C transfers to the registers.
+// We could optimize this and take out the unused registers from these
+// buffers and the transfers in IS31FL3737_write_pwm_buffer() but it's
+// probably not worth the extra complexity.
+
+uint8_t g_pwm_buffer[DRIVER_COUNT][192];
+bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
+
+uint8_t g_led_control_registers[DRIVER_COUNT][24] = {0};
+bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
+
+void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
+ g_twi_transfer_buffer[0] = reg;
+ g_twi_transfer_buffer[1] = data;
+
+#if ISSI_PERSISTENCE > 0
+ for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
+ }
+#else
+ i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
+#endif
+}
+
+void IS31FL3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
+ // assumes PG1 is already selected
+
+ // transmit PWM registers in 12 transfers of 16 bytes
+ // g_twi_transfer_buffer[] is 20 bytes
+
+ // iterate over the pwm_buffer contents at 16 byte intervals
+ for (int i = 0; i < 192; i += 16) {
+ g_twi_transfer_buffer[0] = i;
+ // copy the data from i to i+15
+ // device will auto-increment register for data after the first byte
+ // thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer
+ for (int j = 0; j < 16; j++) {
+ g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
+ }
+
+#if ISSI_PERSISTENCE > 0
+ for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0) break;
+ }
+#else
+ i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT);
+#endif
+ }
+}
+
+void IS31FL3737_init(uint8_t addr) {
+ // In order to avoid the LEDs being driven with garbage data
+ // in the LED driver's PWM registers, shutdown is enabled last.
+ // Set up the mode and other settings, clear the PWM registers,
+ // then disable software shutdown.
+
+ // Unlock the command register.
+ IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+
+ // Select PG0
+ IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
+ // Turn off all LEDs.
+ for (int i = 0x00; i <= 0x17; i++) {
+ IS31FL3737_write_register(addr, i, 0x00);
+ }
+
+ // Unlock the command register.
+ IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+
+ // Select PG1
+ IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
+ // Set PWM on all LEDs to 0
+ // No need to setup Breath registers to PWM as that is the default.
+ for (int i = 0x00; i <= 0xBF; i++) {
+ IS31FL3737_write_register(addr, i, 0x00);
+ }
+
+ // Unlock the command register.
+ IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+
+ // Select PG3
+ IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
+ // Set global current to maximum.
+ IS31FL3737_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
+ // Disable software shutdown.
+ IS31FL3737_write_register(addr, ISSI_REG_CONFIGURATION, 0x01);
+
+ // Wait 10ms to ensure the device has woken up.
+ wait_ms(10);
+}
+
+void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
+ if (index >= 0 && index < DRIVER_LED_TOTAL) {
+ // copy the led config from progmem to SRAM
+ 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;
+ g_pwm_buffer[led.driver][led.b] = blue;
+ g_pwm_buffer_update_required[led.driver] = true;
+ }
+}
+
+void IS31FL3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
+ for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ IS31FL3737_set_color(i, red, green, blue);
+ }
+}
+
+void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
+ // copy the led config from progmem to SRAM
+ 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;
+ uint8_t control_register_b = led.b / 8;
+ uint8_t bit_r = led.r % 8;
+ uint8_t bit_g = led.g % 8;
+ uint8_t bit_b = led.b % 8;
+
+ if (red) {
+ g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r);
+ } else {
+ g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r);
+ }
+ if (green) {
+ g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g);
+ } else {
+ g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g);
+ }
+ if (blue) {
+ g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b);
+ } else {
+ g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b);
+ }
+
+ g_led_control_registers_update_required[led.driver] = true;
+}
+
+void IS31FL3737_update_pwm_buffers(uint8_t addr, uint8_t index) {
+ if (g_pwm_buffer_update_required[index]) {
+ // Firstly we need to unlock the command register and select PG1
+ IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+ IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
+
+ IS31FL3737_write_pwm_buffer(addr, g_pwm_buffer[index]);
+ }
+ g_pwm_buffer_update_required[index] = false;
+}
+
+void IS31FL3737_update_led_control_registers(uint8_t addr, uint8_t index) {
+ if (g_led_control_registers_update_required[index]) {
+ // Firstly we need to unlock the command register and select PG0
+ IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+ IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
+ for (int i = 0; i < 24; i++) {
+ IS31FL3737_write_register(addr, i, g_led_control_registers[index][i]);
+ }
+ }
+ g_led_control_registers_update_required[index] = false;
+}
diff --git a/drivers/led/issi/is31fl3737.h b/drivers/led/issi/is31fl3737.h
new file mode 100644
index 0000000000..a1d2281778
--- /dev/null
+++ b/drivers/led/issi/is31fl3737.h
@@ -0,0 +1,203 @@
+/* Copyright 2017 Jason Williams
+ * Copyright 2018 Jack Humbert
+ * Copyright 2018 Yiancar
+ *
+ * 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 .
+ */
+
+#pragma once
+
+#include
+#include
+
+typedef struct is31_led {
+ uint8_t driver : 2;
+ uint8_t r;
+ uint8_t g;
+ uint8_t b;
+} __attribute__((packed)) is31_led;
+
+extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+
+void IS31FL3737_init(uint8_t addr);
+void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data);
+void IS31FL3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
+
+void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
+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);
+
+// This should not be called from an interrupt
+// (eg. from a timer interrupt).
+// Call this while idle (in between matrix scans).
+// If the buffer is dirty, it will update the driver with the buffer.
+void IS31FL3737_update_pwm_buffers(uint8_t addr1, uint8_t addr2);
+void IS31FL3737_update_led_control_registers(uint8_t addr1, uint8_t addr2);
+
+#define A_1 0x00
+#define A_2 0x01
+#define A_3 0x02
+#define A_4 0x03
+#define A_5 0x04
+#define A_6 0x05
+#define A_7 0x08
+#define A_8 0x09
+#define A_9 0x0A
+#define A_10 0x0B
+#define A_11 0x0C
+#define A_12 0x0D
+
+#define B_1 0x10
+#define B_2 0x11
+#define B_3 0x12
+#define B_4 0x13
+#define B_5 0x14
+#define B_6 0x15
+#define B_7 0x18
+#define B_8 0x19
+#define B_9 0x1A
+#define B_10 0x1B
+#define B_11 0x1C
+#define B_12 0x1D
+
+#define C_1 0x20
+#define C_2 0x21
+#define C_3 0x22
+#define C_4 0x23
+#define C_5 0x24
+#define C_6 0x25
+#define C_7 0x28
+#define C_8 0x29
+#define C_9 0x2A
+#define C_10 0x2B
+#define C_11 0x2C
+#define C_12 0x2D
+
+#define D_1 0x30
+#define D_2 0x31
+#define D_3 0x32
+#define D_4 0x33
+#define D_5 0x34
+#define D_6 0x35
+#define D_7 0x38
+#define D_8 0x39
+#define D_9 0x3A
+#define D_10 0x3B
+#define D_11 0x3C
+#define D_12 0x3D
+
+#define E_1 0x40
+#define E_2 0x41
+#define E_3 0x42
+#define E_4 0x43
+#define E_5 0x44
+#define E_6 0x45
+#define E_7 0x48
+#define E_8 0x49
+#define E_9 0x4A
+#define E_10 0x4B
+#define E_11 0x4C
+#define E_12 0x4D
+
+#define F_1 0x50
+#define F_2 0x51
+#define F_3 0x52
+#define F_4 0x53
+#define F_5 0x54
+#define F_6 0x55
+#define F_7 0x58
+#define F_8 0x59
+#define F_9 0x5A
+#define F_10 0x5B
+#define F_11 0x5C
+#define F_12 0x5D
+
+#define G_1 0x60
+#define G_2 0x61
+#define G_3 0x62
+#define G_4 0x63
+#define G_5 0x64
+#define G_6 0x65
+#define G_7 0x68
+#define G_8 0x69
+#define G_9 0x6A
+#define G_10 0x6B
+#define G_11 0x6C
+#define G_12 0x6D
+
+#define H_1 0x70
+#define H_2 0x71
+#define H_3 0x72
+#define H_4 0x73
+#define H_5 0x74
+#define H_6 0x75
+#define H_7 0x78
+#define H_8 0x79
+#define H_9 0x7A
+#define H_10 0x7B
+#define H_11 0x7C
+#define H_12 0x7D
+
+#define I_1 0x80
+#define I_2 0x81
+#define I_3 0x82
+#define I_4 0x83
+#define I_5 0x84
+#define I_6 0x85
+#define I_7 0x88
+#define I_8 0x89
+#define I_9 0x8A
+#define I_10 0x8B
+#define I_11 0x8C
+#define I_12 0x8D
+
+#define J_1 0x90
+#define J_2 0x91
+#define J_3 0x92
+#define J_4 0x93
+#define J_5 0x94
+#define J_6 0x95
+#define J_7 0x98
+#define J_8 0x99
+#define J_9 0x9A
+#define J_10 0x9B
+#define J_11 0x9C
+#define J_12 0x9D
+
+#define K_1 0xA0
+#define K_2 0xA1
+#define K_3 0xA2
+#define K_4 0xA3
+#define K_5 0xA4
+#define K_6 0xA5
+#define K_7 0xA8
+#define K_8 0xA9
+#define K_9 0xAA
+#define K_10 0xAB
+#define K_11 0xAC
+#define K_12 0xAD
+
+#define L_1 0xB0
+#define L_2 0xB1
+#define L_3 0xB2
+#define L_4 0xB3
+#define L_5 0xB4
+#define L_6 0xB5
+#define L_7 0xB8
+#define L_8 0xB9
+#define L_9 0xBA
+#define L_10 0xBB
+#define L_11 0xBC
+#define L_12 0xBD
diff --git a/drivers/led/issi/is31fl3741.c b/drivers/led/issi/is31fl3741.c
new file mode 100644
index 0000000000..1b533c9b6a
--- /dev/null
+++ b/drivers/led/issi/is31fl3741.c
@@ -0,0 +1,255 @@
+/* Copyright 2017 Jason Williams
+ * Copyright 2018 Jack Humbert
+ * Copyright 2018 Yiancar
+ * Copyright 2020 MelGeek
+ *
+ * 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 "wait.h"
+
+#include "is31fl3741.h"
+#include
+#include "i2c_master.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)
+// The address will vary depending on your wiring:
+// 00 <-> GND
+// 01 <-> SCL
+// 10 <-> SDA
+// 11 <-> VCC
+// ADDR1 represents A1:A0 of the 7-bit address.
+// ADDR2 represents A3:A2 of the 7-bit address.
+// The result is: 0b101(ADDR2)(ADDR1)
+#define ISSI_ADDR_DEFAULT 0x60
+
+#define ISSI_COMMANDREGISTER 0xFD
+#define ISSI_COMMANDREGISTER_WRITELOCK 0xFE
+#define ISSI_INTERRUPTMASKREGISTER 0xF0
+#define ISSI_INTERRUPTSTATUSREGISTER 0xF1
+#define ISSI_IDREGISTER 0xFC
+
+#define ISSI_PAGE_PWM0 0x00 // PG0
+#define ISSI_PAGE_PWM1 0x01 // PG1
+#define ISSI_PAGE_SCALING_0 0x02 // PG2
+#define ISSI_PAGE_SCALING_1 0x03 // PG3
+#define ISSI_PAGE_FUNCTION 0x04 // PG4
+
+#define ISSI_REG_CONFIGURATION 0x00 // PG4
+#define ISSI_REG_GLOBALCURRENT 0x01 // PG4
+#define ISSI_REG_PULLDOWNUP 0x02 // PG4
+#define ISSI_REG_RESET 0x3F // PG4
+
+#ifndef ISSI_TIMEOUT
+# define ISSI_TIMEOUT 100
+#endif
+
+#ifndef ISSI_PERSISTENCE
+# define ISSI_PERSISTENCE 0
+#endif
+
+#define ISSI_MAX_LEDS 351
+
+// Transfer buffer for TWITransmitData()
+uint8_t g_twi_transfer_buffer[20] = {0xFF};
+
+// These buffers match the IS31FL3741 and IS31FL3741A PWM registers.
+// The scaling buffers match the PG2 and PG3 LED On/Off registers.
+// Storing them like this is optimal for I2C transfers to the registers.
+// We could optimize this and take out the unused registers from these
+// buffers and the transfers in IS31FL3741_write_pwm_buffer() but it's
+// probably not worth the extra complexity.
+uint8_t g_pwm_buffer[DRIVER_COUNT][ISSI_MAX_LEDS];
+bool g_pwm_buffer_update_required = false;
+bool g_scaling_registers_update_required[DRIVER_COUNT] = {false};
+
+uint8_t g_scaling_registers[DRIVER_COUNT][ISSI_MAX_LEDS];
+
+void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
+ g_twi_transfer_buffer[0] = reg;
+ g_twi_transfer_buffer[1] = data;
+
+#if ISSI_PERSISTENCE > 0
+ for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
+ }
+#else
+ i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
+#endif
+}
+
+bool IS31FL3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
+ // unlock the command register and select PG2
+ IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+ IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM0);
+
+ for (int i = 0; i < 342; i += 18) {
+ if (i == 180) {
+ // unlock the command register and select PG2
+ IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+ IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM1);
+ }
+
+ g_twi_transfer_buffer[0] = i % 180;
+ memcpy(g_twi_transfer_buffer + 1, pwm_buffer + i, 18);
+
+#if ISSI_PERSISTENCE > 0
+ for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 19, ISSI_TIMEOUT) != 0) {
+ return false;
+ }
+ }
+#else
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 19, ISSI_TIMEOUT) != 0) {
+ return false;
+ }
+#endif
+ }
+
+ // transfer the left cause the total number is 351
+ g_twi_transfer_buffer[0] = 162;
+ memcpy(g_twi_transfer_buffer + 1, pwm_buffer + 342, 9);
+
+#if ISSI_PERSISTENCE > 0
+ for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 10, ISSI_TIMEOUT) != 0) {
+ return false;
+ }
+ }
+#else
+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 10, ISSI_TIMEOUT) != 0) {
+ return false;
+ }
+#endif
+
+ return true;
+}
+
+void IS31FL3741_init(uint8_t addr) {
+ // In order to avoid the LEDs being driven with garbage data
+ // in the LED driver's PWM registers, shutdown is enabled last.
+ // Set up the mode and other settings, clear the PWM registers,
+ // then disable software shutdown.
+ // Unlock the command register.
+
+ // Unlock the command register.
+ IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+
+ // Select PG4
+ IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
+
+ // Set to Normal operation
+ IS31FL3741_write_register(addr, ISSI_REG_CONFIGURATION, 0x01);
+
+ // Set Golbal Current Control Register
+ IS31FL3741_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
+ // Set Pull up & Down for SWx CSy
+ IS31FL3741_write_register(addr, ISSI_REG_PULLDOWNUP, 0x77);
+
+ // IS31FL3741_update_led_scaling_registers(addr, 0xFF, 0xFF, 0xFF);
+
+ // Wait 10ms to ensure the device has woken up.
+ wait_ms(10);
+}
+
+void IS31FL3741_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];
+
+ g_pwm_buffer[led.driver][led.r] = red;
+ g_pwm_buffer[led.driver][led.g] = green;
+ g_pwm_buffer[led.driver][led.b] = blue;
+ g_pwm_buffer_update_required = true;
+ }
+}
+
+void IS31FL3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
+ for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
+ IS31FL3741_set_color(i, red, green, blue);
+ }
+}
+
+void IS31FL3741_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
+ is31_led led = g_is31_leds[index];
+
+ if (red) {
+ g_scaling_registers[led.driver][led.r] = 0xFF;
+ } else {
+ g_scaling_registers[led.driver][led.r] = 0x00;
+ }
+
+ if (green) {
+ g_scaling_registers[led.driver][led.g] = 0xFF;
+ } else {
+ g_scaling_registers[led.driver][led.g] = 0x00;
+ }
+
+ if (blue) {
+ g_scaling_registers[led.driver][led.b] = 0xFF;
+ } else {
+ g_scaling_registers[led.driver][led.b] = 0x00;
+ }
+
+ g_scaling_registers_update_required[led.driver] = true;
+}
+
+void IS31FL3741_update_pwm_buffers(uint8_t addr1, uint8_t addr2) {
+ if (g_pwm_buffer_update_required) {
+ IS31FL3741_write_pwm_buffer(addr1, g_pwm_buffer[0]);
+ }
+
+ g_pwm_buffer_update_required = false;
+}
+
+void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue) {
+ g_pwm_buffer[pled->driver][pled->r] = red;
+ g_pwm_buffer[pled->driver][pled->g] = green;
+ g_pwm_buffer[pled->driver][pled->b] = blue;
+
+ g_pwm_buffer_update_required = true;
+}
+
+void IS31FL3741_update_led_control_registers(uint8_t addr, uint8_t index) {
+ if (g_scaling_registers_update_required[index]) {
+ // unlock the command register and select PG2
+ IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+ IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_SCALING_0);
+
+ // CS1_SW1 to CS30_SW6 are on PG2
+ for (int i = CS1_SW1; i <= CS30_SW6; ++i) {
+ IS31FL3741_write_register(addr, i, g_scaling_registers[0][i]);
+ }
+
+ // unlock the command register and select PG3
+ IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
+ IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_SCALING_1);
+
+ // CS1_SW7 to CS39_SW9 are on PG3
+ for (int i = CS1_SW7; i <= CS39_SW9; ++i) {
+ IS31FL3741_write_register(addr, i - CS1_SW7, g_scaling_registers[0][i]);
+ }
+
+ g_scaling_registers_update_required[index] = false;
+ }
+}
+
+void IS31FL3741_set_scaling_registers(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue) {
+ g_scaling_registers[pled->driver][pled->r] = red;
+ g_scaling_registers[pled->driver][pled->g] = green;
+ g_scaling_registers[pled->driver][pled->b] = blue;
+
+ g_scaling_registers_update_required[pled->driver] = true;
+}
diff --git a/drivers/led/issi/is31fl3741.h b/drivers/led/issi/is31fl3741.h
new file mode 100644
index 0000000000..2df0c5b1a7
--- /dev/null
+++ b/drivers/led/issi/is31fl3741.h
@@ -0,0 +1,420 @@
+/* Copyright 2017 Jason Williams
+ * Copyright 2018 Jack Humbert
+ * Copyright 2018 Yiancar
+ * Copyright 2020 MelGeek
+ *
+ * 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 .
+ */
+
+#pragma once
+
+#include
+#include
+
+typedef struct is31_led {
+ uint32_t driver : 2;
+ uint32_t r : 10;
+ uint32_t g : 10;
+ uint32_t b : 10;
+} __attribute__((packed)) is31_led;
+
+extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+
+void IS31FL3741_init(uint8_t addr);
+void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data);
+bool IS31FL3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
+
+void IS31FL3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
+void IS31FL3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
+
+void IS31FL3741_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
+
+// This should not be called from an interrupt
+// (eg. from a timer interrupt).
+// Call this while idle (in between matrix scans).
+// If the buffer is dirty, it will update the driver with the buffer.
+void IS31FL3741_update_pwm_buffers(uint8_t addr1, uint8_t addr2);
+void IS31FL3741_update_led_control_registers(uint8_t addr1, uint8_t addr2);
+void IS31FL3741_set_scaling_registers(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue);
+
+void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue);
+
+#define CS1_SW1 0x00
+#define CS2_SW1 0x01
+#define CS3_SW1 0x02
+#define CS4_SW1 0x03
+#define CS5_SW1 0x04
+#define CS6_SW1 0x05
+#define CS7_SW1 0x06
+#define CS8_SW1 0x07
+#define CS9_SW1 0x08
+#define CS10_SW1 0x09
+#define CS11_SW1 0x0A
+#define CS12_SW1 0x0B
+#define CS13_SW1 0x0C
+#define CS14_SW1 0x0D
+#define CS15_SW1 0x0E
+#define CS16_SW1 0x0F
+#define CS17_SW1 0x10
+#define CS18_SW1 0x11
+#define CS19_SW1 0x12
+#define CS20_SW1 0x13
+#define CS21_SW1 0x14
+#define CS22_SW1 0x15
+#define CS23_SW1 0x16
+#define CS24_SW1 0x17
+#define CS25_SW1 0x18
+#define CS26_SW1 0x19
+#define CS27_SW1 0x1A
+#define CS28_SW1 0x1B
+#define CS29_SW1 0x1C
+#define CS30_SW1 0x1D
+
+#define CS1_SW2 0x1E
+#define CS2_SW2 0x1F
+#define CS3_SW2 0x20
+#define CS4_SW2 0x21
+#define CS5_SW2 0x22
+#define CS6_SW2 0x23
+#define CS7_SW2 0x24
+#define CS8_SW2 0x25
+#define CS9_SW2 0x26
+#define CS10_SW2 0x27
+#define CS11_SW2 0x28
+#define CS12_SW2 0x29
+#define CS13_SW2 0x2A
+#define CS14_SW2 0x2B
+#define CS15_SW2 0x2C
+#define CS16_SW2 0x2D
+#define CS17_SW2 0x2E
+#define CS18_SW2 0x2F
+#define CS19_SW2 0x30
+#define CS20_SW2 0x31
+#define CS21_SW2 0x32
+#define CS22_SW2 0x33
+#define CS23_SW2 0x34
+#define CS24_SW2 0x35
+#define CS25_SW2 0x36
+#define CS26_SW2 0x37
+#define CS27_SW2 0x38
+#define CS28_SW2 0x39
+#define CS29_SW2 0x3A
+#define CS30_SW2 0x3B
+
+#define CS1_SW3 0x3C
+#define CS2_SW3 0x3D
+#define CS3_SW3 0x3E
+#define CS4_SW3 0x3F
+#define CS5_SW3 0x40
+#define CS6_SW3 0x41
+#define CS7_SW3 0x42
+#define CS8_SW3 0x43
+#define CS9_SW3 0x44
+#define CS10_SW3 0x45
+#define CS11_SW3 0x46
+#define CS12_SW3 0x47
+#define CS13_SW3 0x48
+#define CS14_SW3 0x49
+#define CS15_SW3 0x4A
+#define CS16_SW3 0x4B
+#define CS17_SW3 0x4C
+#define CS18_SW3 0x4D
+#define CS19_SW3 0x4E
+#define CS20_SW3 0x4F
+#define CS21_SW3 0x50
+#define CS22_SW3 0x51
+#define CS23_SW3 0x52
+#define CS24_SW3 0x53
+#define CS25_SW3 0x54
+#define CS26_SW3 0x55
+#define CS27_SW3 0x56
+#define CS28_SW3 0x57
+#define CS29_SW3 0x58
+#define CS30_SW3 0x59
+
+#define CS1_SW4 0x5A
+#define CS2_SW4 0x5B
+#define CS3_SW4 0x5C
+#define CS4_SW4 0x5D
+#define CS5_SW4 0x5E
+#define CS6_SW4 0x5F
+#define CS7_SW4 0x60
+#define CS8_SW4 0x61
+#define CS9_SW4 0x62
+#define CS10_SW4 0x63
+#define CS11_SW4 0x64
+#define CS12_SW4 0x65
+#define CS13_SW4 0x66
+#define CS14_SW4 0x67
+#define CS15_SW4 0x68
+#define CS16_SW4 0x69
+#define CS17_SW4 0x6A
+#define CS18_SW4 0x6B
+#define CS19_SW4 0x6C
+#define CS20_SW4 0x6D
+#define CS21_SW4 0x6E
+#define CS22_SW4 0x6F
+#define CS23_SW4 0x70
+#define CS24_SW4 0x71
+#define CS25_SW4 0x72
+#define CS26_SW4 0x73
+#define CS27_SW4 0x74
+#define CS28_SW4 0x75
+#define CS29_SW4 0x76
+#define CS30_SW4 0x77
+
+#define CS1_SW5 0x78
+#define CS2_SW5 0x79
+#define CS3_SW5 0x7A
+#define CS4_SW5 0x7B
+#define CS5_SW5 0x7C
+#define CS6_SW5 0x7D
+#define CS7_SW5 0x7E
+#define CS8_SW5 0x7F
+#define CS9_SW5 0x80
+#define CS10_SW5 0x81
+#define CS11_SW5 0x82
+#define CS12_SW5 0x83
+#define CS13_SW5 0x84
+#define CS14_SW5 0x85
+#define CS15_SW5 0x86
+#define CS16_SW5 0x87
+#define CS17_SW5 0x88
+#define CS18_SW5 0x89
+#define CS19_SW5 0x8A
+#define CS20_SW5 0x8B
+#define CS21_SW5 0x8C
+#define CS22_SW5 0x8D
+#define CS23_SW5 0x8E
+#define CS24_SW5 0x8F
+#define CS25_SW5 0x90
+#define CS26_SW5 0x91
+#define CS27_SW5 0x92
+#define CS28_SW5 0x93
+#define CS29_SW5 0x94
+#define CS30_SW5 0x95
+
+#define CS1_SW6 0x96
+#define CS2_SW6 0x97
+#define CS3_SW6 0x98
+#define CS4_SW6 0x99
+#define CS5_SW6 0x9A
+#define CS6_SW6 0x9B
+#define CS7_SW6 0x9C
+#define CS8_SW6 0x9D
+#define CS9_SW6 0x9E
+#define CS10_SW6 0x9F
+#define CS11_SW6 0xA0
+#define CS12_SW6 0xA1
+#define CS13_SW6 0xA2
+#define CS14_SW6 0xA3
+#define CS15_SW6 0xA4
+#define CS16_SW6 0xA5
+#define CS17_SW6 0xA6
+#define CS18_SW6 0xA7
+#define CS19_SW6 0xA8
+#define CS20_SW6 0xA9
+#define CS21_SW6 0xAA
+#define CS22_SW6 0xAB
+#define CS23_SW6 0xAC
+#define CS24_SW6 0xAD
+#define CS25_SW6 0xAE
+#define CS26_SW6 0xAF
+#define CS27_SW6 0xB0
+#define CS28_SW6 0xB1
+#define CS29_SW6 0xB2
+#define CS30_SW6 0xB3
+
+#define CS1_SW7 0xB4
+#define CS2_SW7 0xB5
+#define CS3_SW7 0xB6
+#define CS4_SW7 0xB7
+#define CS5_SW7 0xB8
+#define CS6_SW7 0xB9
+#define CS7_SW7 0xBA
+#define CS8_SW7 0xBB
+#define CS9_SW7 0xBC
+#define CS10_SW7 0xBD
+#define CS11_SW7 0xBE
+#define CS12_SW7 0xBF
+#define CS13_SW7 0xC0
+#define CS14_SW7 0xC1
+#define CS15_SW7 0xC2
+#define CS16_SW7 0xC3
+#define CS17_SW7 0xC4
+#define CS18_SW7 0xC5
+#define CS19_SW7 0xC6
+#define CS20_SW7 0xC7
+#define CS21_SW7 0xC8
+#define CS22_SW7 0xC9
+#define CS23_SW7 0xCA
+#define CS24_SW7 0xCB
+#define CS25_SW7 0xCC
+#define CS26_SW7 0xCD
+#define CS27_SW7 0xCE
+#define CS28_SW7 0xCF
+#define CS29_SW7 0xD0
+#define CS30_SW7 0xD1
+
+#define CS1_SW8 0xD2
+#define CS2_SW8 0xD3
+#define CS3_SW8 0xD4
+#define CS4_SW8 0xD5
+#define CS5_SW8 0xD6
+#define CS6_SW8 0xD7
+#define CS7_SW8 0xD8
+#define CS8_SW8 0xD9
+#define CS9_SW8 0xDA
+#define CS10_SW8 0xDB
+#define CS11_SW8 0xDC
+#define CS12_SW8 0xDD
+#define CS13_SW8 0xDE
+#define CS14_SW8 0xDF
+#define CS15_SW8 0xE0
+#define CS16_SW8 0xE1
+#define CS17_SW8 0xE2
+#define CS18_SW8 0xE3
+#define CS19_SW8 0xE4
+#define CS20_SW8 0xE5
+#define CS21_SW8 0xE6
+#define CS22_SW8 0xE7
+#define CS23_SW8 0xE8
+#define CS24_SW8 0xE9
+#define CS25_SW8 0xEA
+#define CS26_SW8 0xEB
+#define CS27_SW8 0xEC
+#define CS28_SW8 0xED
+#define CS29_SW8 0xEE
+#define CS30_SW8 0xEF
+
+#define CS1_SW9 0xF0
+#define CS2_SW9 0xF1
+#define CS3_SW9 0xF2
+#define CS4_SW9 0xF3
+#define CS5_SW9 0xF4
+#define CS6_SW9 0xF5
+#define CS7_SW9 0xF6
+#define CS8_SW9 0xF7
+#define CS9_SW9 0xF8
+#define CS10_SW9 0xF9
+#define CS11_SW9 0xFA
+#define CS12_SW9 0xFB
+#define CS13_SW9 0xFC
+#define CS14_SW9 0xFD
+#define CS15_SW9 0xFE
+#define CS16_SW9 0xFF
+#define CS17_SW9 0x100
+#define CS18_SW9 0x101
+#define CS19_SW9 0x102
+#define CS20_SW9 0x103
+#define CS21_SW9 0x104
+#define CS22_SW9 0x105
+#define CS23_SW9 0x106
+#define CS24_SW9 0x107
+#define CS25_SW9 0x108
+#define CS26_SW9 0x109
+#define CS27_SW9 0x10A
+#define CS28_SW9 0x10B
+#define CS29_SW9 0x10C
+#define CS30_SW9 0x10D
+
+#define CS31_SW1 0x10E
+#define CS32_SW1 0x10F
+#define CS33_SW1 0x110
+#define CS34_SW1 0x111
+#define CS35_SW1 0x112
+#define CS36_SW1 0x113
+#define CS37_SW1 0x114
+#define CS38_SW1 0x115
+#define CS39_SW1 0x116
+
+#define CS31_SW2 0x117
+#define CS32_SW2 0x118
+#define CS33_SW2 0x119
+#define CS34_SW2 0x11A
+#define CS35_SW2 0x11B
+#define CS36_SW2 0x11C
+#define CS37_SW2 0x11D
+#define CS38_SW2 0x11E
+#define CS39_SW2 0x11F
+
+#define CS31_SW3 0x120
+#define CS32_SW3 0x121
+#define CS33_SW3 0x122
+#define CS34_SW3 0x123
+#define CS35_SW3 0x124
+#define CS36_SW3 0x125
+#define CS37_SW3 0x126
+#define CS38_SW3 0x127
+#define CS39_SW3 0x128
+
+#define CS31_SW4 0x129
+#define CS32_SW4 0x12A
+#define CS33_SW4 0x12B
+#define CS34_SW4 0x12C
+#define CS35_SW4 0x12D
+#define CS36_SW4 0x12E
+#define CS37_SW4 0x12F
+#define CS38_SW4 0x130
+#define CS39_SW4 0x131
+
+#define CS31_SW5 0x132
+#define CS32_SW5 0x133
+#define CS33_SW5 0x134
+#define CS34_SW5 0x135
+#define CS35_SW5 0x136
+#define CS36_SW5 0x137
+#define CS37_SW5 0x138
+#define CS38_SW5 0x139
+#define CS39_SW5 0x13A
+
+#define CS31_SW6 0x13B
+#define CS32_SW6 0x13C
+#define CS33_SW6 0x13D
+#define CS34_SW6 0x13E
+#define CS35_SW6 0x13F
+#define CS36_SW6 0x140
+#define CS37_SW6 0x141
+#define CS38_SW6 0x142
+#define CS39_SW6 0x143
+
+#define CS31_SW7 0x144
+#define CS32_SW7 0x145
+#define CS33_SW7 0x146
+#define CS34_SW7 0x147
+#define CS35_SW7 0x148
+#define CS36_SW7 0x149
+#define CS37_SW7 0x14A
+#define CS38_SW7 0x14B
+#define CS39_SW7 0x14C
+
+#define CS31_SW8 0x14D
+#define CS32_SW8 0x14E
+#define CS33_SW8 0x14F
+#define CS34_SW8 0x150
+#define CS35_SW8 0x151
+#define CS36_SW8 0x152
+#define CS37_SW8 0x153
+#define CS38_SW8 0x154
+#define CS39_SW8 0x155
+
+#define CS31_SW9 0x156
+#define CS32_SW9 0x157
+#define CS33_SW9 0x158
+#define CS34_SW9 0x159
+#define CS35_SW9 0x15A
+#define CS36_SW9 0x15B
+#define CS37_SW9 0x15C
+#define CS38_SW9 0x15D
+#define CS39_SW9 0x15E
diff --git a/keyboards/fallacy/indicators.c b/keyboards/fallacy/indicators.c
index 6c80f31678..08c500064d 100755
--- a/keyboards/fallacy/indicators.c
+++ b/keyboards/fallacy/indicators.c
@@ -15,7 +15,7 @@
*/
#include "indicators.h"
-#include "drivers/issi/is31fl3731-simple.h"
+#include "drivers/led/issi/is31fl3731-simple.h"
#include "i2c_master.h"
/* Set up IS31FL3731 for use in powering indicator LEDs. Absolutely overkill for this job but it was already in the design.
diff --git a/keyboards/fallacy/rules.mk b/keyboards/fallacy/rules.mk
index dfc96a31b8..93e02c1695 100755
--- a/keyboards/fallacy/rules.mk
+++ b/keyboards/fallacy/rules.mk
@@ -24,7 +24,7 @@ AUDIO_ENABLE = no # Audio output
# project specific files
SRC += indicators.c \
- drivers/issi/is31fl3731-simple.c
+ drivers/led/issi/is31fl3731-simple.c
QUANTUM_LIB_SRC += i2c_master.c
LAYOUTS = alice alice_split_bs
diff --git a/keyboards/hs60/v2/ansi/rules.mk b/keyboards/hs60/v2/ansi/rules.mk
index 1a0c1abbd8..c8030e7040 100644
--- a/keyboards/hs60/v2/ansi/rules.mk
+++ b/keyboards/hs60/v2/ansi/rules.mk
@@ -31,6 +31,6 @@ LAYOUTS = 60_ansi
# project specific files
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
- drivers/issi/is31fl3733.c \
+ drivers/led/issi/is31fl3733.c \
quantum/color.c \
drivers/chibios/i2c_master.c
diff --git a/keyboards/hs60/v2/hhkb/rules.mk b/keyboards/hs60/v2/hhkb/rules.mk
index 87d86ccd4c..62c067cb2e 100644
--- a/keyboards/hs60/v2/hhkb/rules.mk
+++ b/keyboards/hs60/v2/hhkb/rules.mk
@@ -29,6 +29,6 @@ CIE1931_CURVE = yes
# project specific files
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
- drivers/issi/is31fl3733.c \
+ drivers/led/issi/is31fl3733.c \
quantum/color.c \
drivers/chibios/i2c_master.c
diff --git a/keyboards/hs60/v2/iso/rules.mk b/keyboards/hs60/v2/iso/rules.mk
index 53b801289d..34cfa9e559 100644
--- a/keyboards/hs60/v2/iso/rules.mk
+++ b/keyboards/hs60/v2/iso/rules.mk
@@ -31,6 +31,6 @@ LAYOUTS = 60_iso
# project specific files
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
- drivers/issi/is31fl3733.c \
+ drivers/led/issi/is31fl3733.c \
quantum/color.c \
drivers/chibios/i2c_master.c
diff --git a/keyboards/keebwerk/mega/ansi/ansi.c b/keyboards/keebwerk/mega/ansi/ansi.c
index b5eb0bbad2..532cdec9aa 100755
--- a/keyboards/keebwerk/mega/ansi/ansi.c
+++ b/keyboards/keebwerk/mega/ansi/ansi.c
@@ -18,7 +18,7 @@
#endif
#include "ansi.h"
-#include "drivers/issi/is31fl3733.h"
+#include "drivers/led/issi/is31fl3733.h"
uint8_t R = 0;
uint8_t G = 0;
diff --git a/keyboards/keebwerk/mega/ansi/rules.mk b/keyboards/keebwerk/mega/ansi/rules.mk
index 6a1a9cbfad..aaf31579f0 100755
--- a/keyboards/keebwerk/mega/ansi/rules.mk
+++ b/keyboards/keebwerk/mega/ansi/rules.mk
@@ -34,6 +34,6 @@ LAYOUTS = 65_ansi
# project specific files
SRC += keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
- drivers/issi/is31fl3733.c \
+ drivers/led/issi/is31fl3733.c \
quantum/color.c
QUANTUM_LIB_SRC += drivers/chibios/i2c_master.c
diff --git a/keyboards/nebula12/rules.mk b/keyboards/nebula12/rules.mk
index 3a423fb78e..ce18e6b2e3 100755
--- a/keyboards/nebula12/rules.mk
+++ b/keyboards/nebula12/rules.mk
@@ -31,6 +31,6 @@ CIE1931_CURVE = yes
# project specific files
SRC += keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
- drivers/issi/is31fl3731.c \
+ drivers/led/issi/is31fl3731.c \
quantum/color.c
QUANTUM_LIB_SRC += drivers/chibios/i2c_master.c
diff --git a/keyboards/nebula68/rules.mk b/keyboards/nebula68/rules.mk
index bcf1fd1a8f..14782d6547 100755
--- a/keyboards/nebula68/rules.mk
+++ b/keyboards/nebula68/rules.mk
@@ -33,6 +33,6 @@ LAYOUTS = 68_ansi
# project specific files
SRC += keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
- drivers/issi/is31fl3733.c \
+ drivers/led/issi/is31fl3733.c \
quantum/color.c
QUANTUM_LIB_SRC += drivers/chibios/i2c_master.c
diff --git a/keyboards/nk65/nk65.c b/keyboards/nk65/nk65.c
index fae30ac75c..4ed18c114e 100755
--- a/keyboards/nk65/nk65.c
+++ b/keyboards/nk65/nk65.c
@@ -18,7 +18,7 @@
#endif
#include "nk65.h"
-#include "drivers/issi/is31fl3733.h"
+#include "drivers/led/issi/is31fl3733.h"
/* Indicator LEDS are part of the LED driver
* Top LED is blue only. LED driver 2 RGB 7 Green channel
diff --git a/keyboards/nk65/rules.mk b/keyboards/nk65/rules.mk
index e3f02ee09b..bdb8a74903 100755
--- a/keyboards/nk65/rules.mk
+++ b/keyboards/nk65/rules.mk
@@ -31,6 +31,6 @@ LAYOUTS = 65_ansi
# project specific files
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
- drivers/issi/is31fl3733.c \
+ drivers/led/issi/is31fl3733.c \
quantum/color.c \
drivers/chibios/i2c_master.c
diff --git a/keyboards/nk87/nk87.c b/keyboards/nk87/nk87.c
index bcebbc651c..c90ba02ea4 100755
--- a/keyboards/nk87/nk87.c
+++ b/keyboards/nk87/nk87.c
@@ -18,7 +18,7 @@
#endif
#include "nk87.h"
-#include "drivers/issi/is31fl3733.h"
+#include "drivers/led/issi/is31fl3733.h"
/* Indicator LEDS are part of the LED driver
* Top LED is blue only. LED driver 2 RGB 63 Blue channel
diff --git a/keyboards/nk87/rules.mk b/keyboards/nk87/rules.mk
index 71f8f3dd80..d7ca223b30 100755
--- a/keyboards/nk87/rules.mk
+++ b/keyboards/nk87/rules.mk
@@ -32,6 +32,6 @@ CIE1931_CURVE = yes
# project specific files
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
- drivers/issi/is31fl3733.c \
+ drivers/led/issi/is31fl3733.c \
quantum/color.c \
drivers/chibios/i2c_master.c
diff --git a/keyboards/tkc/portico/rules.mk b/keyboards/tkc/portico/rules.mk
index 84a65370e3..174938417c 100644
--- a/keyboards/tkc/portico/rules.mk
+++ b/keyboards/tkc/portico/rules.mk
@@ -28,7 +28,7 @@ CIE1931_CURVE = yes
SRC += keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
quantum/color.c \
- drivers/issi/is31fl3731.c
+ drivers/led/issi/is31fl3731.c
QUANTUM_LIB_SRC += i2c_master.c
diff --git a/keyboards/wilba_tech/rama_works_kara/rules.mk b/keyboards/wilba_tech/rama_works_kara/rules.mk
index 8af9101d35..69efcc01e7 100644
--- a/keyboards/wilba_tech/rama_works_kara/rules.mk
+++ b/keyboards/wilba_tech/rama_works_kara/rules.mk
@@ -34,5 +34,5 @@ LAYOUTS = 60_hhkb
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
quantum/color.c \
- drivers/issi/is31fl3731.c \
+ drivers/led/issi/is31fl3731.c \
drivers/avr/i2c_master.c
diff --git a/keyboards/wilba_tech/rama_works_koyu/rules.mk b/keyboards/wilba_tech/rama_works_koyu/rules.mk
index 809ab26d0e..be95279206 100644
--- a/keyboards/wilba_tech/rama_works_koyu/rules.mk
+++ b/keyboards/wilba_tech/rama_works_koyu/rules.mk
@@ -42,5 +42,5 @@ CIE1931_CURVE = yes
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
quantum/color.c \
- drivers/issi/is31fl3731.c \
+ drivers/led/issi/is31fl3731.c \
drivers/avr/i2c_master.c
diff --git a/keyboards/wilba_tech/rama_works_m10_c/rules.mk b/keyboards/wilba_tech/rama_works_m10_c/rules.mk
index 9f4cc186ed..ab9fdaeb61 100644
--- a/keyboards/wilba_tech/rama_works_m10_c/rules.mk
+++ b/keyboards/wilba_tech/rama_works_m10_c/rules.mk
@@ -31,5 +31,5 @@ OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
quantum/color.c \
- drivers/issi/is31fl3731.c \
+ drivers/led/issi/is31fl3731.c \
drivers/avr/i2c_master.c
diff --git a/keyboards/wilba_tech/rama_works_m50_a/rules.mk b/keyboards/wilba_tech/rama_works_m50_a/rules.mk
index 9f4cc186ed..ab9fdaeb61 100644
--- a/keyboards/wilba_tech/rama_works_m50_a/rules.mk
+++ b/keyboards/wilba_tech/rama_works_m50_a/rules.mk
@@ -31,5 +31,5 @@ OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
quantum/color.c \
- drivers/issi/is31fl3731.c \
+ drivers/led/issi/is31fl3731.c \
drivers/avr/i2c_master.c
diff --git a/keyboards/wilba_tech/rama_works_m60_a/rules.mk b/keyboards/wilba_tech/rama_works_m60_a/rules.mk
index 7e76a962a2..f44c5856ae 100644
--- a/keyboards/wilba_tech/rama_works_m60_a/rules.mk
+++ b/keyboards/wilba_tech/rama_works_m60_a/rules.mk
@@ -44,5 +44,5 @@ LAYOUTS = 60_hhkb
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
quantum/color.c \
- drivers/issi/is31fl3731.c \
+ drivers/led/issi/is31fl3731.c \
drivers/avr/i2c_master.c
diff --git a/keyboards/wilba_tech/rama_works_m65_b/rules.mk b/keyboards/wilba_tech/rama_works_m65_b/rules.mk
index 9f4cc186ed..ab9fdaeb61 100644
--- a/keyboards/wilba_tech/rama_works_m65_b/rules.mk
+++ b/keyboards/wilba_tech/rama_works_m65_b/rules.mk
@@ -31,5 +31,5 @@ OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
quantum/color.c \
- drivers/issi/is31fl3731.c \
+ drivers/led/issi/is31fl3731.c \
drivers/avr/i2c_master.c
diff --git a/keyboards/wilba_tech/rama_works_m65_bx/rules.mk b/keyboards/wilba_tech/rama_works_m65_bx/rules.mk
index 9f4cc186ed..ab9fdaeb61 100644
--- a/keyboards/wilba_tech/rama_works_m65_bx/rules.mk
+++ b/keyboards/wilba_tech/rama_works_m65_bx/rules.mk
@@ -31,5 +31,5 @@ OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
quantum/color.c \
- drivers/issi/is31fl3731.c \
+ drivers/led/issi/is31fl3731.c \
drivers/avr/i2c_master.c
diff --git a/keyboards/wilba_tech/rama_works_m6_b/rules.mk b/keyboards/wilba_tech/rama_works_m6_b/rules.mk
index 51d1a0c805..139a968c24 100644
--- a/keyboards/wilba_tech/rama_works_m6_b/rules.mk
+++ b/keyboards/wilba_tech/rama_works_m6_b/rules.mk
@@ -41,5 +41,5 @@ CIE1931_CURVE = yes
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
quantum/color.c \
- drivers/issi/is31fl3218.c \
+ drivers/led/issi/is31fl3218.c \
drivers/avr/i2c_master.c
diff --git a/keyboards/wilba_tech/rama_works_u80_a/rules.mk b/keyboards/wilba_tech/rama_works_u80_a/rules.mk
index 735d2a24ae..654465e683 100644
--- a/keyboards/wilba_tech/rama_works_u80_a/rules.mk
+++ b/keyboards/wilba_tech/rama_works_u80_a/rules.mk
@@ -34,5 +34,5 @@ CIE1931_CURVE = yes
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
quantum/color.c \
- drivers/issi/is31fl3731.c \
+ drivers/led/issi/is31fl3731.c \
drivers/avr/i2c_master.c
diff --git a/keyboards/wilba_tech/wt60_a/rules.mk b/keyboards/wilba_tech/wt60_a/rules.mk
index a0f923a2f3..e892986112 100644
--- a/keyboards/wilba_tech/wt60_a/rules.mk
+++ b/keyboards/wilba_tech/wt60_a/rules.mk
@@ -30,7 +30,7 @@ BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = no # Audio output on port C6
# project specific files
-SRC = drivers/issi/is31fl3736.c \
+SRC = drivers/led/issi/is31fl3736.c \
drivers/avr/i2c_master.c \
quantum/color.c \
keyboards/wilba_tech/wt_mono_backlight.c \
diff --git a/keyboards/wilba_tech/wt60_b/rules.mk b/keyboards/wilba_tech/wt60_b/rules.mk
index 50faab968c..e3cbad41ca 100644
--- a/keyboards/wilba_tech/wt60_b/rules.mk
+++ b/keyboards/wilba_tech/wt60_b/rules.mk
@@ -42,5 +42,5 @@ CIE1931_CURVE = yes
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
quantum/color.c \
- drivers/issi/is31fl3731.c \
+ drivers/led/issi/is31fl3731.c \
drivers/avr/i2c_master.c
diff --git a/keyboards/wilba_tech/wt60_bx/rules.mk b/keyboards/wilba_tech/wt60_bx/rules.mk
index 50faab968c..e3cbad41ca 100644
--- a/keyboards/wilba_tech/wt60_bx/rules.mk
+++ b/keyboards/wilba_tech/wt60_bx/rules.mk
@@ -42,5 +42,5 @@ CIE1931_CURVE = yes
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
quantum/color.c \
- drivers/issi/is31fl3731.c \
+ drivers/led/issi/is31fl3731.c \
drivers/avr/i2c_master.c
diff --git a/keyboards/wilba_tech/wt60_c/rules.mk b/keyboards/wilba_tech/wt60_c/rules.mk
index 50faab968c..e3cbad41ca 100644
--- a/keyboards/wilba_tech/wt60_c/rules.mk
+++ b/keyboards/wilba_tech/wt60_c/rules.mk
@@ -42,5 +42,5 @@ CIE1931_CURVE = yes
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
quantum/color.c \
- drivers/issi/is31fl3731.c \
+ drivers/led/issi/is31fl3731.c \
drivers/avr/i2c_master.c
diff --git a/keyboards/wilba_tech/wt65_a/rules.mk b/keyboards/wilba_tech/wt65_a/rules.mk
index a0f923a2f3..e892986112 100644
--- a/keyboards/wilba_tech/wt65_a/rules.mk
+++ b/keyboards/wilba_tech/wt65_a/rules.mk
@@ -30,7 +30,7 @@ BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = no # Audio output on port C6
# project specific files
-SRC = drivers/issi/is31fl3736.c \
+SRC = drivers/led/issi/is31fl3736.c \
drivers/avr/i2c_master.c \
quantum/color.c \
keyboards/wilba_tech/wt_mono_backlight.c \
diff --git a/keyboards/wilba_tech/wt65_b/rules.mk b/keyboards/wilba_tech/wt65_b/rules.mk
index a0f923a2f3..e892986112 100644
--- a/keyboards/wilba_tech/wt65_b/rules.mk
+++ b/keyboards/wilba_tech/wt65_b/rules.mk
@@ -30,7 +30,7 @@ BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = no # Audio output on port C6
# project specific files
-SRC = drivers/issi/is31fl3736.c \
+SRC = drivers/led/issi/is31fl3736.c \
drivers/avr/i2c_master.c \
quantum/color.c \
keyboards/wilba_tech/wt_mono_backlight.c \
diff --git a/keyboards/wilba_tech/wt75_a/rules.mk b/keyboards/wilba_tech/wt75_a/rules.mk
index a0f923a2f3..e892986112 100644
--- a/keyboards/wilba_tech/wt75_a/rules.mk
+++ b/keyboards/wilba_tech/wt75_a/rules.mk
@@ -30,7 +30,7 @@ BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = no # Audio output on port C6
# project specific files
-SRC = drivers/issi/is31fl3736.c \
+SRC = drivers/led/issi/is31fl3736.c \
drivers/avr/i2c_master.c \
quantum/color.c \
keyboards/wilba_tech/wt_mono_backlight.c \
diff --git a/keyboards/wilba_tech/wt75_b/rules.mk b/keyboards/wilba_tech/wt75_b/rules.mk
index a0f923a2f3..e892986112 100644
--- a/keyboards/wilba_tech/wt75_b/rules.mk
+++ b/keyboards/wilba_tech/wt75_b/rules.mk
@@ -30,7 +30,7 @@ BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = no # Audio output on port C6
# project specific files
-SRC = drivers/issi/is31fl3736.c \
+SRC = drivers/led/issi/is31fl3736.c \
drivers/avr/i2c_master.c \
quantum/color.c \
keyboards/wilba_tech/wt_mono_backlight.c \
diff --git a/keyboards/wilba_tech/wt75_c/rules.mk b/keyboards/wilba_tech/wt75_c/rules.mk
index a0f923a2f3..e892986112 100644
--- a/keyboards/wilba_tech/wt75_c/rules.mk
+++ b/keyboards/wilba_tech/wt75_c/rules.mk
@@ -30,7 +30,7 @@ BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = no # Audio output on port C6
# project specific files
-SRC = drivers/issi/is31fl3736.c \
+SRC = drivers/led/issi/is31fl3736.c \
drivers/avr/i2c_master.c \
quantum/color.c \
keyboards/wilba_tech/wt_mono_backlight.c \
diff --git a/keyboards/wilba_tech/wt80_a/rules.mk b/keyboards/wilba_tech/wt80_a/rules.mk
index a0f923a2f3..e892986112 100644
--- a/keyboards/wilba_tech/wt80_a/rules.mk
+++ b/keyboards/wilba_tech/wt80_a/rules.mk
@@ -30,7 +30,7 @@ BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = no # Audio output on port C6
# project specific files
-SRC = drivers/issi/is31fl3736.c \
+SRC = drivers/led/issi/is31fl3736.c \
drivers/avr/i2c_master.c \
quantum/color.c \
keyboards/wilba_tech/wt_mono_backlight.c \
diff --git a/keyboards/wilba_tech/wt_mono_backlight.c b/keyboards/wilba_tech/wt_mono_backlight.c
index fbc3102e8c..310e9afd1b 100644
--- a/keyboards/wilba_tech/wt_mono_backlight.c
+++ b/keyboards/wilba_tech/wt_mono_backlight.c
@@ -33,7 +33,7 @@
#error VIA_EEPROM_CUSTOM_CONFIG_SIZE was not defined to store backlight_config struct
#endif
-#include "drivers/issi/is31fl3736.h"
+#include "drivers/led/issi/is31fl3736.h"
#define ISSI_ADDR_DEFAULT 0x50
diff --git a/keyboards/wilba_tech/wt_rgb_backlight.c b/keyboards/wilba_tech/wt_rgb_backlight.c
index e57d061b20..e0359daab4 100644
--- a/keyboards/wilba_tech/wt_rgb_backlight.c
+++ b/keyboards/wilba_tech/wt_rgb_backlight.c
@@ -78,19 +78,19 @@ LED_TYPE g_ws2812_leds[WS2812_LED_TOTAL];
#endif
#if defined(RGB_BACKLIGHT_M6_B)
-#include "drivers/issi/is31fl3218.h"
+#include "drivers/led/issi/is31fl3218.h"
#define BACKLIGHT_LED_COUNT 6
#elif defined(RGB_BACKLIGHT_HS60)
-#include "drivers/issi/is31fl3733.h"
+#include "drivers/led/issi/is31fl3733.h"
#define BACKLIGHT_LED_COUNT 64
#elif defined(RGB_BACKLIGHT_NK65) || defined(RGB_BACKLIGHT_NEBULA68) || defined(RGB_BACKLIGHT_KW_MEGA)
-#include "drivers/issi/is31fl3733.h"
+#include "drivers/led/issi/is31fl3733.h"
#define BACKLIGHT_LED_COUNT 69
#elif defined(RGB_BACKLIGHT_NK87)
-#include "drivers/issi/is31fl3733.h"
+#include "drivers/led/issi/is31fl3733.h"
#define BACKLIGHT_LED_COUNT 128
#else
-#include "drivers/issi/is31fl3731.h"
+#include "drivers/led/issi/is31fl3731.h"
#if defined(RGB_BACKLIGHT_U80_A)
#define BACKLIGHT_LED_COUNT 108
#elif defined(RGB_BACKLIGHT_DAWN60)
diff --git a/keyboards/wilba_tech/zeal60/rules.mk b/keyboards/wilba_tech/zeal60/rules.mk
index 172ebaf6b5..acd1ba36d9 100644
--- a/keyboards/wilba_tech/zeal60/rules.mk
+++ b/keyboards/wilba_tech/zeal60/rules.mk
@@ -44,5 +44,5 @@ LAYOUTS = 60_ansi 60_iso 60_hhkb 60_ansi_split_bs_rshift
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
quantum/color.c \
- drivers/issi/is31fl3731.c \
+ drivers/led/issi/is31fl3731.c \
drivers/avr/i2c_master.c
diff --git a/keyboards/wilba_tech/zeal65/rules.mk b/keyboards/wilba_tech/zeal65/rules.mk
index fcf3d07637..8c3a3772c1 100644
--- a/keyboards/wilba_tech/zeal65/rules.mk
+++ b/keyboards/wilba_tech/zeal65/rules.mk
@@ -42,5 +42,5 @@ CIE1931_CURVE = yes
SRC = keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
quantum/color.c \
- drivers/issi/is31fl3731.c \
+ drivers/led/issi/is31fl3731.c \
drivers/avr/i2c_master.c
diff --git a/keyboards/xelus/dawn60/rev1/rules.mk b/keyboards/xelus/dawn60/rev1/rules.mk
index 64b6615e81..dda4e5048f 100644
--- a/keyboards/xelus/dawn60/rev1/rules.mk
+++ b/keyboards/xelus/dawn60/rev1/rules.mk
@@ -42,7 +42,7 @@ CIE1931_CURVE = yes
SRC += keyboards/wilba_tech/wt_main.c \
keyboards/wilba_tech/wt_rgb_backlight.c \
quantum/color.c \
- drivers/issi/is31fl3731.c \
+ drivers/led/issi/is31fl3731.c \
ws2812.c
QUANTUM_LIB_SRC += i2c_master.c
diff --git a/keyboards/xelus/dawn60/rev1_qmk/rev1_qmk.c b/keyboards/xelus/dawn60/rev1_qmk/rev1_qmk.c
index 901f7a18c2..c305ecae14 100644
--- a/keyboards/xelus/dawn60/rev1_qmk/rev1_qmk.c
+++ b/keyboards/xelus/dawn60/rev1_qmk/rev1_qmk.c
@@ -18,7 +18,7 @@
#include
#include
#include
-#include "drivers/issi/is31fl3731.h"
+#include "drivers/led/issi/is31fl3731.h"
#include "ws2812.h"
#include "rev1_qmk.h"
diff --git a/keyboards/xelus/dawn60/rev1_qmk/rules.mk b/keyboards/xelus/dawn60/rev1_qmk/rules.mk
index edfba27304..eb1dd5557c 100644
--- a/keyboards/xelus/dawn60/rev1_qmk/rules.mk
+++ b/keyboards/xelus/dawn60/rev1_qmk/rules.mk
@@ -42,7 +42,7 @@ RGB_MATRIX_DRIVER = custom # Enable RGB matrix effects.
COMMON_VPATH += $(DRIVER_PATH)/issi
# project specific files
-SRC += drivers/issi/is31fl3731.c \
+SRC += drivers/led/issi/is31fl3731.c \
ws2812.c
QUANTUM_LIB_SRC += i2c_master.c
diff --git a/keyboards/xelus/pachi/rgb/rgb.c b/keyboards/xelus/pachi/rgb/rgb.c
index 1e4ad619c3..ea9812d6b1 100644
--- a/keyboards/xelus/pachi/rgb/rgb.c
+++ b/keyboards/xelus/pachi/rgb/rgb.c
@@ -23,7 +23,7 @@ void matrix_io_delay(void) { __asm__ volatile("nop\nnop\nnop\n"); }
#ifdef RGB_MATRIX_ENABLE
#include
-#include "drivers/issi/is31fl3741.h"
+#include "drivers/led/issi/is31fl3741.h"
const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
diff --git a/keyboards/xelus/pachi/rgb/rules.mk b/keyboards/xelus/pachi/rgb/rules.mk
index 6c1b3298c4..bc55888bef 100644
--- a/keyboards/xelus/pachi/rgb/rules.mk
+++ b/keyboards/xelus/pachi/rgb/rules.mk
@@ -29,7 +29,7 @@ RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = custom
COMMON_VPATH += $(DRIVER_PATH)/issi
-SRC += drivers/issi/is31fl3741.c
+SRC += drivers/led/issi/is31fl3741.c
LTO_ENABLE = yes
OPT = 2
--
cgit v1.2.3
From 70fb3e1aaf406cbbd5137916a93ed814d6891ef2 Mon Sep 17 00:00:00 2001
From: Joel Challis
Date: Sat, 31 Jul 2021 14:35:30 +0100
Subject: __flash? (#13799)
---
docs/feature_led_matrix.md | 2 +-
docs/feature_rgb_matrix.md | 8 ++++----
docs/ja/feature_led_matrix.md | 2 +-
drivers/led/aw20216.h | 3 ++-
drivers/led/issi/is31fl3731-simple.h | 3 ++-
drivers/led/issi/is31fl3731.h | 3 ++-
drivers/led/issi/is31fl3733.h | 3 ++-
drivers/led/issi/is31fl3736.h | 3 ++-
drivers/led/issi/is31fl3737.c | 9 ++-------
drivers/led/issi/is31fl3737.h | 3 ++-
drivers/led/issi/is31fl3741.h | 3 ++-
keyboards/clueboard/66_hotswap/gen1/gen1.c | 2 +-
keyboards/dp60/dp60.c | 2 +-
keyboards/durgod/dgk6x/galaxy/galaxy.c | 2 +-
keyboards/durgod/dgk6x/hades/hades.c | 2 +-
keyboards/durgod/dgk6x/venus/venus.c | 2 +-
keyboards/dztech/dz60rgb/dz60rgb.c | 2 +-
keyboards/dztech/dz60rgb_ansi/dz60rgb_ansi.c | 2 +-
keyboards/dztech/dz60rgb_wkl/dz60rgb_wkl.c | 2 +-
keyboards/dztech/dz65rgb/v1/v1.c | 2 +-
keyboards/dztech/dz65rgb/v2/v2.c | 2 +-
keyboards/dztech/dz65rgb/v3/v3.c | 2 +-
keyboards/ergodox_ez/ergodox_ez.c | 2 +-
keyboards/ergodox_infinity/ergodox_infinity.c | 2 +-
keyboards/exclusive/e6_rgb/e6_rgb.c | 2 +-
keyboards/fallacy/indicators.c | 2 +-
keyboards/geekboards/tester/tester.c | 2 +-
keyboards/hs60/v1/v1.c | 4 ++--
keyboards/inett_studio/sqx/hotswap/hotswap.c | 2 +-
keyboards/inett_studio/sqx/universal/universal.c | 2 +-
keyboards/k_type/is31fl3733-dual.h | 2 +-
keyboards/k_type/k_type.c | 2 +-
keyboards/kbdfans/bella/rgb/rgb.c | 2 +-
keyboards/kbdfans/bella/rgb_iso/rgb_iso.c | 2 +-
keyboards/kbdfans/kbd67/mkiirgb/mkiirgb.c | 2 +-
keyboards/kbdfans/kbdmini/kbdmini.c | 2 +-
keyboards/kbdfans/maja/maja.c | 2 +-
keyboards/keychron/q1/q1.c | 2 +-
keyboards/latin17rgb/latin17rgb.c | 2 +-
keyboards/latin60rgb/latin60rgb.c | 2 +-
keyboards/latin6rgb/latin6rgb.c | 2 +-
keyboards/matrix/m20add/rgb_ring.c | 2 +-
keyboards/matrix/noah/noah.c | 2 +-
keyboards/mechlovin/adelais/rgb_led/rev2/rev2.c | 2 +-
keyboards/mechlovin/delphine/rgb_led/rgb_led.c | 2 +-
keyboards/mechlovin/hannah60rgb/rev2/rev2.c | 2 +-
keyboards/mechlovin/infinity87/rgb_rev1/rgb_rev1.c | 2 +-
keyboards/melgeek/mj61/rev1/rev1.c | 2 +-
keyboards/melgeek/mj61/rev2/rev2.c | 2 +-
keyboards/melgeek/mj63/rev1/rev1.c | 2 +-
keyboards/melgeek/mj63/rev2/rev2.c | 2 +-
keyboards/melgeek/mj64/rev1/rev1.c | 2 +-
keyboards/melgeek/mj64/rev2/rev2.c | 2 +-
keyboards/melgeek/mj64/rev3/rev3.c | 2 +-
keyboards/melgeek/mj65/rev3/rev3.c | 2 +-
keyboards/melgeek/mojo75/rev1/rev1.c | 2 +-
keyboards/melgeek/z70ultra/z70ultra.c | 2 +-
keyboards/miller/gm862/gm862.c | 2 +-
keyboards/moonlander/moonlander.c | 2 +-
keyboards/mt64rgb/mt64rgb.c | 2 +-
keyboards/mt84/mt84.c | 2 +-
keyboards/opendeck/32/rev1/rev1.c | 2 +-
keyboards/planck/ez/ez.c | 2 +-
keyboards/planck/light/light.c | 2 +-
keyboards/terrazzo/terrazzo.c | 2 +-
keyboards/tkc/portico/portico.c | 2 +-
keyboards/whitefox/whitefox.c | 2 +-
keyboards/wilba_tech/wt_rgb_backlight.c | 16 ++++++++--------
keyboards/xbows/knight/knight.c | 2 +-
keyboards/xbows/knight_plus/knight_plus.c | 2 +-
keyboards/xbows/nature/nature.c | 2 +-
keyboards/xbows/numpad/numpad.c | 2 +-
keyboards/xbows/woody/woody.c | 2 +-
keyboards/xelus/dawn60/rev1_qmk/rev1_qmk.c | 2 +-
keyboards/xelus/pachi/rgb/rgb.c | 2 +-
tmk_core/common/progmem.h | 1 +
76 files changed, 95 insertions(+), 92 deletions(-)
(limited to 'docs/feature_rgb_matrix.md')
diff --git a/docs/feature_led_matrix.md b/docs/feature_led_matrix.md
index afa11e7232..7d7971bbed 100644
--- a/docs/feature_led_matrix.md
+++ b/docs/feature_led_matrix.md
@@ -52,7 +52,7 @@ Here is an example using 2 drivers.
Define these arrays listing all the LEDs in your `.c`:
```c
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | LED address
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 18e38955ec..670d7e09bf 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -52,7 +52,7 @@ Here is an example using 2 drivers.
Define these arrays listing all the LEDs in your `.c`:
```c
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@@ -122,7 +122,7 @@ Currently only 4 drivers are supported, but it would be trivial to support all 8
Define these arrays listing all the LEDs in your `.c`:
```c
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@@ -186,7 +186,7 @@ Currently only 2 drivers are supported, but it would be trivial to support all 4
Define these arrays listing all the LEDs in your `.c`:
```c
-const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@@ -287,7 +287,7 @@ Here is an example using 2 drivers.
Define these arrays listing all the LEDs in your `.c`:
```c
-const aw_led g_aw_leds[DRIVER_LED_TOTAL] = {
+const aw_led __flash g_aw_leds[DRIVER_LED_TOTAL] = {
/* Each AW20216 channel is controlled by a register at some offset between 0x00
* and 0xD7 inclusive.
* See drivers/awinic/aw20216.h for the mapping between register offsets and
diff --git a/docs/ja/feature_led_matrix.md b/docs/ja/feature_led_matrix.md
index f132d716f6..6511b28249 100644
--- a/docs/ja/feature_led_matrix.md
+++ b/docs/ja/feature_led_matrix.md
@@ -52,7 +52,7 @@ I2C IS31FL3731 RGB コントローラを使ったアドレス指定可能な LED
`.c` に全ての LED を列挙する配列を定義します:
- const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+ const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* これらの位置については IS31 マニュアルを参照してください
* driver
* | LED address
diff --git a/drivers/led/aw20216.h b/drivers/led/aw20216.h
index c55d9605fc..97ac6dc5bf 100644
--- a/drivers/led/aw20216.h
+++ b/drivers/led/aw20216.h
@@ -18,6 +18,7 @@
#include
#include
+#include "progmem.h"
#include "gpio.h"
typedef struct aw_led {
@@ -27,7 +28,7 @@ typedef struct aw_led {
uint8_t b;
} aw_led;
-extern const aw_led g_aw_leds[DRIVER_LED_TOTAL];
+extern const aw_led __flash g_aw_leds[DRIVER_LED_TOTAL];
void AW20216_init(pin_t cs_pin, pin_t en_pin);
void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
diff --git a/drivers/led/issi/is31fl3731-simple.h b/drivers/led/issi/is31fl3731-simple.h
index 9665d6ed35..ecde31eed5 100644
--- a/drivers/led/issi/is31fl3731-simple.h
+++ b/drivers/led/issi/is31fl3731-simple.h
@@ -20,13 +20,14 @@
#include
#include
+#include "progmem.h"
typedef struct is31_led {
uint8_t driver : 2;
uint8_t v;
} __attribute__((packed)) is31_led;
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led __flash 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/drivers/led/issi/is31fl3731.h b/drivers/led/issi/is31fl3731.h
index 19e8e6251f..803ea3ea12 100644
--- a/drivers/led/issi/is31fl3731.h
+++ b/drivers/led/issi/is31fl3731.h
@@ -19,6 +19,7 @@
#include
#include
+#include "progmem.h"
typedef struct is31_led {
uint8_t driver : 2;
@@ -27,7 +28,7 @@ typedef struct is31_led {
uint8_t b;
} __attribute__((packed)) is31_led;
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led __flash 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/drivers/led/issi/is31fl3733.h b/drivers/led/issi/is31fl3733.h
index 603d505a13..64fd38eb19 100644
--- a/drivers/led/issi/is31fl3733.h
+++ b/drivers/led/issi/is31fl3733.h
@@ -20,6 +20,7 @@
#include
#include
+#include "progmem.h"
typedef struct is31_led {
uint8_t driver : 2;
@@ -28,7 +29,7 @@ typedef struct is31_led {
uint8_t b;
} __attribute__((packed)) is31_led;
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL];
void IS31FL3733_init(uint8_t addr, uint8_t sync);
bool IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data);
diff --git a/drivers/led/issi/is31fl3736.h b/drivers/led/issi/is31fl3736.h
index e48e31c279..c956c87f7c 100644
--- a/drivers/led/issi/is31fl3736.h
+++ b/drivers/led/issi/is31fl3736.h
@@ -18,6 +18,7 @@
#include
#include
+#include "progmem.h"
// Simple interface option.
// If these aren't defined, just define them to make it compile
@@ -37,7 +38,7 @@ typedef struct is31_led {
uint8_t b;
} __attribute__((packed)) is31_led;
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL];
void IS31FL3736_init(uint8_t addr);
void IS31FL3736_write_register(uint8_t addr, uint8_t reg, uint8_t data);
diff --git a/drivers/led/issi/is31fl3737.c b/drivers/led/issi/is31fl3737.c
index 30906b4840..0bb4ddd425 100644
--- a/drivers/led/issi/is31fl3737.c
+++ b/drivers/led/issi/is31fl3737.c
@@ -19,7 +19,6 @@
#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)
@@ -155,9 +154,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) {
- // copy the led config from progmem to SRAM
- is31_led led;
- memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
+ is31_led led = g_is31_leds[index];
g_pwm_buffer[led.driver][led.r] = red;
g_pwm_buffer[led.driver][led.g] = green;
@@ -173,9 +170,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) {
- // copy the led config from progmem to SRAM
- is31_led led;
- memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
+ is31_led led = g_is31_leds[index];
uint8_t control_register_r = led.r / 8;
uint8_t control_register_g = led.g / 8;
diff --git a/drivers/led/issi/is31fl3737.h b/drivers/led/issi/is31fl3737.h
index a1d2281778..06886e9c9b 100644
--- a/drivers/led/issi/is31fl3737.h
+++ b/drivers/led/issi/is31fl3737.h
@@ -20,6 +20,7 @@
#include
#include
+#include "progmem.h"
typedef struct is31_led {
uint8_t driver : 2;
@@ -28,7 +29,7 @@ typedef struct is31_led {
uint8_t b;
} __attribute__((packed)) is31_led;
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL];
void IS31FL3737_init(uint8_t addr);
void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data);
diff --git a/drivers/led/issi/is31fl3741.h b/drivers/led/issi/is31fl3741.h
index 2df0c5b1a7..cea6761ca8 100644
--- a/drivers/led/issi/is31fl3741.h
+++ b/drivers/led/issi/is31fl3741.h
@@ -21,6 +21,7 @@
#include
#include
+#include "progmem.h"
typedef struct is31_led {
uint32_t driver : 2;
@@ -29,7 +30,7 @@ typedef struct is31_led {
uint32_t b : 10;
} __attribute__((packed)) is31_led;
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL];
void IS31FL3741_init(uint8_t addr);
void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data);
diff --git a/keyboards/clueboard/66_hotswap/gen1/gen1.c b/keyboards/clueboard/66_hotswap/gen1/gen1.c
index 339bd78d5a..8e3db70d07 100644
--- a/keyboards/clueboard/66_hotswap/gen1/gen1.c
+++ b/keyboards/clueboard/66_hotswap/gen1/gen1.c
@@ -16,7 +16,7 @@
#include "gen1.h"
#ifdef LED_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | LED address
diff --git a/keyboards/dp60/dp60.c b/keyboards/dp60/dp60.c
index 475084b049..87543b2a1c 100644
--- a/keyboards/dp60/dp60.c
+++ b/keyboards/dp60/dp60.c
@@ -17,7 +17,7 @@
#include "dp60.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/durgod/dgk6x/galaxy/galaxy.c b/keyboards/durgod/dgk6x/galaxy/galaxy.c
index d101533b16..5f793ed85b 100644
--- a/keyboards/durgod/dgk6x/galaxy/galaxy.c
+++ b/keyboards/durgod/dgk6x/galaxy/galaxy.c
@@ -18,7 +18,7 @@
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/durgod/dgk6x/hades/hades.c b/keyboards/durgod/dgk6x/hades/hades.c
index 21b2722913..3e235683f1 100644
--- a/keyboards/durgod/dgk6x/hades/hades.c
+++ b/keyboards/durgod/dgk6x/hades/hades.c
@@ -19,7 +19,7 @@
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/durgod/dgk6x/venus/venus.c b/keyboards/durgod/dgk6x/venus/venus.c
index 2d49b34daf..3398acb19d 100644
--- a/keyboards/durgod/dgk6x/venus/venus.c
+++ b/keyboards/durgod/dgk6x/venus/venus.c
@@ -18,7 +18,7 @@
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/dztech/dz60rgb/dz60rgb.c b/keyboards/dztech/dz60rgb/dz60rgb.c
index aa02fb902d..a7fc3dbc5c 100644
--- a/keyboards/dztech/dz60rgb/dz60rgb.c
+++ b/keyboards/dztech/dz60rgb/dz60rgb.c
@@ -1,7 +1,7 @@
#include "dz60rgb.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{ 0, K_14, J_14, L_14 },
{ 0, K_13, J_13, L_13 },
{ 0, K_12, J_12, L_12 },
diff --git a/keyboards/dztech/dz60rgb_ansi/dz60rgb_ansi.c b/keyboards/dztech/dz60rgb_ansi/dz60rgb_ansi.c
index 4bb5938b66..ab24410912 100644
--- a/keyboards/dztech/dz60rgb_ansi/dz60rgb_ansi.c
+++ b/keyboards/dztech/dz60rgb_ansi/dz60rgb_ansi.c
@@ -1,7 +1,7 @@
#include "dz60rgb_ansi.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{ 0, K_14, J_14, L_14 },
{ 0, K_13, J_13, L_13 },
{ 0, K_12, J_12, L_12 },
diff --git a/keyboards/dztech/dz60rgb_wkl/dz60rgb_wkl.c b/keyboards/dztech/dz60rgb_wkl/dz60rgb_wkl.c
index b57560bacd..455624471d 100644
--- a/keyboards/dztech/dz60rgb_wkl/dz60rgb_wkl.c
+++ b/keyboards/dztech/dz60rgb_wkl/dz60rgb_wkl.c
@@ -1,7 +1,7 @@
#include "dz60rgb_wkl.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{ 0, H_15, G_15, I_15 },
{ 0, K_14, J_14, L_14 },
{ 0, K_13, J_13, L_13 },
diff --git a/keyboards/dztech/dz65rgb/v1/v1.c b/keyboards/dztech/dz65rgb/v1/v1.c
index 8a3f0e27bf..aabe41c313 100644
--- a/keyboards/dztech/dz65rgb/v1/v1.c
+++ b/keyboards/dztech/dz65rgb/v1/v1.c
@@ -16,7 +16,7 @@
#include "v1.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{ 0, C8_8, C7_8, C6_8 },
{ 0, C9_8, C7_7, C6_7 },
{ 0, C9_7, C8_7, C6_6 },
diff --git a/keyboards/dztech/dz65rgb/v2/v2.c b/keyboards/dztech/dz65rgb/v2/v2.c
index 788709d989..dce167c73f 100644
--- a/keyboards/dztech/dz65rgb/v2/v2.c
+++ b/keyboards/dztech/dz65rgb/v2/v2.c
@@ -16,7 +16,7 @@
#include "v2.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{ 0, C8_8, C7_8, C6_8 },
{ 0, C9_8, C7_7, C6_7 },
{ 0, C9_7, C8_7, C6_6 },
diff --git a/keyboards/dztech/dz65rgb/v3/v3.c b/keyboards/dztech/dz65rgb/v3/v3.c
index dec75814ca..c3719bfa51 100755
--- a/keyboards/dztech/dz65rgb/v3/v3.c
+++ b/keyboards/dztech/dz65rgb/v3/v3.c
@@ -18,7 +18,7 @@
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, CS21_SW1, CS20_SW1, CS19_SW1},
{0, CS21_SW2, CS20_SW2, CS19_SW2},
{0, CS21_SW3, CS20_SW3, CS19_SW3},
diff --git a/keyboards/ergodox_ez/ergodox_ez.c b/keyboards/ergodox_ez/ergodox_ez.c
index 47dd1b0cc9..7af76cb624 100644
--- a/keyboards/ergodox_ez/ergodox_ez.c
+++ b/keyboards/ergodox_ez/ergodox_ez.c
@@ -243,7 +243,7 @@ const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
#ifdef RGB_MATRIX_ENABLE
// clang-format off
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* driver
* | R location
* | | G location
diff --git a/keyboards/ergodox_infinity/ergodox_infinity.c b/keyboards/ergodox_infinity/ergodox_infinity.c
index 76cbca07f8..90aa522427 100644
--- a/keyboards/ergodox_infinity/ergodox_infinity.c
+++ b/keyboards/ergodox_infinity/ergodox_infinity.c
@@ -191,7 +191,7 @@ const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
#endif
#ifdef LED_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
// The numbers in the comments are the led numbers DXX on the PCB
/* Refer to IS31 manual for these locations
* driver
diff --git a/keyboards/exclusive/e6_rgb/e6_rgb.c b/keyboards/exclusive/e6_rgb/e6_rgb.c
index 0e248a2023..e0d313f835 100644
--- a/keyboards/exclusive/e6_rgb/e6_rgb.c
+++ b/keyboards/exclusive/e6_rgb/e6_rgb.c
@@ -11,7 +11,7 @@ void matrix_init_kb(void) {
matrix_init_user();
}
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/fallacy/indicators.c b/keyboards/fallacy/indicators.c
index 08c500064d..dcf1b4de07 100755
--- a/keyboards/fallacy/indicators.c
+++ b/keyboards/fallacy/indicators.c
@@ -54,7 +54,7 @@ void set_fallacy_led(int index, bool state) {
/* define LED matrix
*/
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, C1_1},
{0, C2_1},
{0, C3_1},
diff --git a/keyboards/geekboards/tester/tester.c b/keyboards/geekboards/tester/tester.c
index 4fab1a7012..0c5c056cc0 100644
--- a/keyboards/geekboards/tester/tester.c
+++ b/keyboards/geekboards/tester/tester.c
@@ -1,5 +1,5 @@
#include "tester.h"
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/hs60/v1/v1.c b/keyboards/hs60/v1/v1.c
index 70c1c2128e..58b19b6408 100644
--- a/keyboards/hs60/v1/v1.c
+++ b/keyboards/hs60/v1/v1.c
@@ -91,7 +91,7 @@ void raw_hid_receive( uint8_t *data, uint8_t length )
#ifdef HS60_ANSI
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@@ -199,7 +199,7 @@ led_config_t g_led_config = { {
#else
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/inett_studio/sqx/hotswap/hotswap.c b/keyboards/inett_studio/sqx/hotswap/hotswap.c
index be8985c87e..5b3c8df822 100644
--- a/keyboards/inett_studio/sqx/hotswap/hotswap.c
+++ b/keyboards/inett_studio/sqx/hotswap/hotswap.c
@@ -20,7 +20,7 @@
#include "hotswap.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/inett_studio/sqx/universal/universal.c b/keyboards/inett_studio/sqx/universal/universal.c
index 42d99330d5..dd431a7f45 100644
--- a/keyboards/inett_studio/sqx/universal/universal.c
+++ b/keyboards/inett_studio/sqx/universal/universal.c
@@ -20,7 +20,7 @@
#include "universal.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/k_type/is31fl3733-dual.h b/keyboards/k_type/is31fl3733-dual.h
index 272bcdc417..aab170a3fd 100644
--- a/keyboards/k_type/is31fl3733-dual.h
+++ b/keyboards/k_type/is31fl3733-dual.h
@@ -28,7 +28,7 @@ typedef struct is31_led {
uint8_t b;
} __attribute__((packed)) is31_led;
-extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
+extern const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL];
void IS31FL3733_init(uint8_t bus, uint8_t addr, uint8_t sync);
bool IS31FL3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data);
diff --git a/keyboards/k_type/k_type.c b/keyboards/k_type/k_type.c
index 61c5881454..924862277f 100644
--- a/keyboards/k_type/k_type.c
+++ b/keyboards/k_type/k_type.c
@@ -23,7 +23,7 @@ along with this program. If not, see .
#include "is31fl3733-dual.h"
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{ 0, B_1, A_1, C_1 },
{ 0, B_2, A_2, C_2 },
{ 0, B_3, A_3, C_3 },
diff --git a/keyboards/kbdfans/bella/rgb/rgb.c b/keyboards/kbdfans/bella/rgb/rgb.c
index e197d9b538..17cf992146 100644
--- a/keyboards/kbdfans/bella/rgb/rgb.c
+++ b/keyboards/kbdfans/bella/rgb/rgb.c
@@ -15,7 +15,7 @@
*/
#include "rgb.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, CS18_SW1, CS17_SW1, CS16_SW1}, /* RGB6 */
{0, CS18_SW3, CS17_SW3, CS16_SW3}, /* RGB32 */
{0, CS18_SW4, CS17_SW4, CS16_SW4}, /* RGB45 */
diff --git a/keyboards/kbdfans/bella/rgb_iso/rgb_iso.c b/keyboards/kbdfans/bella/rgb_iso/rgb_iso.c
index 1a853ac8af..0c431b1543 100644
--- a/keyboards/kbdfans/bella/rgb_iso/rgb_iso.c
+++ b/keyboards/kbdfans/bella/rgb_iso/rgb_iso.c
@@ -15,7 +15,7 @@
*/
#include "rgb_iso.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, CS18_SW1, CS17_SW1, CS16_SW1}, /* RGB6 */
{0, CS18_SW3, CS17_SW3, CS16_SW3}, /* RGB32 */
{0, CS18_SW4, CS17_SW4, CS16_SW4}, /* RGB45 */
diff --git a/keyboards/kbdfans/kbd67/mkiirgb/mkiirgb.c b/keyboards/kbdfans/kbd67/mkiirgb/mkiirgb.c
index 323cb23848..2826c08988 100644
--- a/keyboards/kbdfans/kbd67/mkiirgb/mkiirgb.c
+++ b/keyboards/kbdfans/kbd67/mkiirgb/mkiirgb.c
@@ -1,6 +1,6 @@
#include "mkiirgb.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, C8_8, C7_8, C6_8}, // LA17
{0, C9_8, C7_7, C6_7}, // LA16
diff --git a/keyboards/kbdfans/kbdmini/kbdmini.c b/keyboards/kbdfans/kbdmini/kbdmini.c
index 0e0df2f9af..799803c6fa 100644
--- a/keyboards/kbdfans/kbdmini/kbdmini.c
+++ b/keyboards/kbdfans/kbdmini/kbdmini.c
@@ -1,6 +1,6 @@
#include "kbdmini.h"
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{ 0, B_9, A_9, C_9 }, //LA33
{ 0, B_10, A_10, C_10 }, //LA37
{ 0, B_11, A_11, C_11 }, //LA41
diff --git a/keyboards/kbdfans/maja/maja.c b/keyboards/kbdfans/maja/maja.c
index a0afcbda8a..9619a84b48 100755
--- a/keyboards/kbdfans/maja/maja.c
+++ b/keyboards/kbdfans/maja/maja.c
@@ -1,6 +1,6 @@
#include "maja.h"
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, C2_1, C3_1, C4_1}, // LA0
{0, C1_1, C3_2, C4_2}, // LA1
{0, C1_2, C2_2, C4_3}, // LA2
diff --git a/keyboards/keychron/q1/q1.c b/keyboards/keychron/q1/q1.c
index 520e6e4c57..6beb96e7eb 100644
--- a/keyboards/keychron/q1/q1.c
+++ b/keyboards/keychron/q1/q1.c
@@ -33,7 +33,7 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
return true;
}
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/latin17rgb/latin17rgb.c b/keyboards/latin17rgb/latin17rgb.c
index 8d9eaae8ae..f7bbe125c2 100644
--- a/keyboards/latin17rgb/latin17rgb.c
+++ b/keyboards/latin17rgb/latin17rgb.c
@@ -17,7 +17,7 @@
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/latin60rgb/latin60rgb.c b/keyboards/latin60rgb/latin60rgb.c
index cdd6fed44d..fe5d2eea8f 100644
--- a/keyboards/latin60rgb/latin60rgb.c
+++ b/keyboards/latin60rgb/latin60rgb.c
@@ -16,7 +16,7 @@
#include "latin60rgb.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{ 0, K_13, J_13, L_13 },
{ 0, K_12, J_12, L_12 },
{ 0, K_11, J_11, L_11 },
diff --git a/keyboards/latin6rgb/latin6rgb.c b/keyboards/latin6rgb/latin6rgb.c
index 76b39c86bb..9ea4721ecb 100644
--- a/keyboards/latin6rgb/latin6rgb.c
+++ b/keyboards/latin6rgb/latin6rgb.c
@@ -17,7 +17,7 @@
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/matrix/m20add/rgb_ring.c b/keyboards/matrix/m20add/rgb_ring.c
index fa70dea7eb..3a8af7cd3b 100644
--- a/keyboards/matrix/m20add/rgb_ring.c
+++ b/keyboards/matrix/m20add/rgb_ring.c
@@ -30,7 +30,7 @@
#endif
// rgb ring leds setting
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/matrix/noah/noah.c b/keyboards/matrix/noah/noah.c
index 1e2f4bb7d9..6b624b9e09 100644
--- a/keyboards/matrix/noah/noah.c
+++ b/keyboards/matrix/noah/noah.c
@@ -66,7 +66,7 @@ __attribute__((weak))
void matrix_scan_user(void) { }
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/mechlovin/adelais/rgb_led/rev2/rev2.c b/keyboards/mechlovin/adelais/rgb_led/rev2/rev2.c
index 5087174b96..fe946169a7 100644
--- a/keyboards/mechlovin/adelais/rgb_led/rev2/rev2.c
+++ b/keyboards/mechlovin/adelais/rgb_led/rev2/rev2.c
@@ -17,7 +17,7 @@
#include "adelais.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, C2_1, C3_1, C4_1}, //D102-A0-0
{0, C5_1, C6_1, C7_1}, //D108-A1-1
diff --git a/keyboards/mechlovin/delphine/rgb_led/rgb_led.c b/keyboards/mechlovin/delphine/rgb_led/rgb_led.c
index 6f3e3ec731..29b6d1f783 100644
--- a/keyboards/mechlovin/delphine/rgb_led/rgb_led.c
+++ b/keyboards/mechlovin/delphine/rgb_led/rgb_led.c
@@ -18,7 +18,7 @@
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
// left CA
{0, C5_2, C6_2, C7_2}, //D2-0
{0, C1_1, C3_2, C4_2}, //D20-1
diff --git a/keyboards/mechlovin/hannah60rgb/rev2/rev2.c b/keyboards/mechlovin/hannah60rgb/rev2/rev2.c
index 05469a1bbe..8b30538cc2 100644
--- a/keyboards/mechlovin/hannah60rgb/rev2/rev2.c
+++ b/keyboards/mechlovin/hannah60rgb/rev2/rev2.c
@@ -17,7 +17,7 @@
#include "rev2.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/mechlovin/infinity87/rgb_rev1/rgb_rev1.c b/keyboards/mechlovin/infinity87/rgb_rev1/rgb_rev1.c
index f13fee8add..bd1fd8abf7 100644
--- a/keyboards/mechlovin/infinity87/rgb_rev1/rgb_rev1.c
+++ b/keyboards/mechlovin/infinity87/rgb_rev1/rgb_rev1.c
@@ -17,7 +17,7 @@
#include "rgb_rev1.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, CS34_SW1, CS35_SW1, CS36_SW1}, //D92-K00-0
{0, CS37_SW1, CS38_SW1, CS39_SW1}, //D94-K01-1
{0, CS31_SW1, CS32_SW1, CS33_SW1}, //D96-K02-2
diff --git a/keyboards/melgeek/mj61/rev1/rev1.c b/keyboards/melgeek/mj61/rev1/rev1.c
index be58f57a95..e51c57548f 100644
--- a/keyboards/melgeek/mj61/rev1/rev1.c
+++ b/keyboards/melgeek/mj61/rev1/rev1.c
@@ -17,7 +17,7 @@
#include "mj61.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, CS12_SW1, CS11_SW1, CS10_SW1}, /* RGB1 */
{0, CS12_SW2, CS11_SW2, CS10_SW2}, /* RGB2 */
{0, CS12_SW3, CS11_SW3, CS10_SW3}, /* RGB3 */
diff --git a/keyboards/melgeek/mj61/rev2/rev2.c b/keyboards/melgeek/mj61/rev2/rev2.c
index 236b003972..3f6b1bff77 100644
--- a/keyboards/melgeek/mj61/rev2/rev2.c
+++ b/keyboards/melgeek/mj61/rev2/rev2.c
@@ -19,7 +19,7 @@
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, CS9_SW1, CS8_SW1, CS7_SW1}, /* RGB1 */
{0, CS9_SW2, CS8_SW2, CS7_SW2}, /* RGB3 */
{0, CS9_SW3, CS8_SW3, CS7_SW3}, /* RGB4 */
diff --git a/keyboards/melgeek/mj63/rev1/rev1.c b/keyboards/melgeek/mj63/rev1/rev1.c
index 34ff28d25f..a6ee8859b0 100644
--- a/keyboards/melgeek/mj63/rev1/rev1.c
+++ b/keyboards/melgeek/mj63/rev1/rev1.c
@@ -19,7 +19,7 @@
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, CS9_SW1, CS8_SW1, CS7_SW1}, /* RGB1 */
{0, CS9_SW2, CS8_SW2, CS7_SW2}, /* RGB2 */
{0, CS9_SW3, CS8_SW3, CS7_SW3}, /* RGB3 */
diff --git a/keyboards/melgeek/mj63/rev2/rev2.c b/keyboards/melgeek/mj63/rev2/rev2.c
index c2379dabe9..8cacc689ae 100644
--- a/keyboards/melgeek/mj63/rev2/rev2.c
+++ b/keyboards/melgeek/mj63/rev2/rev2.c
@@ -19,7 +19,7 @@
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, CS9_SW1, CS8_SW1, CS7_SW1}, /* RGB1 */
{0, CS9_SW2, CS8_SW2, CS7_SW2}, /* RGB3 */
{0, CS9_SW3, CS8_SW3, CS7_SW3}, /* RGB4 */
diff --git a/keyboards/melgeek/mj64/rev1/rev1.c b/keyboards/melgeek/mj64/rev1/rev1.c
index e01765b694..446ba779d0 100644
--- a/keyboards/melgeek/mj64/rev1/rev1.c
+++ b/keyboards/melgeek/mj64/rev1/rev1.c
@@ -18,7 +18,7 @@
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, CS9_SW1, CS8_SW1, CS7_SW1}, /* RGB1 */
{0, CS9_SW2, CS8_SW2, CS7_SW2}, /* RGB2 */
{0, CS9_SW3, CS8_SW3, CS7_SW3}, /* RGB3 */
diff --git a/keyboards/melgeek/mj64/rev2/rev2.c b/keyboards/melgeek/mj64/rev2/rev2.c
index d5486b9086..444e8f60ac 100644
--- a/keyboards/melgeek/mj64/rev2/rev2.c
+++ b/keyboards/melgeek/mj64/rev2/rev2.c
@@ -18,7 +18,7 @@
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, CS9_SW1, CS8_SW1, CS7_SW1}, /* RGB1 */
{0, CS9_SW2, CS8_SW2, CS7_SW2}, /* RGB2 */
{0, CS9_SW3, CS8_SW3, CS7_SW3}, /* RGB3 */
diff --git a/keyboards/melgeek/mj64/rev3/rev3.c b/keyboards/melgeek/mj64/rev3/rev3.c
index 03ed9fe007..2a1283ec70 100644
--- a/keyboards/melgeek/mj64/rev3/rev3.c
+++ b/keyboards/melgeek/mj64/rev3/rev3.c
@@ -18,7 +18,7 @@
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, CS9_SW1, CS8_SW1, CS7_SW1}, /* RGB1 */
{0, CS9_SW2, CS8_SW2, CS7_SW2}, /* RGB3 */
{0, CS9_SW3, CS8_SW3, CS7_SW3}, /* RGB4 */
diff --git a/keyboards/melgeek/mj65/rev3/rev3.c b/keyboards/melgeek/mj65/rev3/rev3.c
index 43fae53a36..6335edd796 100644
--- a/keyboards/melgeek/mj65/rev3/rev3.c
+++ b/keyboards/melgeek/mj65/rev3/rev3.c
@@ -18,7 +18,7 @@
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, CS9_SW1, CS8_SW1, CS7_SW1}, /* RGB1 */
{0, CS9_SW2, CS8_SW2, CS7_SW2}, /* RGB2 */
{0, CS9_SW3, CS8_SW3, CS7_SW3}, /* RGB3 */
diff --git a/keyboards/melgeek/mojo75/rev1/rev1.c b/keyboards/melgeek/mojo75/rev1/rev1.c
index 670116fcd6..07ae916da2 100644
--- a/keyboards/melgeek/mojo75/rev1/rev1.c
+++ b/keyboards/melgeek/mojo75/rev1/rev1.c
@@ -18,7 +18,7 @@
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, CS6_SW1, CS5_SW1, CS4_SW1}, /* RGB1 */
{0, CS6_SW2, CS5_SW2, CS4_SW2}, /* RGB2 */
{0, CS6_SW3, CS5_SW3, CS4_SW3}, /* RGB3 */
diff --git a/keyboards/melgeek/z70ultra/z70ultra.c b/keyboards/melgeek/z70ultra/z70ultra.c
index 740720681a..552576cd7c 100644
--- a/keyboards/melgeek/z70ultra/z70ultra.c
+++ b/keyboards/melgeek/z70ultra/z70ultra.c
@@ -18,7 +18,7 @@
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, CS28_SW1, CS30_SW1, CS29_SW1}, /* RGB10 */
{0, CS28_SW2, CS30_SW2, CS29_SW2}, /* RGB11 */
{0, CS28_SW3, CS30_SW3, CS29_SW3}, /* RGB12 */
diff --git a/keyboards/miller/gm862/gm862.c b/keyboards/miller/gm862/gm862.c
index 5af66dd398..d67104838b 100644
--- a/keyboards/miller/gm862/gm862.c
+++ b/keyboards/miller/gm862/gm862.c
@@ -1,7 +1,7 @@
#include "gm862.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, B_1, A_1, C_1},
{0, B_2, A_2, C_2},
{0, B_3, A_3, C_3},
diff --git a/keyboards/moonlander/moonlander.c b/keyboards/moonlander/moonlander.c
index d66b74d973..8688b9efa4 100644
--- a/keyboards/moonlander/moonlander.c
+++ b/keyboards/moonlander/moonlander.c
@@ -203,7 +203,7 @@ layer_state_t layer_state_set_kb(layer_state_t state) {
#ifdef RGB_MATRIX_ENABLE
// clang-format off
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/mt64rgb/mt64rgb.c b/keyboards/mt64rgb/mt64rgb.c
index 73f0e562e7..a0b8e8da71 100644
--- a/keyboards/mt64rgb/mt64rgb.c
+++ b/keyboards/mt64rgb/mt64rgb.c
@@ -16,7 +16,7 @@
#include "mt64rgb.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/mt84/mt84.c b/keyboards/mt84/mt84.c
index e15a1ff951..9b00aa635e 100644
--- a/keyboards/mt84/mt84.c
+++ b/keyboards/mt84/mt84.c
@@ -16,7 +16,7 @@
#include "mt84.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/opendeck/32/rev1/rev1.c b/keyboards/opendeck/32/rev1/rev1.c
index 297af907e2..91f59a60b7 100644
--- a/keyboards/opendeck/32/rev1/rev1.c
+++ b/keyboards/opendeck/32/rev1/rev1.c
@@ -17,7 +17,7 @@
#include "rev1.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/planck/ez/ez.c b/keyboards/planck/ez/ez.c
index 5c68726a01..27cb2a1d1d 100644
--- a/keyboards/planck/ez/ez.c
+++ b/keyboards/planck/ez/ez.c
@@ -21,7 +21,7 @@
keyboard_config_t keyboard_config;
#ifdef RGB_MATRIX_ENABLE
-const is31_led PROGMEM g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/planck/light/light.c b/keyboards/planck/light/light.c
index 896ec44587..3a53e39985 100644
--- a/keyboards/planck/light/light.c
+++ b/keyboards/planck/light/light.c
@@ -16,7 +16,7 @@
#include "light.h"
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/terrazzo/terrazzo.c b/keyboards/terrazzo/terrazzo.c
index e6ba1f6c39..19ac6be491 100644
--- a/keyboards/terrazzo/terrazzo.c
+++ b/keyboards/terrazzo/terrazzo.c
@@ -21,7 +21,7 @@
#include "print.h"
#include "quantum.h"
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash 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
*/
diff --git a/keyboards/tkc/portico/portico.c b/keyboards/tkc/portico/portico.c
index a65a85d242..e3d3a14880 100644
--- a/keyboards/tkc/portico/portico.c
+++ b/keyboards/tkc/portico/portico.c
@@ -19,7 +19,7 @@ along with this program. If not, see .
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{ 0, C2_1, C3_1, C4_1 },
{ 0, C1_1, C3_2, C4_2 },
{ 0, C1_2, C2_2, C4_3 },
diff --git a/keyboards/whitefox/whitefox.c b/keyboards/whitefox/whitefox.c
index f10f0fd5c4..b17af15127 100644
--- a/keyboards/whitefox/whitefox.c
+++ b/keyboards/whitefox/whitefox.c
@@ -18,7 +18,7 @@ along with this program. If not, see .
#include "whitefox.h"
#ifdef LED_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
// The numbers in the comments are the led numbers DXX on the PCB
/* Refer to IS31 manual for these locations
* driver
diff --git a/keyboards/wilba_tech/wt_rgb_backlight.c b/keyboards/wilba_tech/wt_rgb_backlight.c
index e0359daab4..77613a3338 100644
--- a/keyboards/wilba_tech/wt_rgb_backlight.c
+++ b/keyboards/wilba_tech/wt_rgb_backlight.c
@@ -158,7 +158,7 @@ uint32_t g_any_key_hit = 0;
// ADDR_2 is not needed. it is here as a dummy
#define ISSI_ADDR_1 0x50
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@@ -239,7 +239,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
#define ISSI_ADDR_1 0x50
#define ISSI_ADDR_2 0x52
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@@ -382,7 +382,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
// set to 0 for write, 1 for read (as per I2C protocol)
#define ISSI_ADDR_1 0x74
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@@ -414,7 +414,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
#define ISSI_ADDR_2 0x76 // 11101[10] <- SDA
#define ISSI_ADDR_3 0x75 // 11101[01] <- SCL
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@@ -541,7 +541,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
#define ISSI_ADDR_1 0x74
#define ISSI_ADDR_2 0x76
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@@ -622,7 +622,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
#define ISSI_ADDR_1 0x74
#define ISSI_ADDR_2 0x77
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
@@ -709,7 +709,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
#define ISSI_ADDR_1 0x74
#define ISSI_ADDR_2
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, C1_9, C3_10, C4_10}, // LB1
{0, C1_10, C2_10, C4_11}, // LB2
{0, C1_11, C2_11, C3_11}, // LB3
@@ -729,7 +729,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
#define ISSI_ADDR_1 0x74
#define ISSI_ADDR_2 0x76
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/xbows/knight/knight.c b/keyboards/xbows/knight/knight.c
index 1a1aebf18f..539ecb653e 100644
--- a/keyboards/xbows/knight/knight.c
+++ b/keyboards/xbows/knight/knight.c
@@ -15,7 +15,7 @@
*/
#include "knight.h"
#ifdef RGB_MATRIX_ENABLE
- const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+ const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, C1_3, C2_3, C3_3}, // L01
{0, C1_4, C2_4, C3_4}, // L02
diff --git a/keyboards/xbows/knight_plus/knight_plus.c b/keyboards/xbows/knight_plus/knight_plus.c
index f2cf5399b6..c5dd1a5fd6 100644
--- a/keyboards/xbows/knight_plus/knight_plus.c
+++ b/keyboards/xbows/knight_plus/knight_plus.c
@@ -15,7 +15,7 @@
*/
#include "knight_plus.h"
#ifdef RGB_MATRIX_ENABLE
- const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+ const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, C1_3, C2_3, C3_3}, // L01
{0, C1_4, C2_4, C3_4}, // L02
diff --git a/keyboards/xbows/nature/nature.c b/keyboards/xbows/nature/nature.c
index f1b0615845..b7b10d5abb 100644
--- a/keyboards/xbows/nature/nature.c
+++ b/keyboards/xbows/nature/nature.c
@@ -15,7 +15,7 @@
*/
#include "nature.h"
#ifdef RGB_MATRIX_ENABLE
- const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+ const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, C1_3, C2_3, C3_3}, // L01
{0, C1_4, C2_4, C3_4}, // L02
diff --git a/keyboards/xbows/numpad/numpad.c b/keyboards/xbows/numpad/numpad.c
index 0ab677c769..4e05473b67 100644
--- a/keyboards/xbows/numpad/numpad.c
+++ b/keyboards/xbows/numpad/numpad.c
@@ -15,7 +15,7 @@
*/
#include "numpad.h"
#ifdef RGB_MATRIX_ENABLE
- const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+ const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, C3_3, C2_3, C1_3}, // L01
{0, C3_4, C2_4, C1_4}, // L02
diff --git a/keyboards/xbows/woody/woody.c b/keyboards/xbows/woody/woody.c
index 9821f5f655..1027e3ca37 100644
--- a/keyboards/xbows/woody/woody.c
+++ b/keyboards/xbows/woody/woody.c
@@ -1,6 +1,6 @@
#include "woody.h"
#ifdef RGB_MATRIX_ENABLE
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
{0, C8_8, C7_8, C6_8}, // LA17
{0, C9_8, C7_7, C6_7}, // LA16
diff --git a/keyboards/xelus/dawn60/rev1_qmk/rev1_qmk.c b/keyboards/xelus/dawn60/rev1_qmk/rev1_qmk.c
index c305ecae14..c6ddef0931 100644
--- a/keyboards/xelus/dawn60/rev1_qmk/rev1_qmk.c
+++ b/keyboards/xelus/dawn60/rev1_qmk/rev1_qmk.c
@@ -25,7 +25,7 @@
#ifdef RGB_MATRIX_ENABLE
LED_TYPE rgb_matrix_ws2812_array[WS2812_LED_TOTAL];
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/keyboards/xelus/pachi/rgb/rgb.c b/keyboards/xelus/pachi/rgb/rgb.c
index ea9812d6b1..6f44b13e12 100644
--- a/keyboards/xelus/pachi/rgb/rgb.c
+++ b/keyboards/xelus/pachi/rgb/rgb.c
@@ -24,7 +24,7 @@ void matrix_io_delay(void) { __asm__ volatile("nop\nnop\nnop\n"); }
#ifdef RGB_MATRIX_ENABLE
#include
#include "drivers/led/issi/is31fl3741.h"
-const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
+const is31_led __flash g_is31_leds[DRIVER_LED_TOTAL] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
diff --git a/tmk_core/common/progmem.h b/tmk_core/common/progmem.h
index 3a7a169682..a70d8e299f 100644
--- a/tmk_core/common/progmem.h
+++ b/tmk_core/common/progmem.h
@@ -5,6 +5,7 @@
#else
# include
# define PROGMEM
+# define __flash
# define PSTR(x) x
# define PGM_P const char*
# define memcpy_P(dest, src, n) memcpy(dest, src, n)
--
cgit v1.2.3
From 7da97c293da851851c204af065a0c8d2f884effd Mon Sep 17 00:00:00 2001
From: Drashna Jaelre
Date: Tue, 17 Aug 2021 11:19:00 -0700
Subject: Rgb matrix/enable modes explicitly (#13758)
* Change animations to require explicet activation
* Add support for legacy config
* Make default for now
* Add LED Matrix support
* change LED Matrix docs---
docs/feature_led_matrix.md | 40 +++---
docs/feature_rgb_matrix.md | 80 +++++------
quantum/led_matrix/animations/alpha_mods_anim.h | 2 +-
quantum/led_matrix/animations/band_anim.h | 2 +-
quantum/led_matrix/animations/band_pinwheel_anim.h | 2 +-
quantum/led_matrix/animations/band_spiral_anim.h | 2 +-
quantum/led_matrix/animations/breathing_anim.h | 2 +-
.../led_matrix/animations/cycle_left_right_anim.h | 2 +-
quantum/led_matrix/animations/cycle_out_in_anim.h | 2 +-
quantum/led_matrix/animations/cycle_up_down_anim.h | 2 +-
quantum/led_matrix/animations/dual_beacon_anim.h | 2 +-
.../led_matrix/animations/solid_reactive_cross.h | 8 +-
.../led_matrix/animations/solid_reactive_nexus.h | 10 +-
.../animations/solid_reactive_simple_anim.h | 2 +-
.../led_matrix/animations/solid_reactive_wide.h | 8 +-
quantum/led_matrix/animations/solid_splash_anim.h | 8 +-
.../led_matrix/animations/wave_left_right_anim.h | 2 +-
quantum/led_matrix/animations/wave_up_down_anim.h | 2 +-
quantum/led_matrix/led_matrix.h | 1 +
quantum/led_matrix/led_matrix_legacy_enables.h | 82 +++++++++++
quantum/process_keycode/process_rgb.c | 6 +-
quantum/rgb_matrix/animations/alpha_mods_anim.h | 2 +-
quantum/rgb_matrix/animations/breathing_anim.h | 2 +-
.../animations/colorband_pinwheel_sat_anim.h | 2 +-
.../animations/colorband_pinwheel_val_anim.h | 2 +-
quantum/rgb_matrix/animations/colorband_sat_anim.h | 2 +-
.../animations/colorband_spiral_sat_anim.h | 2 +-
.../animations/colorband_spiral_val_anim.h | 2 +-
quantum/rgb_matrix/animations/colorband_val_anim.h | 2 +-
quantum/rgb_matrix/animations/cycle_all_anim.h | 2 +-
.../rgb_matrix/animations/cycle_left_right_anim.h | 2 +-
quantum/rgb_matrix/animations/cycle_out_in_anim.h | 2 +-
.../rgb_matrix/animations/cycle_out_in_dual_anim.h | 2 +-
.../rgb_matrix/animations/cycle_pinwheel_anim.h | 2 +-
quantum/rgb_matrix/animations/cycle_spiral_anim.h | 2 +-
quantum/rgb_matrix/animations/cycle_up_down_anim.h | 2 +-
quantum/rgb_matrix/animations/dual_beacon_anim.h | 2 +-
.../animations/gradient_left_right_anim.h | 2 +-
.../rgb_matrix/animations/gradient_up_down_anim.h | 2 +-
quantum/rgb_matrix/animations/hue_breathing_anim.h | 2 +-
quantum/rgb_matrix/animations/hue_pendulum_anim.h | 2 +-
quantum/rgb_matrix/animations/hue_wave_anim.h | 2 +-
.../animations/jellybean_raindrops_anim.h | 2 +-
.../rgb_matrix/animations/rainbow_beacon_anim.h | 2 +-
.../animations/rainbow_moving_chevron_anim.h | 2 +-
.../rgb_matrix/animations/rainbow_pinwheels_anim.h | 2 +-
quantum/rgb_matrix/animations/raindrops_anim.h | 2 +-
.../rgb_matrix/animations/typing_heatmap_anim.h | 2 +-
quantum/rgb_matrix/rgb_matrix.c | 6 +-
quantum/rgb_matrix/rgb_matrix.h | 1 +
quantum/rgb_matrix/rgb_matrix_legacy_enables.h | 153 +++++++++++++++++++++
51 files changed, 359 insertions(+), 122 deletions(-)
create mode 100644 quantum/led_matrix/led_matrix_legacy_enables.h
create mode 100644 quantum/rgb_matrix/rgb_matrix_legacy_enables.h
(limited to 'docs/feature_rgb_matrix.md')
diff --git a/docs/feature_led_matrix.md b/docs/feature_led_matrix.md
index 7d7971bbed..fc66826015 100644
--- a/docs/feature_led_matrix.md
+++ b/docs/feature_led_matrix.md
@@ -164,26 +164,26 @@ You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `con
|Define |Description |
|-------------------------------------------------------|-----------------------------------------------|
-|`#define DISABLE_LED_MATRIX_ALPHAS_MODS` |Disables `LED_MATRIX_ALPHAS_MODS` |
-|`#define DISABLE_LED_MATRIX_BREATHING` |Disables `LED_MATRIX_BREATHING` |
-|`#define DISABLE_LED_MATRIX_BAND` |Disables `LED_MATRIX_BAND` |
-|`#define DISABLE_LED_MATRIX_BAND_PINWHEEL` |Disables `LED_MATRIX_BAND_PINWHEEL` |
-|`#define DISABLE_LED_MATRIX_BAND_SPIRAL` |Disables `LED_MATRIX_BAND_SPIRAL` |
-|`#define DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT` |Disables `LED_MATRIX_CYCLE_LEFT_RIGHT` |
-|`#define DISABLE_LED_MATRIX_CYCLE_UP_DOWN` |Disables `LED_MATRIX_CYCLE_UP_DOWN` |
-|`#define DISABLE_LED_MATRIX_CYCLE_OUT_IN` |Disables `LED_MATRIX_CYCLE_OUT_IN` |
-|`#define DISABLE_LED_MATRIX_DUAL_BEACON` |Disables `LED_MATRIX_DUAL_BEACON` |
-|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE` |Disables `LED_MATRIX_SOLID_REACTIVE_SIMPLE` |
-|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE` |Disables `LED_MATRIX_SOLID_REACTIVE_WIDE` |
-|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE` |Disables `LED_MATRIX_SOLID_REACTIVE_MULTIWIDE` |
-|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS` |Disables `LED_MATRIX_SOLID_REACTIVE_CROSS` |
-|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS` |Disables `LED_MATRIX_SOLID_REACTIVE_MULTICROSS`|
-|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS` |Disables `LED_MATRIX_SOLID_REACTIVE_NEXUS` |
-|`#define DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS` |Disables `LED_MATRIX_SOLID_REACTIVE_MULTINEXUS`|
-|`#define DISABLE_LED_MATRIX_SOLID_SPLASH` |Disables `LED_MATRIX_SOLID_SPLASH` |
-|`#define DISABLE_LED_MATRIX_SOLID_MULTISPLASH` |Disables `LED_MATRIX_SOLID_MULTISPLASH` |
-|`#define DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT` |Disables `LED_MATRIX_WAVE_LEFT_RIGHT` |
-|`#define DISABLE_LED_MATRIX_WAVE_UP_DOWN` |Disables `LED_MATRIX_WAVE_UP_DOWN` |
+|`#define ENABLE_LED_MATRIX_ALPHAS_MODS` |Enables `LED_MATRIX_ALPHAS_MODS` |
+|`#define ENABLE_LED_MATRIX_BREATHING` |Enables `LED_MATRIX_BREATHING` |
+|`#define ENABLE_LED_MATRIX_BAND` |Enables `LED_MATRIX_BAND` |
+|`#define ENABLE_LED_MATRIX_BAND_PINWHEEL` |Enables `LED_MATRIX_BAND_PINWHEEL` |
+|`#define ENABLE_LED_MATRIX_BAND_SPIRAL` |Enables `LED_MATRIX_BAND_SPIRAL` |
+|`#define ENABLE_LED_MATRIX_CYCLE_LEFT_RIGHT` |Enables `LED_MATRIX_CYCLE_LEFT_RIGHT` |
+|`#define ENABLE_LED_MATRIX_CYCLE_UP_DOWN` |Enables `LED_MATRIX_CYCLE_UP_DOWN` |
+|`#define ENABLE_LED_MATRIX_CYCLE_OUT_IN` |Enables `LED_MATRIX_CYCLE_OUT_IN` |
+|`#define ENABLE_LED_MATRIX_DUAL_BEACON` |Enables `LED_MATRIX_DUAL_BEACON` |
+|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE` |Enables `LED_MATRIX_SOLID_REACTIVE_SIMPLE` |
+|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE` |Enables `LED_MATRIX_SOLID_REACTIVE_WIDE` |
+|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE` |Enables `LED_MATRIX_SOLID_REACTIVE_MULTIWIDE` |
+|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS` |Enables `LED_MATRIX_SOLID_REACTIVE_CROSS` |
+|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS` |Enables `LED_MATRIX_SOLID_REACTIVE_MULTICROSS`|
+|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS` |Enables `LED_MATRIX_SOLID_REACTIVE_NEXUS` |
+|`#define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS` |Enables `LED_MATRIX_SOLID_REACTIVE_MULTINEXUS`|
+|`#define ENABLE_LED_MATRIX_SOLID_SPLASH` |Enables `LED_MATRIX_SOLID_SPLASH` |
+|`#define ENABLE_LED_MATRIX_SOLID_MULTISPLASH` |Enables `LED_MATRIX_SOLID_MULTISPLASH` |
+|`#define ENABLE_LED_MATRIX_WAVE_LEFT_RIGHT` |Enables `LED_MATRIX_WAVE_LEFT_RIGHT` |
+|`#define ENABLE_LED_MATRIX_WAVE_UP_DOWN` |Enables `LED_MATRIX_WAVE_UP_DOWN` |
## Custom LED Matrix Effects :id=custom-led-matrix-effects
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 670d7e09bf..31fa9ed36e 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -448,46 +448,46 @@ You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `con
|Define |Description |
|-------------------------------------------------------|-----------------------------------------------|
-|`#define DISABLE_RGB_MATRIX_ALPHAS_MODS` |Disables `RGB_MATRIX_ALPHAS_MODS` |
-|`#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN` |Disables `RGB_MATRIX_GRADIENT_UP_DOWN` |
-|`#define DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT` |Disables `MATRIX_GRADIENT_LEFT_RIGHT` |
-|`#define DISABLE_RGB_MATRIX_BREATHING` |Disables `RGB_MATRIX_BREATHING` |
-|`#define DISABLE_RGB_MATRIX_BAND_SAT` |Disables `RGB_MATRIX_BAND_SAT` |
-|`#define DISABLE_RGB_MATRIX_BAND_VAL` |Disables `RGB_MATRIX_BAND_VAL` |
-|`#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT` |Disables `RGB_MATRIX_BAND_PINWHEEL_SAT` |
-|`#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL` |Disables `RGB_MATRIX_BAND_PINWHEEL_VAL` |
-|`#define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT` |Disables `RGB_MATRIX_BAND_SPIRAL_SAT` |
-|`#define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL` |Disables `RGB_MATRIX_BAND_SPIRAL_VAL` |
-|`#define DISABLE_RGB_MATRIX_CYCLE_ALL` |Disables `RGB_MATRIX_CYCLE_ALL` |
-|`#define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT` |Disables `RGB_MATRIX_CYCLE_LEFT_RIGHT` |
-|`#define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN` |Disables `RGB_MATRIX_CYCLE_UP_DOWN` |
-|`#define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON` |Disables `RGB_MATRIX_RAINBOW_MOVING_CHEVRON` |
-|`#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN` |Disables `RGB_MATRIX_CYCLE_OUT_IN` |
-|`#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL` |Disables `RGB_MATRIX_CYCLE_OUT_IN_DUAL` |
-|`#define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL` |Disables `RGB_MATRIX_CYCLE_PINWHEEL` |
-|`#define DISABLE_RGB_MATRIX_CYCLE_SPIRAL` |Disables `RGB_MATRIX_CYCLE_SPIRAL` |
-|`#define DISABLE_RGB_MATRIX_DUAL_BEACON` |Disables `RGB_MATRIX_DUAL_BEACON` |
-|`#define DISABLE_RGB_MATRIX_RAINBOW_BEACON` |Disables `RGB_MATRIX_RAINBOW_BEACON` |
-|`#define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS` |Disables `RGB_MATRIX_RAINBOW_PINWHEELS` |
-|`#define DISABLE_RGB_MATRIX_RAINDROPS` |Disables `RGB_MATRIX_RAINDROPS` |
-|`#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS` |Disables `RGB_MATRIX_JELLYBEAN_RAINDROPS` |
-|`#define DISABLE_RGB_MATRIX_HUE_BREATHING` |Disables `RGB_MATRIX_HUE_BREATHING` |
-|`#define DISABLE_RGB_MATRIX_HUE_PENDULUM` |Disables `RGB_MATRIX_HUE_PENDULUM` |
-|`#define DISABLE_RGB_MATRIX_HUE_WAVE ` |Disables `RGB_MATRIX_HUE_WAVE ` |
-|`#define DISABLE_RGB_MATRIX_TYPING_HEATMAP` |Disables `RGB_MATRIX_TYPING_HEATMAP` |
-|`#define DISABLE_RGB_MATRIX_DIGITAL_RAIN` |Disables `RGB_MATRIX_DIGITAL_RAIN` |
-|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE` |Disables `RGB_MATRIX_SOLID_REACTIVE_SIMPLE` |
-|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE` |Disables `RGB_MATRIX_SOLID_REACTIVE` |
-|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE` |Disables `RGB_MATRIX_SOLID_REACTIVE_WIDE` |
-|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE` |Disables `RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE` |
-|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS` |Disables `RGB_MATRIX_SOLID_REACTIVE_CROSS` |
-|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS` |Disables `RGB_MATRIX_SOLID_REACTIVE_MULTICROSS`|
-|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS` |Disables `RGB_MATRIX_SOLID_REACTIVE_NEXUS` |
-|`#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS` |Disables `RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS`|
-|`#define DISABLE_RGB_MATRIX_SPLASH` |Disables `RGB_MATRIX_SPLASH` |
-|`#define DISABLE_RGB_MATRIX_MULTISPLASH` |Disables `RGB_MATRIX_MULTISPLASH` |
-|`#define DISABLE_RGB_MATRIX_SOLID_SPLASH` |Disables `RGB_MATRIX_SOLID_SPLASH` |
-|`#define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH` |Disables `RGB_MATRIX_SOLID_MULTISPLASH` |
+|`#define ENABLE_RGB_MATRIX_ALPHAS_MODS` |Enables `RGB_MATRIX_ALPHAS_MODS` |
+|`#define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN` |Enables `RGB_MATRIX_GRADIENT_UP_DOWN` |
+|`#define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT` |Enables `MATRIX_GRADIENT_LEFT_RIGHT` |
+|`#define ENABLE_RGB_MATRIX_BREATHING` |Enables `RGB_MATRIX_BREATHING` |
+|`#define ENABLE_RGB_MATRIX_BAND_SAT` |Enables `RGB_MATRIX_BAND_SAT` |
+|`#define ENABLE_RGB_MATRIX_BAND_VAL` |Enables `RGB_MATRIX_BAND_VAL` |
+|`#define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT` |Enables `RGB_MATRIX_BAND_PINWHEEL_SAT` |
+|`#define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL` |Enables `RGB_MATRIX_BAND_PINWHEEL_VAL` |
+|`#define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT` |Enables `RGB_MATRIX_BAND_SPIRAL_SAT` |
+|`#define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL` |Enables `RGB_MATRIX_BAND_SPIRAL_VAL` |
+|`#define ENABLE_RGB_MATRIX_CYCLE_ALL` |Enables `RGB_MATRIX_CYCLE_ALL` |
+|`#define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT` |Enables `RGB_MATRIX_CYCLE_LEFT_RIGHT` |
+|`#define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN` |Enables `RGB_MATRIX_CYCLE_UP_DOWN` |
+|`#define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON` |Enables `RGB_MATRIX_RAINBOW_MOVING_CHEVRON` |
+|`#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN` |Enables `RGB_MATRIX_CYCLE_OUT_IN` |
+|`#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL` |Enables `RGB_MATRIX_CYCLE_OUT_IN_DUAL` |
+|`#define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL` |Enables `RGB_MATRIX_CYCLE_PINWHEEL` |
+|`#define ENABLE_RGB_MATRIX_CYCLE_SPIRAL` |Enables `RGB_MATRIX_CYCLE_SPIRAL` |
+|`#define ENABLE_RGB_MATRIX_DUAL_BEACON` |Enables `RGB_MATRIX_DUAL_BEACON` |
+|`#define ENABLE_RGB_MATRIX_RAINBOW_BEACON` |Enables `RGB_MATRIX_RAINBOW_BEACON` |
+|`#define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS` |Enables `RGB_MATRIX_RAINBOW_PINWHEELS` |
+|`#define ENABLE_RGB_MATRIX_RAINDROPS` |Enables `RGB_MATRIX_RAINDROPS` |
+|`#define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS` |Enables `RGB_MATRIX_JELLYBEAN_RAINDROPS` |
+|`#define ENABLE_RGB_MATRIX_HUE_BREATHING` |Enables `RGB_MATRIX_HUE_BREATHING` |
+|`#define ENABLE_RGB_MATRIX_HUE_PENDULUM` |Enables `RGB_MATRIX_HUE_PENDULUM` |
+|`#define ENABLE_RGB_MATRIX_HUE_WAVE ` |Enables `RGB_MATRIX_HUE_WAVE ` |
+|`#define ENABLE_RGB_MATRIX_TYPING_HEATMAP` |Enables `RGB_MATRIX_TYPING_HEATMAP` |
+|`#define ENABLE_RGB_MATRIX_DIGITAL_RAIN` |Enables `RGB_MATRIX_DIGITAL_RAIN` |
+|`#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE` |Enables `RGB_MATRIX_SOLID_REACTIVE_SIMPLE` |
+|`#define ENABLE_RGB_MATRIX_SOLID_REACTIVE` |Enables `RGB_MATRIX_SOLID_REACTIVE` |
+|`#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE` |Enables `RGB_MATRIX_SOLID_REACTIVE_WIDE` |
+|`#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE` |Enables `RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE` |
+|`#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS` |Enables `RGB_MATRIX_SOLID_REACTIVE_CROSS` |
+|`#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS` |Enables `RGB_MATRIX_SOLID_REACTIVE_MULTICROSS`|
+|`#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS` |Enables `RGB_MATRIX_SOLID_REACTIVE_NEXUS` |
+|`#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS` |Enables `RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS`|
+|`#define ENABLE_RGB_MATRIX_SPLASH` |Enables `RGB_MATRIX_SPLASH` |
+|`#define ENABLE_RGB_MATRIX_MULTISPLASH` |Enables `RGB_MATRIX_MULTISPLASH` |
+|`#define ENABLE_RGB_MATRIX_SOLID_SPLASH` |Enables `RGB_MATRIX_SOLID_SPLASH` |
+|`#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH` |Enables `RGB_MATRIX_SOLID_MULTISPLASH` |
### RGB Matrix Effect Typing Heatmap :id=rgb-matrix-effect-typing-heatmap
diff --git a/quantum/led_matrix/animations/alpha_mods_anim.h b/quantum/led_matrix/animations/alpha_mods_anim.h
index a4638fde69..14038cd082 100644
--- a/quantum/led_matrix/animations/alpha_mods_anim.h
+++ b/quantum/led_matrix/animations/alpha_mods_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_ALPHAS_MODS
+#ifdef ENABLE_LED_MATRIX_ALPHAS_MODS
LED_MATRIX_EFFECT(ALPHAS_MODS)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/band_anim.h b/quantum/led_matrix/animations/band_anim.h
index f9cb85dc4f..5548787b88 100644
--- a/quantum/led_matrix/animations/band_anim.h
+++ b/quantum/led_matrix/animations/band_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_BAND
+#ifdef ENABLE_LED_MATRIX_BAND
LED_MATRIX_EFFECT(BAND)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/band_pinwheel_anim.h b/quantum/led_matrix/animations/band_pinwheel_anim.h
index d3144bffbf..89651582d5 100644
--- a/quantum/led_matrix/animations/band_pinwheel_anim.h
+++ b/quantum/led_matrix/animations/band_pinwheel_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_BAND_PINWHEEL
+#ifdef ENABLE_LED_MATRIX_BAND_PINWHEEL
LED_MATRIX_EFFECT(BAND_PINWHEEL)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/band_spiral_anim.h b/quantum/led_matrix/animations/band_spiral_anim.h
index defbe69676..70b0ffaea9 100644
--- a/quantum/led_matrix/animations/band_spiral_anim.h
+++ b/quantum/led_matrix/animations/band_spiral_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_BAND_SPIRAL
+#ifdef ENABLE_LED_MATRIX_BAND_SPIRAL
LED_MATRIX_EFFECT(BAND_SPIRAL)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/breathing_anim.h b/quantum/led_matrix/animations/breathing_anim.h
index 4f49f50690..e3f600c45c 100644
--- a/quantum/led_matrix/animations/breathing_anim.h
+++ b/quantum/led_matrix/animations/breathing_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_BREATHING
+#ifdef ENABLE_LED_MATRIX_BREATHING
LED_MATRIX_EFFECT(BREATHING)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/cycle_left_right_anim.h b/quantum/led_matrix/animations/cycle_left_right_anim.h
index c426d02fd5..769e6d7942 100644
--- a/quantum/led_matrix/animations/cycle_left_right_anim.h
+++ b/quantum/led_matrix/animations/cycle_left_right_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT
+#ifdef ENABLE_LED_MATRIX_CYCLE_LEFT_RIGHT
LED_MATRIX_EFFECT(CYCLE_LEFT_RIGHT)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/cycle_out_in_anim.h b/quantum/led_matrix/animations/cycle_out_in_anim.h
index 55527556fd..6adf9c25ff 100644
--- a/quantum/led_matrix/animations/cycle_out_in_anim.h
+++ b/quantum/led_matrix/animations/cycle_out_in_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_CYCLE_OUT_IN
+#ifdef ENABLE_LED_MATRIX_CYCLE_OUT_IN
LED_MATRIX_EFFECT(CYCLE_OUT_IN)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/cycle_up_down_anim.h b/quantum/led_matrix/animations/cycle_up_down_anim.h
index d97de0d1ec..7a5868ac26 100644
--- a/quantum/led_matrix/animations/cycle_up_down_anim.h
+++ b/quantum/led_matrix/animations/cycle_up_down_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_CYCLE_UP_DOWN
+#ifdef ENABLE_LED_MATRIX_CYCLE_UP_DOWN
LED_MATRIX_EFFECT(CYCLE_UP_DOWN)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/dual_beacon_anim.h b/quantum/led_matrix/animations/dual_beacon_anim.h
index e1bc5ae464..3552c9fc39 100644
--- a/quantum/led_matrix/animations/dual_beacon_anim.h
+++ b/quantum/led_matrix/animations/dual_beacon_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_DUAL_BEACON
+#ifdef ENABLE_LED_MATRIX_DUAL_BEACON
LED_MATRIX_EFFECT(DUAL_BEACON)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/solid_reactive_cross.h b/quantum/led_matrix/animations/solid_reactive_cross.h
index 94425c959f..3a3c46be13 100644
--- a/quantum/led_matrix/animations/solid_reactive_cross.h
+++ b/quantum/led_matrix/animations/solid_reactive_cross.h
@@ -1,11 +1,11 @@
#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
# if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS)
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
LED_MATRIX_EFFECT(SOLID_REACTIVE_CROSS)
# endif
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS
LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTICROSS)
# endif
@@ -22,11 +22,11 @@ static uint8_t SOLID_REACTIVE_CROSS_math(uint8_t val, int16_t dx, int16_t dy, ui
return qadd8(val, 255 - effect);
}
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
bool SOLID_REACTIVE_CROSS(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_CROSS_math); }
# endif
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS
bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math); }
# endif
diff --git a/quantum/led_matrix/animations/solid_reactive_nexus.h b/quantum/led_matrix/animations/solid_reactive_nexus.h
index 504b1104f1..2520b8e1df 100644
--- a/quantum/led_matrix/animations/solid_reactive_nexus.h
+++ b/quantum/led_matrix/animations/solid_reactive_nexus.h
@@ -1,11 +1,11 @@
#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
-# if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS)
+# if defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS)
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS
LED_MATRIX_EFFECT(SOLID_REACTIVE_NEXUS)
# endif
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS
LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTINEXUS)
# endif
@@ -19,11 +19,11 @@ static uint8_t SOLID_REACTIVE_NEXUS_math(uint8_t val, int16_t dx, int16_t dy, ui
return qadd8(val, 255 - effect);
}
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS
bool SOLID_REACTIVE_NEXUS(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math); }
# endif
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS
bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math); }
# endif
diff --git a/quantum/led_matrix/animations/solid_reactive_simple_anim.h b/quantum/led_matrix/animations/solid_reactive_simple_anim.h
index 4752a84162..43f6ad9ab4 100644
--- a/quantum/led_matrix/animations/solid_reactive_simple_anim.h
+++ b/quantum/led_matrix/animations/solid_reactive_simple_anim.h
@@ -1,5 +1,5 @@
#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE
LED_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/solid_reactive_wide.h b/quantum/led_matrix/animations/solid_reactive_wide.h
index 922e32fe5f..d683b02510 100644
--- a/quantum/led_matrix/animations/solid_reactive_wide.h
+++ b/quantum/led_matrix/animations/solid_reactive_wide.h
@@ -1,11 +1,11 @@
#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
# if !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE)
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
LED_MATRIX_EFFECT(SOLID_REACTIVE_WIDE)
# endif
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE
LED_MATRIX_EFFECT(SOLID_REACTIVE_MULTIWIDE)
# endif
@@ -17,11 +17,11 @@ static uint8_t SOLID_REACTIVE_WIDE_math(uint8_t val, int16_t dx, int16_t dy, uin
return qadd8(val, 255 - effect);
}
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
bool SOLID_REACTIVE_WIDE(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math); }
# endif
-# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE
+# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE
bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math); }
# endif
diff --git a/quantum/led_matrix/animations/solid_splash_anim.h b/quantum/led_matrix/animations/solid_splash_anim.h
index d95889b813..cf599c8fe6 100644
--- a/quantum/led_matrix/animations/solid_splash_anim.h
+++ b/quantum/led_matrix/animations/solid_splash_anim.h
@@ -1,11 +1,11 @@
#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
# if !defined(DISABLE_LED_MATRIX_SOLID_SPLASH) || !defined(DISABLE_LED_MATRIX_SOLID_MULTISPLASH)
-# ifndef DISABLE_LED_MATRIX_SOLID_SPLASH
+# ifdef ENABLE_LED_MATRIX_SOLID_SPLASH
LED_MATRIX_EFFECT(SOLID_SPLASH)
# endif
-# ifndef DISABLE_LED_MATRIX_SOLID_MULTISPLASH
+# ifdef ENABLE_LED_MATRIX_SOLID_MULTISPLASH
LED_MATRIX_EFFECT(SOLID_MULTISPLASH)
# endif
@@ -17,11 +17,11 @@ uint8_t SOLID_SPLASH_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uin
return qadd8(val, 255 - effect);
}
-# ifndef DISABLE_LED_MATRIX_SOLID_SPLASH
+# ifdef ENABLE_LED_MATRIX_SOLID_SPLASH
bool SOLID_SPLASH(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math); }
# endif
-# ifndef DISABLE_LED_MATRIX_SOLID_MULTISPLASH
+# ifdef ENABLE_LED_MATRIX_SOLID_MULTISPLASH
bool SOLID_MULTISPLASH(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math); }
# endif
diff --git a/quantum/led_matrix/animations/wave_left_right_anim.h b/quantum/led_matrix/animations/wave_left_right_anim.h
index 8579f1b45f..c062cf968e 100644
--- a/quantum/led_matrix/animations/wave_left_right_anim.h
+++ b/quantum/led_matrix/animations/wave_left_right_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT
+#ifdef ENABLE_LED_MATRIX_WAVE_LEFT_RIGHT
LED_MATRIX_EFFECT(WAVE_LEFT_RIGHT)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/animations/wave_up_down_anim.h b/quantum/led_matrix/animations/wave_up_down_anim.h
index 635c608414..5e612f6b6d 100644
--- a/quantum/led_matrix/animations/wave_up_down_anim.h
+++ b/quantum/led_matrix/animations/wave_up_down_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_LED_MATRIX_WAVE_UP_DOWN
+#ifdef ENABLE_LED_MATRIX_WAVE_UP_DOWN
LED_MATRIX_EFFECT(WAVE_UP_DOWN)
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h
index 6f85854fbe..a7a1c983f7 100644
--- a/quantum/led_matrix/led_matrix.h
+++ b/quantum/led_matrix/led_matrix.h
@@ -23,6 +23,7 @@
#include
#include "led_matrix_types.h"
#include "quantum.h"
+#include "led_matrix_legacy_enables.h"
#ifdef IS31FL3731
# include "is31fl3731-simple.h"
diff --git a/quantum/led_matrix/led_matrix_legacy_enables.h b/quantum/led_matrix/led_matrix_legacy_enables.h
new file mode 100644
index 0000000000..7738d2f34e
--- /dev/null
+++ b/quantum/led_matrix/led_matrix_legacy_enables.h
@@ -0,0 +1,82 @@
+/* Copyright 2021 QMK
+ *
+ * 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 .
+ */
+
+// to-do: remove this
+
+#pragma once
+
+#ifndef DISABLE_LED_MATRIX_ALPHAS_MODS
+# define ENABLE_LED_MATRIX_ALPHAS_MODS
+#endif
+#ifndef DISABLE_LED_MATRIX_BREATHING
+# define ENABLE_LED_MATRIX_BREATHING
+#endif
+#ifndef DISABLE_LED_MATRIX_BAND
+# define ENABLE_LED_MATRIX_BAND
+#endif
+#ifndef DISABLE_LED_MATRIX_BAND_PINWHEEL
+# define ENABLE_LED_MATRIX_BAND_PINWHEEL
+#endif
+#ifndef DISABLE_LED_MATRIX_BAND_SPIRAL
+# define ENABLE_LED_MATRIX_BAND_SPIRAL
+#endif
+#ifndef DISABLE_LED_MATRIX_CYCLE_LEFT_RIGHT
+# define ENABLE_LED_MATRIX_CYCLE_LEFT_RIGHT
+#endif
+#ifndef DISABLE_LED_MATRIX_CYCLE_UP_DOWN
+# define ENABLE_LED_MATRIX_CYCLE_UP_DOWN
+#endif
+#ifndef DISABLE_LED_MATRIX_CYCLE_OUT_IN
+# define ENABLE_LED_MATRIX_CYCLE_OUT_IN
+#endif
+#ifndef DISABLE_LED_MATRIX_DUAL_BEACON
+# define ENABLE_LED_MATRIX_DUAL_BEACON
+#endif
+#if defined(LED_MATRIX_KEYREACTIVE_ENABLED)
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE
+# define ENABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE
+# endif
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
+# define ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
+# endif
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE
+# define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE
+# endif
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
+# define ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
+# endif
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS
+# define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS
+# endif
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS
+# define ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS
+# endif
+# ifndef DISABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS
+# define ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS
+# endif
+# ifndef DISABLE_LED_MATRIX_SPLASH
+# define ENABLE_LED_MATRIX_SPLASH
+# endif
+# ifndef DISABLE_LED_MATRIX_MULTISPLASH
+# define ENABLE_LED_MATRIX_MULTISPLASH
+# endif
+#endif
+#ifndef DISABLE_LED_MATRIX_WAVE_LEFT_RIGHT
+# define ENABLE_LED_MATRIX_WAVE_LEFT_RIGHT
+#endif
+#ifndef DISABLE_LED_MATRIX_WAVE_UP_DOWN
+# define ENABLE_LED_MATRIX_WAVE_UP_DOWN
+#endif
diff --git a/quantum/process_keycode/process_rgb.c b/quantum/process_keycode/process_rgb.c
index b9fee1ca59..69853cd5c4 100644
--- a/quantum/process_keycode/process_rgb.c
+++ b/quantum/process_keycode/process_rgb.c
@@ -161,7 +161,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) && defined(RGBLIGHT_EFFECT_BREATHING)
handleKeycodeRGBMode(RGBLIGHT_MODE_BREATHING, RGBLIGHT_MODE_BREATHING_end);
#endif
-#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && !defined(DISABLE_RGB_MATRIX_BREATHING)
+#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && defined(ENABLE_RGB_MATRIX_BREATHING)
rgb_matrix_mode(RGB_MATRIX_BREATHING);
#endif
return false;
@@ -169,7 +169,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) && defined(RGBLIGHT_EFFECT_RAINBOW_MOOD)
handleKeycodeRGBMode(RGBLIGHT_MODE_RAINBOW_MOOD, RGBLIGHT_MODE_RAINBOW_MOOD_end);
#endif
-#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && !defined(DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT)
+#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && defined(ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT)
rgb_matrix_mode(RGB_MATRIX_CYCLE_LEFT_RIGHT);
#endif
return false;
@@ -177,7 +177,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
#if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES) && defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL)
handleKeycodeRGBMode(RGBLIGHT_MODE_RAINBOW_SWIRL, RGBLIGHT_MODE_RAINBOW_SWIRL_end);
#endif
-#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && !defined(DISABLE_RGB_MATRIX_CYCLE_PINWHEEL)
+#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES) && defined(ENABLE_RGB_MATRIX_CYCLE_PINWHEEL)
rgb_matrix_mode(RGB_MATRIX_CYCLE_PINWHEEL);
#endif
return false;
diff --git a/quantum/rgb_matrix/animations/alpha_mods_anim.h b/quantum/rgb_matrix/animations/alpha_mods_anim.h
index 426d88ef35..3f2c9b799a 100644
--- a/quantum/rgb_matrix/animations/alpha_mods_anim.h
+++ b/quantum/rgb_matrix/animations/alpha_mods_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
+#ifdef ENABLE_RGB_MATRIX_ALPHAS_MODS
RGB_MATRIX_EFFECT(ALPHAS_MODS)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/breathing_anim.h b/quantum/rgb_matrix/animations/breathing_anim.h
index 340bd93e5d..a00ccb83a2 100644
--- a/quantum/rgb_matrix/animations/breathing_anim.h
+++ b/quantum/rgb_matrix/animations/breathing_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_BREATHING
+#ifdef ENABLE_RGB_MATRIX_BREATHING
RGB_MATRIX_EFFECT(BREATHING)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h b/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h
index 3df3cfda7d..ac95789228 100644
--- a/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h
+++ b/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
+#ifdef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
RGB_MATRIX_EFFECT(BAND_PINWHEEL_SAT)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h b/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h
index 7d80074fd5..f7fe4b76e9 100644
--- a/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h
+++ b/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
+#ifdef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
RGB_MATRIX_EFFECT(BAND_PINWHEEL_VAL)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/colorband_sat_anim.h b/quantum/rgb_matrix/animations/colorband_sat_anim.h
index 35b830af6b..96a6cbf5cd 100644
--- a/quantum/rgb_matrix/animations/colorband_sat_anim.h
+++ b/quantum/rgb_matrix/animations/colorband_sat_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_BAND_SAT
+#ifdef ENABLE_RGB_MATRIX_BAND_SAT
RGB_MATRIX_EFFECT(BAND_SAT)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h b/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h
index 048157aa1b..52f6040d81 100644
--- a/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h
+++ b/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT
+#ifdef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
RGB_MATRIX_EFFECT(BAND_SPIRAL_SAT)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h b/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h
index bff2da1616..d5752e27fb 100644
--- a/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h
+++ b/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL
+#ifdef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
RGB_MATRIX_EFFECT(BAND_SPIRAL_VAL)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/colorband_val_anim.h b/quantum/rgb_matrix/animations/colorband_val_anim.h
index f1aaf1d067..32bc6f52a5 100644
--- a/quantum/rgb_matrix/animations/colorband_val_anim.h
+++ b/quantum/rgb_matrix/animations/colorband_val_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_BAND_VAL
+#ifdef ENABLE_RGB_MATRIX_BAND_VAL
RGB_MATRIX_EFFECT(BAND_VAL)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/cycle_all_anim.h b/quantum/rgb_matrix/animations/cycle_all_anim.h
index faf8598a39..20af94b6ba 100644
--- a/quantum/rgb_matrix/animations/cycle_all_anim.h
+++ b/quantum/rgb_matrix/animations/cycle_all_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
+#ifdef ENABLE_RGB_MATRIX_CYCLE_ALL
RGB_MATRIX_EFFECT(CYCLE_ALL)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/cycle_left_right_anim.h b/quantum/rgb_matrix/animations/cycle_left_right_anim.h
index cf911eb937..7f84f4bd59 100644
--- a/quantum/rgb_matrix/animations/cycle_left_right_anim.h
+++ b/quantum/rgb_matrix/animations/cycle_left_right_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
+#ifdef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
RGB_MATRIX_EFFECT(CYCLE_LEFT_RIGHT)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/cycle_out_in_anim.h b/quantum/rgb_matrix/animations/cycle_out_in_anim.h
index d66acd4b2b..2277f16a2f 100644
--- a/quantum/rgb_matrix/animations/cycle_out_in_anim.h
+++ b/quantum/rgb_matrix/animations/cycle_out_in_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN
+#ifdef ENABLE_RGB_MATRIX_CYCLE_OUT_IN
RGB_MATRIX_EFFECT(CYCLE_OUT_IN)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h b/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h
index fe8396140f..981c0afd05 100644
--- a/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h
+++ b/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
+#ifdef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
RGB_MATRIX_EFFECT(CYCLE_OUT_IN_DUAL)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h b/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h
index 7799887099..1a7db4a4c7 100644
--- a/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h
+++ b/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
+#ifdef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
RGB_MATRIX_EFFECT(CYCLE_PINWHEEL)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/cycle_spiral_anim.h b/quantum/rgb_matrix/animations/cycle_spiral_anim.h
index 80cfb0dbc7..245cdc237f 100644
--- a/quantum/rgb_matrix/animations/cycle_spiral_anim.h
+++ b/quantum/rgb_matrix/animations/cycle_spiral_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_CYCLE_SPIRAL
+#ifdef ENABLE_RGB_MATRIX_CYCLE_SPIRAL
RGB_MATRIX_EFFECT(CYCLE_SPIRAL)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/cycle_up_down_anim.h b/quantum/rgb_matrix/animations/cycle_up_down_anim.h
index 5016f739d6..c9b5a54133 100644
--- a/quantum/rgb_matrix/animations/cycle_up_down_anim.h
+++ b/quantum/rgb_matrix/animations/cycle_up_down_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
+#ifdef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
RGB_MATRIX_EFFECT(CYCLE_UP_DOWN)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/dual_beacon_anim.h b/quantum/rgb_matrix/animations/dual_beacon_anim.h
index ce94871681..5c06080a26 100644
--- a/quantum/rgb_matrix/animations/dual_beacon_anim.h
+++ b/quantum/rgb_matrix/animations/dual_beacon_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
+#ifdef ENABLE_RGB_MATRIX_DUAL_BEACON
RGB_MATRIX_EFFECT(DUAL_BEACON)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/gradient_left_right_anim.h b/quantum/rgb_matrix/animations/gradient_left_right_anim.h
index 53dfd04e2c..b4f2752ff7 100644
--- a/quantum/rgb_matrix/animations/gradient_left_right_anim.h
+++ b/quantum/rgb_matrix/animations/gradient_left_right_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
+#ifdef ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
RGB_MATRIX_EFFECT(GRADIENT_LEFT_RIGHT)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/gradient_up_down_anim.h b/quantum/rgb_matrix/animations/gradient_up_down_anim.h
index 7e0d2898cf..3fd45cf99b 100644
--- a/quantum/rgb_matrix/animations/gradient_up_down_anim.h
+++ b/quantum/rgb_matrix/animations/gradient_up_down_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
+#ifdef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
RGB_MATRIX_EFFECT(GRADIENT_UP_DOWN)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/hue_breathing_anim.h b/quantum/rgb_matrix/animations/hue_breathing_anim.h
index 54dea958af..6d974b8c39 100644
--- a/quantum/rgb_matrix/animations/hue_breathing_anim.h
+++ b/quantum/rgb_matrix/animations/hue_breathing_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_HUE_BREATHING
+#ifdef ENABLE_RGB_MATRIX_HUE_BREATHING
RGB_MATRIX_EFFECT(HUE_BREATHING)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/hue_pendulum_anim.h b/quantum/rgb_matrix/animations/hue_pendulum_anim.h
index 2d8d36174f..a6e1c1074d 100644
--- a/quantum/rgb_matrix/animations/hue_pendulum_anim.h
+++ b/quantum/rgb_matrix/animations/hue_pendulum_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_HUE_PENDULUM
+#ifdef ENABLE_RGB_MATRIX_HUE_PENDULUM
RGB_MATRIX_EFFECT(HUE_PENDULUM)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/hue_wave_anim.h b/quantum/rgb_matrix/animations/hue_wave_anim.h
index fd9026fc90..b1c72b7336 100644
--- a/quantum/rgb_matrix/animations/hue_wave_anim.h
+++ b/quantum/rgb_matrix/animations/hue_wave_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_HUE_WAVE
+#ifdef ENABLE_RGB_MATRIX_HUE_WAVE
RGB_MATRIX_EFFECT(HUE_WAVE)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h b/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h
index a17e954b1b..7d8eafffb9 100644
--- a/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h
+++ b/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
+#ifdef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/rainbow_beacon_anim.h b/quantum/rgb_matrix/animations/rainbow_beacon_anim.h
index 977261182f..b54d997f63 100644
--- a/quantum/rgb_matrix/animations/rainbow_beacon_anim.h
+++ b/quantum/rgb_matrix/animations/rainbow_beacon_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
+#ifdef ENABLE_RGB_MATRIX_RAINBOW_BEACON
RGB_MATRIX_EFFECT(RAINBOW_BEACON)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h b/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h
index e51e7b2516..50db922014 100644
--- a/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h
+++ b/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
+#ifdef ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
RGB_MATRIX_EFFECT(RAINBOW_MOVING_CHEVRON)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h b/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h
index 1cd4ed2acf..3299f15df1 100644
--- a/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h
+++ b/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
+#ifdef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS
RGB_MATRIX_EFFECT(RAINBOW_PINWHEELS)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/raindrops_anim.h b/quantum/rgb_matrix/animations/raindrops_anim.h
index 38359cdca7..c01688e2c7 100644
--- a/quantum/rgb_matrix/animations/raindrops_anim.h
+++ b/quantum/rgb_matrix/animations/raindrops_anim.h
@@ -1,4 +1,4 @@
-#ifndef DISABLE_RGB_MATRIX_RAINDROPS
+#ifdef ENABLE_RGB_MATRIX_RAINDROPS
RGB_MATRIX_EFFECT(RAINDROPS)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/animations/typing_heatmap_anim.h b/quantum/rgb_matrix/animations/typing_heatmap_anim.h
index e7dda11a2f..28f040109d 100644
--- a/quantum/rgb_matrix/animations/typing_heatmap_anim.h
+++ b/quantum/rgb_matrix/animations/typing_heatmap_anim.h
@@ -1,4 +1,4 @@
-#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)
+#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP)
RGB_MATRIX_EFFECT(TYPING_HEATMAP)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c
index 624e851581..e5635ee039 100644
--- a/quantum/rgb_matrix/rgb_matrix.c
+++ b/quantum/rgb_matrix/rgb_matrix.c
@@ -92,7 +92,7 @@ __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) { return hsv_to_rgb(hsv
#endif
#if !defined(RGB_MATRIX_STARTUP_MODE)
-# ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
+# ifdef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT
# else
// fallback to solid colors if RGB_MATRIX_CYCLE_LEFT_RIGHT is disabled in userspace
@@ -243,11 +243,11 @@ void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) {
}
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
-#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)
+#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP)
if (rgb_matrix_config.mode == RGB_MATRIX_TYPING_HEATMAP) {
process_rgb_matrix_typing_heatmap(row, col);
}
-#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(DISABLE_RGB_MATRIX_TYPING_HEATMAP)
+#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP)
}
void rgb_matrix_test(void) {
diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h
index 58ac29da32..f53e011c1b 100644
--- a/quantum/rgb_matrix/rgb_matrix.h
+++ b/quantum/rgb_matrix/rgb_matrix.h
@@ -23,6 +23,7 @@
#include "rgb_matrix_types.h"
#include "color.h"
#include "quantum.h"
+#include "rgb_matrix_legacy_enables.h"
#ifdef IS31FL3731
# include "is31fl3731.h"
diff --git a/quantum/rgb_matrix/rgb_matrix_legacy_enables.h b/quantum/rgb_matrix/rgb_matrix_legacy_enables.h
new file mode 100644
index 0000000000..398858ebc8
--- /dev/null
+++ b/quantum/rgb_matrix/rgb_matrix_legacy_enables.h
@@ -0,0 +1,153 @@
+/* Copyright 2021 QMK
+ *
+ * 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 .
+ */
+
+// to-do: remove this
+
+#pragma once
+
+#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
+# define ENABLE_RGB_MATRIX_ALPHAS_MODS
+#endif
+#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
+# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN
+#endif
+#ifndef DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
+# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
+#endif
+#ifndef DISABLE_RGB_MATRIX_BREATHING
+# define ENABLE_RGB_MATRIX_BREATHING
+#endif
+#ifndef DISABLE_RGB_MATRIX_BAND_SAT
+# define ENABLE_RGB_MATRIX_BAND_SAT
+#endif
+#ifndef DISABLE_RGB_MATRIX_BAND_VAL
+# define ENABLE_RGB_MATRIX_BAND_VAL
+#endif
+#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
+# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
+#endif
+#ifndef DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
+# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
+#endif
+#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT
+# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT
+#endif
+#ifndef DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL
+# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
+#endif
+#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
+# define ENABLE_RGB_MATRIX_CYCLE_ALL
+#endif
+#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
+# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
+#endif
+#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
+# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
+#endif
+#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
+# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
+#endif
+#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN
+# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN
+#endif
+#ifndef DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
+# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
+#endif
+#ifndef DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
+# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
+#endif
+#ifndef DISABLE_RGB_MATRIX_CYCLE_SPIRAL
+# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL
+#endif
+#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
+# define ENABLE_RGB_MATRIX_DUAL_BEACON
+#endif
+#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
+# define ENABLE_RGB_MATRIX_RAINBOW_BEACON
+#endif
+#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
+# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS
+#endif
+#ifndef DISABLE_RGB_MATRIX_RAINDROPS
+# define ENABLE_RGB_MATRIX_RAINDROPS
+#endif
+#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
+# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
+#endif
+#ifndef DISABLE_RGB_MATRIX_HUE_BREATHING
+# define ENABLE_RGB_MATRIX_HUE_BREATHING
+#endif
+#ifndef DISABLE_RGB_MATRIX_HUE_PENDULUM
+# define ENABLE_RGB_MATRIX_HUE_PENDULUM
+#endif
+#ifndef DISABLE_RGB_MATRIX_HUE_WAVE
+# define ENABLE_RGB_MATRIX_HUE_WAVE
+#endif
+#ifndef DISABLE_RGB_MATRIX_PIXEL_RAIN
+# define ENABLE_RGB_MATRIX_PIXEL_RAIN
+#endif
+#ifndef DISABLE_RGB_MATRIX_PIXEL_FLOW
+# define ENABLE_RGB_MATRIX_PIXEL_FLOW
+#endif
+#ifndef DISABLE_RGB_MATRIX_PIXEL_FRACTAL
+# define ENABLE_RGB_MATRIX_PIXEL_FRACTAL
+#endif
+#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
+# ifndef DISABLE_RGB_MATRIX_TYPING_HEATMAP
+# define ENABLE_RGB_MATRIX_TYPING_HEATMAP
+# endif
+# ifndef DISABLE_RGB_MATRIX_DIGITAL_RAIN
+# define ENABLE_RGB_MATRIX_DIGITAL_RAIN
+# endif
+#endif
+#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED)
+# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
+# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
+# endif
+# ifndef DISABLE_RGB_MATRIX_SPLASH
+# define ENABLE_RGB_MATRIX_SPLASH
+# endif
+# ifndef DISABLE_RGB_MATRIX_MULTISPLASH
+# define ENABLE_RGB_MATRIX_MULTISPLASH
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_SPLASH
+# define ENABLE_RGB_MATRIX_SOLID_SPLASH
+# endif
+# ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
+# define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH
+# endif
+#endif
--
cgit v1.2.3
From 29ec2d8f4283212cf45c926c288f652a6727acb7 Mon Sep 17 00:00:00 2001
From: Drashna Jaelre
Date: Thu, 26 Aug 2021 13:41:33 -0700
Subject: [Docs] Add examples to RGB Matrix Indicators docs (#12797)
---
docs/feature_rgb_matrix.md | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
(limited to 'docs/feature_rgb_matrix.md')
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 31fa9ed36e..42a57aec19 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -741,3 +741,42 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
}
}
```
+
+#### Examples :id=indicator-examples
+
+This example sets the modifiers to be a specific color based on the layer state. You can use a switch case here, instead, if you would like. This uses HSV and then converts to RGB, because this allows the brightness to be limited (important when using the WS2812 driver).
+
+```c
+void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
+ HSV hsv = {0, 255, 255};
+
+ if (layer_state_is(layer_state, 2)) {
+ hsv = {130, 255, 255};
+ } else {
+ hsv = {30, 255, 255};
+ }
+
+ if (hsv.v > rgb_matrix_get_val()) {
+ hsv.v = rgb_matrix_get_val();
+ }
+ RGB rgb = hsv_to_rgb(hsv);
+
+ for (uint8_t i = led_min; i <= led_max; i++) {
+ if (HAS_FLAGS(g_led_config.flags[i], 0x01)) { // 0x01 == LED_FLAG_MODIFIER
+ rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
+ }
+ }
+}
+```
+
+If you want to indicate a Host LED status (caps lock, num lock, etc), you can use something like this to light up the caps lock key:
+
+```c
+void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
+ if (host_keyboard_led_state().caps_lock) {
+ RGB_MATRIX_INDICATOR_SET_COLOR(5, 255, 255, 255); // assuming caps lock is at led #5
+ } else {
+ RGB_MATRIX_INDICATOR_SET_COLOR(5, 0, 0, 0);
+ }
+}
+```
--
cgit v1.2.3