Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: WS281X.h
- Revision:
- 28:b452e097da53
- Parent:
- 27:bc79f444883b
- Child:
- 29:a362df191524
--- a/WS281X.h Tue Sep 06 22:12:59 2016 +0000 +++ b/WS281X.h Wed Sep 07 21:07:17 2016 +0000 @@ -18,6 +18,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Rev 0.97 2016-09-07 + * Rev 0.98 2016-09-08 */ #pragma once @@ -45,7 +46,8 @@ */ enum RGBOrder { - RGB, RBG, GRB, GBR, BRG, BGR + RGB = 0, RBG, GRB, GBR, BRG, BGR, + GET_ORDER = -1 }; /** @@ -60,8 +62,11 @@ WS281X(PinName wirePin, PinMode pinMode = PullNone, RGBColor *buffer = 0, int maxPixels = 0, RGBOrder rgbOrder = WS281X::RGB); ~WS281X(); + WS281X::RGBOrder rgbOrder(WS281X::RGBOrder order = GET_ORDER); + MBED_DEPRECATED("don't setRGBOrder any more, rgbOrder() instead") + void setRGBOrder(RGBOrder order = WS281X::RGB) { rgbOrder(order); } + MBED_DEPRECATED("don't getRGBOrder any more, rgbOrder() instead") RGBOrder getRGBOrder() { return _rgbOrder; } - void setRGBOrder(RGBOrder rgbOrder = WS281X::RGB); void setPixelBuffer(RGBColor *buffer, int maxPixels); int maxPixels() { return _maxPixels; } @@ -82,20 +87,20 @@ MBED_DEPRECATED("don't setColor any more, setPixels instead") void setColor(int index, HSVColor *color, int len) { setPixels(index, color, len); } - void fillPixels(const RGBColor color, int index, int len); - void fillPixels(const HSVColor color, int index, int len); - void fillPixels(const int color, int index, int len) { fillPixels((RGBColor)color, index, len); } - void fillPixels(const RGBColor color, int len = MAX_PIXELS) { fillPixels(color, 0, len); } - void fillPixels(const HSVColor color, int len = MAX_PIXELS) { fillPixels(color, 0, len); } - void fillPixels(const int color, int len = MAX_PIXELS) { fillPixels((RGBColor)color, 0, len); } + void fillPixels(int index, const RGBColor color, int len); + void fillPixels(int index, const HSVColor color, int len); + void fillPixels(int index, const int color, int len) { fillPixels(index, (RGBColor)color, len); } + void fillPixels(const RGBColor color, int len = MAX_PIXELS) { fillPixels(0, color, len); } + void fillPixels(const HSVColor color, int len = MAX_PIXELS) { fillPixels(0, color, len); } + void fillPixels(const int color, int len = MAX_PIXELS) { fillPixels(0, (RGBColor)color, len); } MBED_DEPRECATED("don't fillColor any more, fillPixels instead") - void fillColor(int index, const RGBColor color, int len) { fillPixels(color, index, len); } + void fillColor(int index, const RGBColor color, int len) { fillPixels(index, color, len); } MBED_DEPRECATED("don't fillColor any more, fillPixels instead") - void fillColor(int index, const int32_t color, int len) { fillPixels((RGBColor)color, index, len); } + void fillColor(int index, const int32_t color, int len) { fillPixels(index, (RGBColor)color, len); } void clear(const RGBColor color) { fillPixels(color); } void clear(const HSVColor color) { fillPixels(color); } - void clear(const int color = 0) { fillPixels((RGBColor)color); } + void clear(const int color = 0) { fillPixels((RGBColor)color); } void repeatPixels(int block_size); void repeatPixels(RGBColor *source, int size); @@ -107,6 +112,12 @@ MBED_DEPRECATED("don't repeatBlock any more, repeatPixels instead") void repeatBlock(HSVColor *source, int size) { repeatPixels(source, size); } + void makeGradation(int index, RGBColor from, RGBColor to, int len); + void makeGradation(RGBColor from, RGBColor to, int len) { makeGradation(0, from, to, len); } + + void makeRainbow(int index, HSVColor color, int len, int direction); + void makeRainbow(HSVColor color, int len = MAX_PIXELS, int direction = 1) { makeRainbow(0, color, len, direction); } + void show(); void show(const RGBColor color);