From af2f9a265529258a6f5a0a4be588bbcb6127bbc0 Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Wed, 2 Jul 2014 08:57:03 +0100 Subject: [PATCH] Work-in-progress --- src/main/drivers/light_ws2811strip.h | 2 +- src/main/io/ledstrip.c | 39 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/main/drivers/light_ws2811strip.h b/src/main/drivers/light_ws2811strip.h index caac4fb82e..7bea801f78 100644 --- a/src/main/drivers/light_ws2811strip.h +++ b/src/main/drivers/light_ws2811strip.h @@ -17,7 +17,7 @@ #pragma once -#define WS2811_LED_STRIP_LENGTH 10 +#define WS2811_LED_STRIP_LENGTH 28 #define WS2811_BITS_PER_LED 24 #define WS2811_DELAY_BUFFER_LENGTH 42 // for 50us delay diff --git a/src/main/io/ledstrip.c b/src/main/io/ledstrip.c index a5e8f347d6..065d050ea9 100644 --- a/src/main/io/ledstrip.c +++ b/src/main/io/ledstrip.c @@ -33,6 +33,8 @@ #include "io/ledstrip.h" +#define LED_WHITE {255, 255, 255} +#define LED_BLACK {0, 0, 0 } #define LED_RED {255, 0, 0 } #define LED_GREEN {0, 255, 0 } #define LED_BLUE {0, 0, 255} @@ -42,16 +44,53 @@ #define LED_PINK {255, 0, 128} #define LED_PURPLE {192, 64, 255} +/* + * 0..5 - rear right cluster, 0..2 rear 3..5 right + * 6..11 - front right cluster, 6..8 rear, 9..11 front + * 12..15 - front center cluster + * 16..21 - front left cluster, 16..18 front, 19..21 rear + * 22..27 - rear left cluster, 22..24 left, 25..27 rear + */ + +// FIXME this will work, but it's flash intensive and very customized +// a better solution would be to create an LED mapping and allow the user to specify it. +// e.g. "SSSEEESSSNNNNNNNNNNSSSWWWSSS" for north east south west facing leds, add U and D for up and downwards facing. +// additionally an led x/y position, so that sections can be lit individually. +// e.g. "1,1:1,2:1,3:1,4:2,1:2,2..." +// perhaps constrain the user by making them fit in a 5x5 grid (odd so you get a middle and small for easy processing) +// a more granular effects can be achieved by using a larger grid. static const rgbColor24bpp_t stripOrientation[] = { + {LED_RED}, + {LED_RED}, + {LED_RED}, + {LED_PURPLE}, + {LED_PURPLE}, + {LED_PURPLE}, + + {LED_RED}, + {LED_RED}, + {LED_RED}, {LED_GREEN}, {LED_GREEN}, + {LED_GREEN}, + + {LED_WHITE}, + {LED_WHITE}, + {LED_WHITE}, + {LED_WHITE}, + {LED_GREEN}, {LED_GREEN}, {LED_GREEN}, {LED_RED}, {LED_RED}, {LED_RED}, + + {LED_BLUE}, + {LED_BLUE}, + {LED_BLUE}, + {LED_RED}, {LED_RED}, {LED_RED} };