My Project
 All Classes Functions Variables Pages
SmartLED.h
1 /*
2  * SmartLED.h
3  *
4  * Created on: Oct 22, 2017
5  * Author: kolban
6  */
7 
8 #ifndef COMPONENTS_SMARTLED_H_
9 #define COMPONENTS_SMARTLED_H_
10 #include <stdint.h>
14 typedef struct {
18  uint8_t red;
22  uint8_t green;
26  uint8_t blue;
27 } pixel_t;
28 
29 
30 class SmartLED {
31 public:
32  SmartLED();
33  virtual ~SmartLED();
34  uint32_t getBrightness();
35  uint16_t getPixelCount();
36  virtual void init() = 0;
37  virtual void show() = 0;
38  void setBrightness(uint32_t percent);
39  void setColorOrder(char* order);
40  void setPixel(uint16_t index, uint8_t red, uint8_t green, uint8_t blue);
41  void setPixel(uint16_t index, pixel_t pixel);
42  void setPixel(uint16_t index, uint32_t pixel);
43  void setPixelCount(uint16_t pixelCount);
44  void setHSBPixel(uint16_t index, uint16_t hue, uint8_t saturation, uint8_t brightness);
45  void clear();
46 
47 protected:
48  uint32_t m_brightness;
49  char* m_colorOrder;
50  uint16_t m_pixelCount;
51  pixel_t* m_pixels;
52 };
53 
54 #endif /* COMPONENTS_SMARTLED_H_ */
uint32_t getBrightness()
Get the brightness as a percentage.
Definition: SmartLED.cpp:47
void setHSBPixel(uint16_t index, uint16_t hue, uint8_t saturation, uint8_t brightness)
Set the given pixel to the specified HSB color.
Definition: SmartLED.cpp:158
A data type representing the color of a pixel.
Definition: SmartLED.h:14
void setColorOrder(char *order)
Set the color order of data sent to the LEDs.
Definition: SmartLED.cpp:82
uint8_t red
The red component of the pixel.
Definition: SmartLED.h:18
uint16_t getPixelCount()
Return the number of pixels in the chain.
Definition: SmartLED.cpp:56
uint8_t blue
The blue component of the pixel.
Definition: SmartLED.h:26
void clear()
Clear all the pixel colors.
Definition: SmartLED.cpp:34
void setPixel(uint16_t index, uint8_t red, uint8_t green, uint8_t blue)
Set the given pixel to the specified color.
Definition: SmartLED.cpp:99
void setBrightness(uint32_t percent)
Set the brightness as a percentage.
Definition: SmartLED.cpp:65
Definition: SmartLED.h:30
uint8_t green
The green component of the pixel.
Definition: SmartLED.h:22