Routines to drive a chain of APA102 Leds.

Fork of APA102 by Joel Rosiene

Embed: (wiki syntax)

« Back to documentation index

APA102a Class Reference

APA102a Class Reference

Create an APA102 Object. More...

#include <APA102a.h>

Public Member Functions

 APA102a (PinName mosi, PinName miso, PinName sclk, int rate)
 Create an APA102 object connected to the specified mosi,miso,sclk pins.
void SetBuffer (unsigned int Buffer[], int Rows, int Cols, int Stride, int Offset, bool ZigZag, bool Wrap)
 Set the Buffer.
void Repaint ()
 Repaint the Strip Sends to the Buffer to the Strip.
unsigned int IRGB (unsigned char I, unsigned char R, unsigned char G, unsigned char B)
 Create an IRGB helper function to construct a 4 byte LED Frame.

Detailed Description

Create an APA102 Object.

Definition at line 11 of file APA102a.h.


Constructor & Destructor Documentation

APA102a ( PinName  mosi,
PinName  miso,
PinName  sclk,
int  rate 
)

Create an APA102 object connected to the specified mosi,miso,sclk pins.

Parameters:
mosi: SPI Master Out Slave In pin
miso: SPI Master In Slave Out pin (ignored)
sclk: SPI Clock
rate: SPI Rate

Definition at line 4 of file APA102a.cpp.


Member Function Documentation

unsigned int IRGB ( unsigned char  I,
unsigned char  R,
unsigned char  G,
unsigned char  B 
)

Create an IRGB helper function to construct a 4 byte LED Frame.

Parameters:
I: 5 bits of intensity (0,1,2,...,31)
R: 8 bits of Red (0,1,...,255)
G: 8 bits of Green (0,1,...,255)
B: 8 bits of Blue (0,1,...,255)

Definition at line 48 of file APA102a.h.

void Repaint (  )

Repaint the Strip Sends to the Buffer to the Strip.

Parameters:
none

Definition at line 25 of file APA102a.cpp.

void SetBuffer ( unsigned int  Buffer[],
int  Rows,
int  Cols,
int  Stride,
int  Offset,
bool  ZigZag,
bool  Wrap 
)

Set the Buffer.

Parameters:
buffer[]: a buffer of unsigned integers (4 bytes) *Rows*Stride in size
Rows: Number of Rows
Cols: Number of Columns
Stride: The actual number of columns (useful for data alignment)
Offset: The offset into a row
ZigZag: A boolean, do we alternate count up/ count down per row?
Wrap: A boolean, do we wrap if (Offset+Cols) > Stride? (handy for scrolling messages)

Definition at line 14 of file APA102a.cpp.