My Version of The LED_WS2812 Library
Dependencies: WS2812 PixelArray
Fork of LED_WS2812 by
LED_WS2812.h
- Committer:
- garphil
- Date:
- 2017-02-15
- Revision:
- 0:999518b1799b
- Child:
- 1:64e72a25801f
File content as of revision 0:999518b1799b:
#ifndef LED_WS2812_H #define LED_WS2812_H #include "mbed.h" #include "WS2812.h" #include "PixelArray.h" #define ZERO_HIGH 250.0 #define ZERO_LOW 1000.0 #define ONE_HIGH 1000.0 #define ONE_LOW 250.0 typedef enum _LED_COLORS { BLUE = 0x0000FF, LIGHTBLUE = 0x00FFF6, RED = 0xFF0000, GREEN = 0X00FF00, BLACK = 0X000000, WHITE = 0XFFFFFF, PURPLE = 0XFF00FF, PINK = 0XFF84A3, YELLOW = 0XFFFF00, DARK_YELLOW = 0X555500, DEFAULT = 0x000000 } LED_COLORS; class LED_WS2812 { public: LED_WS2812(PinName _PinOut, int _nbLeds); ~LED_WS2812(); void SetColor(unsigned int _color); void SetColor(LED_COLORS _color); void ResetColor(); void SetIntensity(float perCent); void InsertColor(unsigned int _color); void InsertColor(unsigned int _color, float brightness); void InsertColorNtimes(int N, unsigned int _color, float brightness); void InsertColorNtimes(int N, unsigned int _color); void InsertColor(LED_COLORS _color); void InsertColor(LED_COLORS _color, float brightness); void InsertColorNtimes(int N, LED_COLORS _color, float brightness); void InsertColorNtimes(int N, LED_COLORS _color); void StartRotation(float interval); // itnerval in ms void StopRotation(); // interval in ms void Rotate(); // One Rotation private: void __writeBuf(int z); void __insert2buf(); void __insertColor(unsigned int _color, int _intensity); WS2812 *ws; int nbLeds; PixelArray *pxArray; int nbInsert; PixelArray *pxInsert; Ticker LEDSystemTick; // System Callback for Rotation bool rotationState; int rotationPosition; int intensity; }; #endif