Routines to drive a chain of APA102 Leds.

Dependents:   blink_led_threading

The APA102 is an LED with a built in pwm driver which can be drive by SPI.

An array of Intensity, Red, Green, Blue values packed in to integers is displayed on a strip of APA102 elements.

The array is characterized by Rows, (active) Columns, Offset, Stride, and flags which determine how to traverse the data.

To support scrolling messages, it is possible to allocate an array which is Rows x Stride in size, and use offset to "scroll" the message. The Wrap flag is used to allow the index into the array to wrap back to zero.

To support the physical construction of arrays, the zigzag flag is used to cause the display order of odd rows to be reversed. For a 3x3 array the values are displayed in the following order is zigzag is set.

1 2 3
6 5 4
7 8 9

This allows the 3rd element to be wired to the fourth element, shortening the length of the wires on the array.

Revision:
1:ce2f23241f88
Parent:
0:2fd584b4a9b8
Child:
2:b8dc9a84801c
--- a/APA102.h	Wed Mar 11 14:03:02 2015 +0000
+++ b/APA102.h	Wed Mar 11 14:13:13 2015 +0000
@@ -16,7 +16,7 @@
  
  class APA102{
   public:
-   /** Create an APA102 object connected to the specified mosi,miso,sclk pins
+/** Create an APA102 object connected to the specified mosi,miso,sclk pins
     *
     * @param mosi : SPI Master Out Slave In pin
     * @param miso : SPI Master In Slave Out pin (ignored)
@@ -25,7 +25,7 @@
     */
      APA102(PinName mosi,PinName miso,PinName sclk,int rate);
        
-     /** Set the Buffer
+/** Set the Buffer
      *
      * @param buffer[] : a buffer of unsigned integers (4 bytes) *Rows*Stride in size
      * @param Rows     : Number of Rows
@@ -37,7 +37,7 @@
      */
      void SetBuffer(unsigned int Buffer[],int Rows,int Cols, int Stride,int Offset, bool ZigZag,bool Wrap); 
      
-    /** Repaint the Strip
+/** Repaint the Strip
      *
      * @param none
      */