summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/rgblight.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index 119ca1b9ee..3042ff11ea 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -51,6 +51,10 @@ static inline int is_static_effect(uint8_t mode) {
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
+#ifdef RGBLIGHT_LED_MAP
+const uint8_t led_map[] PROGMEM = RGBLIGHT_LED_MAP;
+#endif
+
#ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT
__attribute__ ((weak))
const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90};
@@ -665,10 +669,20 @@ void rgblight_sethsv_slave(uint16_t hue, uint8_t sat, uint8_t val) {
#ifndef RGBLIGHT_CUSTOM_DRIVER
void rgblight_set(void) {
if (rgblight_config.enable) {
+ LED_TYPE *ledp;
+ #ifdef RGBLIGHT_LED_MAP
+ LED_TYPE led0[RGBLED_NUM];
+ for(uint8_t i = 0; i < RGBLED_NUM; i++) {
+ led0[i] = led[pgm_read_byte(&led_map[i])];
+ }
+ ledp = led0;
+ #else
+ ledp = led;
+ #endif
#ifdef RGBW
- ws2812_setleds_rgbw(led, RGBLED_NUM);
+ ws2812_setleds_rgbw(ledp, RGBLED_NUM);
#else
- ws2812_setleds(led, RGBLED_NUM);
+ ws2812_setleds(ledp, RGBLED_NUM);
#endif
} else {
for (uint8_t i = 0; i < RGBLED_NUM; i++) {