TLIGHT_PRODUCTS / WS281X
Revision:
27:bc79f444883b
Parent:
24:f93a61e727a3
Child:
28:b452e097da53
--- a/WS281X.h	Sun Sep 04 19:00:24 2016 +0000
+++ b/WS281X.h	Tue Sep 06 22:12:59 2016 +0000
@@ -16,6 +16,8 @@
  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Rev 0.97 2016-09-07
  */
 
 #pragma once
@@ -55,25 +57,55 @@
     *   @param RGBOrder - The order in wich the r, g and b bytes are expected
     */
     WS281X(PinName wirePin, PinMode pinMode = PullNone, int maxPixels = MAX_PIXELS, RGBOrder rgbOrder = WS281X::RGB);
-    WS281X(PinName wirePin, PinMode pinMode = PullNone, RGBColor *Buffer = 0, int maxPixels = 0, RGBOrder rgbOrder = WS281X::RGB);
+    WS281X(PinName wirePin, PinMode pinMode = PullNone, RGBColor *buffer = 0, int maxPixels = 0, RGBOrder rgbOrder = WS281X::RGB);
     ~WS281X();
 
     RGBOrder getRGBOrder() { return _rgbOrder; }
     void setRGBOrder(RGBOrder rgbOrder = WS281X::RGB);
 
-    void setPixelBuffer(RGBColor *Buffer, int maxPixels);
+    void setPixelBuffer(RGBColor *buffer, int maxPixels);
+    int maxPixels() { return _maxPixels; }
+    int numPixels(int value = -1);
+    MBED_DEPRECATED("don't getMaxPixels any more, maxPixels instead")
     int getMaxPixels() { return _maxPixels; }
-    void setNumPixels(int numPixels);
+    MBED_DEPRECATED("don't setNumPixels any more, numPixels instead")
+    void setNumPixels(int value) { numPixels(value); }
+    MBED_DEPRECATED("don't getNumPixels any more, numPixels instead")
     int getNumPixels() { return _numPixels; }
 
-    void setColor(int index, RGBColor *color, int len);
-    void setColor(int index, HSVColor *color, int len);
-    void fillColor(int index, const RGBColor color, int len);
-    void repeatBlock(int block_size);
-    void repeatBlock(RGBColor *source, int size);
-    void repeatBlock(HSVColor *source, int size);
-    void clear(const RGBColor color);
-    void clear(const int color = 0) { clear((RGBColor)color); }
+    void setPixels(int index, RGBColor *color, int len);
+    void setPixels(int index, HSVColor *color, int len);
+    void setPixels(RGBColor *color, int len) { setPixels(0, color, len); }
+    void setPixels(HSVColor *color, int len) { setPixels(0, color, len); }
+    MBED_DEPRECATED("don't setColor any more, setPixels instead")
+    void setColor(int index, RGBColor *color, int len) { setPixels(index, color, len); }
+    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); }
+    MBED_DEPRECATED("don't fillColor any more, fillPixels instead")
+    void fillColor(int index, const RGBColor color, int len) { fillPixels(color, index, 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 clear(const RGBColor color) { fillPixels(color); }
+    void clear(const HSVColor color) { fillPixels(color); }
+    void clear(const int color = 0) { fillPixels((RGBColor)color); }
+
+    void repeatPixels(int block_size);
+    void repeatPixels(RGBColor *source, int size);
+    void repeatPixels(HSVColor *source, int size);
+    MBED_DEPRECATED("don't repeatBlock any more, repeatPixels instead")
+    void repeatBlock(int block_size) { repeatPixels(block_size); }
+    MBED_DEPRECATED("don't repeatBlock any more, repeatPixels instead")
+    void repeatBlock(RGBColor *source, int size) { repeatPixels(source, size); }
+    MBED_DEPRECATED("don't repeatBlock any more, repeatPixels instead")
+    void repeatBlock(HSVColor *source, int size) { repeatPixels(source, size); }
 
     void show();
     void show(const RGBColor color);
@@ -92,6 +124,8 @@
         return _dummyPixel;
     }
 
+    operator RGBColor*() const { return _pixels; }
+
 protected:
 
 private: