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.cpp
- Revision:
- 21:77275089d837
- Parent:
- 20:28fe0d0d081b
- Child:
- 22:0846aefbeeae
--- a/WS281X.cpp	Thu Aug 25 14:54:20 2016 +0000
+++ b/WS281X.cpp	Fri Aug 26 17:02:02 2016 +0000
@@ -369,6 +369,15 @@
         return;
     if (index + len > _numPixels)
         len = _numPixels - index;
+    memcpy(&_pixels[index], color, len * sizeof(_pixels[0]));
+}
+
+void WS281X::setColor(int index, HSVColor *color, int len)
+{
+    if (!_pixels || len < 1 || (uint16_t)index >= _numPixels)
+        return;
+    if (index + len > _numPixels)
+        len = _numPixels - index;
     do
     {
         _pixels[index] = *color;