Color pixels library using WS2812B and nRF51822

Dependents:   BLE_Color_Pixels Grove_Node BLE_HeartRate

Color pixels library using WS2812B and nRF51822 (16Hz)

http://www.seeedstudio.com/depot/bmz_cache/4/4f346dc15724a7b5a5c1383253aeefc9.image.530x397.jpg

It's for

Revision:
2:5c805323a2c0
Parent:
1:0322642447e2
Child:
3:91af7b451005
--- a/color_pixels.h	Thu Jul 31 12:02:23 2014 +0000
+++ b/color_pixels.h	Tue Oct 28 11:03:20 2014 +0800
@@ -32,6 +32,15 @@
 
 #include <stdint.h>
 
+typedef union {
+    uint32_t rgb;
+    struct {
+        uint8_t r;
+        uint8_t g;
+        uint8_t b;
+    };
+} color_t;
+
 /** Color pixels class using WS2812B and nRF51822 (16Hz)
  *
  * Example:
@@ -69,6 +78,12 @@
      */
     void set_color(uint16_t index, uint8_t r, uint8_t g, uint8_t b);
 
+    void set_color(uint16_t index, uint32_t rgb);
+    
+    void rainbow(uint8_t r, uint8_t g, uint8_t b);
+
+    void rainbow(uint32_t rgb = 0x0000FF);
+
     /** Update
      */
     void update();
@@ -83,11 +98,11 @@
             uint8_t g, r, b;
         };
         uint32_t grb;
-    } color_t;
+    } grb_t;
 
     uint8_t  pin;
     uint16_t num;
-    color_t *colors;
+    grb_t *colors;
 
 };