Nucleo-transfer

Dependencies:   BurstSPI

Dependents:   Nucleo-transfer Nucleo-transfer Nucleo-transfer

Fork of PixelArray by Jacob Bramley

Revision:
3:6f392fcb1d3b
Parent:
2:3c3c41774cdf
--- a/neopixel.h	Fri Aug 01 22:17:23 2014 +0000
+++ b/neopixel.h	Mon Aug 18 21:38:40 2014 +0000
@@ -31,6 +31,16 @@
     BYTE_ORDER_RGB,
 };
 
+/** Set the protocol mode.
+ *
+ * The protocol is named after the clock, as though WS8211 supports only the
+ * 400kHz clock, WS8212 supports both.
+ */
+enum Protocol {
+    PROTOCOL_800KHZ,
+    PROTOCOL_400KHZ,
+};
+
 typedef void (*PixelGenerator)(Pixel* out, uint32_t index, uintptr_t extra);
 
 /** Control an array or chain of NeoPixel-compatible RGB LEDs.
@@ -91,7 +101,8 @@
      * @param byte_order The order in which to transmit colour channels.
      */
     PixelArray(PinName out,
-               ByteOrder byte_order = BYTE_ORDER_GRB);
+               ByteOrder byte_order = BYTE_ORDER_GRB,
+               Protocol protocol = PROTOCOL_800KHZ);
 
     /** Update the pixel display from a buffer.
      *
@@ -135,6 +146,7 @@
 private:
     BurstSPI spi_;
     ByteOrder byte_order_;
+    Protocol protocol_;
     
     static int const latch_time_us_ = 50;