MakeBlock Drive Updated Updated library for MakeBlock Ranger

Loading...
Searching...
No Matches
MeRGBLed.h
Go to the documentation of this file.
1
60#ifndef MeRGBLed_h
61#define MeRGBLed_h
62#include <stdint.h>
63#include <stdbool.h>
64#include <Arduino.h>
65#include "MeConfig.h"
66
67#ifdef ME_PORT_DEFINED
68#include "MePort.h"
69#endif // ME_PORT_DEFINED
70
71#define DEFAULT_MAX_LED_NUMBER (32)
72
74 struct cRGB
75{
76 uint8_t g;
77 uint8_t r;
78 uint8_t b;
79};
80
87#ifndef ME_PORT_DEFINED
88 class MeRGBLed
89#else // !ME_PORT_DEFINED
90class MeRGBLed : public MePort
91#endif // !ME_PORT_DEFINED
92{
93 public:
94#ifdef ME_PORT_DEFINED
102 MeRGBLed(void);
103
111 MeRGBLed(uint8_t port);
112
122 MeRGBLed(uint8_t port, uint8_t led_num);
123
136 MeRGBLed(uint8_t port, uint8_t slot, uint8_t led_num);
137#else //ME_PORT_DEFINED
145 MeRGBLed(uint8_t port);
146
156 MeRGBLed(uint8_t port, uint8_t led_num);
157#endif //ME_PORT_DEFINED
161 ~MeRGBLed(void);
162
163#ifdef ME_PORT_DEFINED
178 void reset(uint8_t port);
179
196 void reset(uint8_t port,uint8_t slot);
197#endif //ME_PORT_DEFINED
212 void setpin(uint8_t port);
213
226 uint8_t getNumber(void);
227
242 cRGB getColorAt(uint8_t index);
243
262 void fillPixelsBak(uint8_t red, uint8_t green, uint8_t blue);
263
285 bool setColorAt(uint8_t index, uint8_t red, uint8_t green, uint8_t blue);
286
308 bool setColor(uint8_t index, uint8_t red, uint8_t green, uint8_t blue);
309
329 bool setColor(uint8_t red, uint8_t green, uint8_t blue);
330
346 bool setColor(uint8_t index, long value);
347
362 void setNumber(uint8_t num_led);
363
376 void show(void);
377
378 private:
379 uint16_t count_led;
380 uint8_t *pixels;
381 uint8_t *pixels_bak;
382
404 void rgbled_sendarray_mask(uint8_t *array, uint16_t length, uint8_t pinmask, uint8_t *port);
405
406 const volatile uint8_t *ws2812_port;
407 volatile uint8_t *ws2812_port_reg;
408 uint8_t pinMask;
409};
410#endif
MeConfig.h
Configuration file of library.
MePort.h
Header for MePort.cpp module.
MePort
Port Mapping for RJ25.
Definition MePort.h:128
MeRGBLed
Driver for W2812 full-color LED.
Definition MeRGBLed.h:92
MeRGBLed::reset
void reset(uint8_t port)
Definition MeRGBLed.cpp:200
MeRGBLed::fillPixelsBak
void fillPixelsBak(uint8_t red, uint8_t green, uint8_t blue)
Definition MeRGBLed.cpp:379
MeRGBLed::getColorAt
cRGB getColorAt(uint8_t index)
Definition MeRGBLed.cpp:328
MeRGBLed::setColorAt
bool setColorAt(uint8_t index, uint8_t red, uint8_t green, uint8_t blue)
Definition MeRGBLed.cpp:411
MeRGBLed::getNumber
uint8_t getNumber(void)
Definition MeRGBLed.cpp:356
MeRGBLed::setColor
bool setColor(uint8_t index, uint8_t red, uint8_t green, uint8_t blue)
Definition MeRGBLed.cpp:445
MeRGBLed::show
void show(void)
Definition MeRGBLed.cpp:706
MeRGBLed::setNumber
void setNumber(uint8_t num_led)
Definition MeRGBLed.cpp:290
MeRGBLed::MeRGBLed
MeRGBLed(void)
Definition MeRGBLed.cpp:75
cRGB
Class for RGB Led Module.
Definition MeRGBLed.h:75