Makeblock-library-for-Arduino  V3.2.4
It's a library for arduino application developers
MeRGBLed.h
Go to the documentation of this file.
1 
47 #ifndef MeRGBLed_h
48 #define MeRGBLed_h
49 #include <stdint.h>
50 #include <stdbool.h>
51 #include <Arduino.h>
52 #include "MeConfig.h"
53 
54 #ifdef ME_PORT_DEFINED
55 #include "MePort.h"
56 #endif // ME_PORT_DEFINED
57 
58 #define DEFAULT_MAX_LED_NUMBER (32)
59 
61 struct cRGB
62 {
63  uint8_t g;
64  uint8_t r;
65  uint8_t b;
66 };
67 
74 #ifndef ME_PORT_DEFINED
75 class MeRGBLed
76 #else // !ME_PORT_DEFINED
77 class MeRGBLed : public MePort
78 #endif // !ME_PORT_DEFINED
79 {
80 public:
81 #ifdef ME_PORT_DEFINED
82 
89  MeRGBLed(void);
90 
98  MeRGBLed(uint8_t port);
99 
109  MeRGBLed(uint8_t port, uint8_t led_num);
110 
123  MeRGBLed(uint8_t port, uint8_t slot, uint8_t led_num);
124 #else //ME_PORT_DEFINED
125 
132  MeRGBLed(uint8_t port);
133 
143  MeRGBLed(uint8_t port, uint8_t led_num);
144 #endif //ME_PORT_DEFINED
145 
148  ~MeRGBLed(void);
149 
150 #ifdef ME_PORT_DEFINED
151 
165  void reset(uint8_t port);
166 
183  void reset(uint8_t port,uint8_t slot);
184 #endif //ME_PORT_DEFINED
185 
199  void setpin(uint8_t port);
200 
213  uint8_t getNumber(void);
214 
229  cRGB getColorAt(uint8_t index);
230 
252 bool setColorAt(uint8_t index, uint8_t red, uint8_t green, uint8_t blue);
253 
275  bool setColor(uint8_t index, uint8_t red, uint8_t green, uint8_t blue);
276 
296  bool setColor(uint8_t red, uint8_t green, uint8_t blue);
297 
313  bool setColor(uint8_t index, long value);
314 
329  void setNumber(uint8_t num_led);
330 
343  void show(void);
344 
345 private:
346  uint16_t count_led;
347  uint8_t *pixels;
348 
370  void rgbled_sendarray_mask(uint8_t *array, uint16_t length, uint8_t pinmask, uint8_t *port);
371 
372  const volatile uint8_t *ws2812_port;
373  volatile uint8_t *ws2812_port_reg;
374  uint8_t pinMask;
375 };
376 #endif
Configuration file of library.
MeRGBLed(void)
Definition: MeRGBLed.cpp:60
Port Mapping for RJ25.
Definition: MePort.h:118
uint8_t r
Definition: MeRGBLed.h:64
void setpin(uint8_t port)
Definition: MeRGBLed.cpp:238
bool setColor(uint8_t index, uint8_t red, uint8_t green, uint8_t blue)
Definition: MeRGBLed.cpp:375
cRGB getColorAt(uint8_t index)
Definition: MeRGBLed.cpp:287
void reset(uint8_t port)
Definition: MeRGBLed.cpp:179
uint8_t b
Definition: MeRGBLed.h:65
uint8_t g
Definition: MeRGBLed.h:63
bool setColorAt(uint8_t index, uint8_t red, uint8_t green, uint8_t blue)
Definition: MeRGBLed.cpp:341
~MeRGBLed(void)
Definition: MeRGBLed.cpp:644
Driver for W2812 full-color LED.
Definition: MeRGBLed.h:77
Header for MePort.cpp module.
Class for RGB Led Module.
Definition: MeRGBLed.h:61
uint8_t getNumber(void)
Definition: MeRGBLed.cpp:315
void setNumber(uint8_t num_led)
Definition: MeRGBLed.cpp:259
void show(void)
Definition: MeRGBLed.cpp:636