Optimised fork of bikeNomad's WS2811 LED control library. Supports KL25Z and KL46Z

Dependents:   CubicHand

Fork of Multi_WS2811 by Ned Konz

Optimised to use far less RAM than the original.

Capable of running up to 8 strings of 240 LEDs each with plenty of RAM to spare on the KL46Z.

Should run at least three strings of 240 LEDs on the KL25Z (RAM limited)

Revision:
7:58623ad7f310
Parent:
3:2b5b03a3c0a5
--- a/LedStrip.h	Wed Apr 02 12:16:42 2014 +0000
+++ b/LedStrip.h	Wed Apr 02 13:22:25 2014 +0000
@@ -20,66 +20,73 @@
 {
 public:
     /** Create an LED strip
-    @param n Number of RGB LEDs on the strip
+    @param pixelCount Number of RGB LEDs on the strip
     */
-    LedStrip(int n);
+    LedStrip(uint16_t pixelCount);
     ~LedStrip();
 
     //! Initialise the LED strip
     virtual void begin(void)=0;
-    //! Display the LED strip
+    //! Apply the new LED strip values
     virtual void show(void)=0;
     //! Blank the LED strip
     virtual void blank(void)=0;
 
     /** Pack RGB Color data
-    @param r Amount of Red
-    @param g Amount of Green
-    @param b Amount of Blue
+    @param red Amount of Red
+    @param green Amount of Green
+    @param blue Amount of Blue
+    @returns Packed RGB color data for one pixel
     */
-    static uint32_t Color(uint8_t r, uint8_t g, uint8_t b);
+    static uint32_t Color(uint8_t red, uint8_t green, uint8_t blue);
 
     //! Number of RGB pixels
-    uint16_t numPixels(void) { return numLEDs; }
+    uint16_t numPixels() {
+        return numLEDs;
+    }
     //! Number of bytes used for pixel colour data
-    uint16_t numPixelBytes(void) { return numLEDs * 3; }
-    //! Total brightness of all diodes\n
-    //! Use to check power budget
-    uint32_t total_luminance(void);
+    uint16_t numPixelBytes() {
+        return numLEDs * 3;
+    }
+    /** Total brightness of all diodes\n
+    * Use to check power budget
+    @returns Sum total of all diodes (red + green + blue)
+    */
+    uint32_t total_luminance();
 
     /** Set Blue level of pixel
-    @param n Pixel Number
-    @param b Amount of Blue
+    @param pixNum Pixel Number
+    @param blue Amount of Blue
     */
-    void setPixelB(uint16_t n, uint8_t b);
+    void setPixelB(uint16_t pixNum, uint8_t blue);
     /** Set Green level of pixel
-    @param n Pixel Number
-    @param g Amount of Green
+    @param pixNum Pixel Number
+    @param green Amount of Green
     */
-    void setPixelG(uint16_t n, uint8_t g);
+    void setPixelG(uint16_t pixNum, uint8_t green);
     /** Set Red level of pixel
-    @param n Pixel Number
-    @param r Amount of Red
+    @param pixNum Pixel Number
+    @param red Amount of Red
     */
-    void setPixelR(uint16_t n, uint8_t r);
-    
+    void setPixelR(uint16_t pixNum, uint8_t red);
+
     /** Set color of pixel
-    @param n Pixel Number
-    @param c Packed RGB color data
+    @param pixNum Pixel Number
+    @param color Packed RGB color data
     */
-    void setPixelColor(uint16_t n, uint32_t c);
+    void setPixelColor(uint16_t pixNum, uint32_t color);
     /** Set color of pixel
-    @param n Pixel Number
-    @param r Amount of Red
-    @param g Amount of Green
-    @param b Amount of Blue
+    @param pixNum Pixel Number
+    @param red Amount of Red
+    @param green Amount of Green
+    @param blue Amount of Blue
     */
-    void setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b);
+    void setPixelColor(uint16_t pixNum, uint8_t red, uint8_t green, uint8_t blue);
     /** Set color of all pixels
     @param *buffer Packed pixel data
-    @param n number of pixels
-    */    
-    void setPackedPixels(uint8_t * buffer, uint32_t n);
+    @param count Number of pixels
+    */
+    void setPackedPixels(uint8_t * buffer, uint32_t count);
 
 protected:
     uint8_t *pixels;     // Holds LED color values