Color pixels library using WS2812B and nRF51822
Dependents: BLE_Color_Pixels Grove_Node BLE_HeartRate
Color pixels library using WS2812B and nRF51822 (16Hz)
It's for
- http://www.seeedstudio.com/depot/Digital-RGB-LED-FlexiStrip-60-LED-1-Meter-p-1666.html
- http://www.seeedstudio.com/depot/WS2812B-Digital-RGB-LED-Waterproof-FlexiStrip-144-LEDmeter-2-meter-p-1869.html
- http://www.seeedstudio.com/depot/WS2812B-RGB-LED-with-Integrated-Driver-Chip-10-PCs-pack-p-1675.html
Diff: color_pixels.h
- 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; };