TLC5940 library which supports SWSPI, has API to specify grayscale PWM period and has API like Arduino library.

Fork of TLC5940 by Stefan Nielsen

TLC5940.h

Committer:
deton
Date:
2015-10-12
Revision:
1:b188393f5b49
Parent:
0:bdf7a64b89a7
Child:
2:b411648dfe54

File content as of revision 1:b188393f5b49:

#ifndef TLC5940_H_
#define TLC5940_H_

#include "mbed.h"
#include "SWSPI.h"

class TLC5940 {
private:
    SWSPI _spi;
    PwmOut _gsclk;
    DigitalOut _sclk;
    DigitalOut _xlat;
    DigitalOut _blank; 
    Ticker _t;
    uint16_t gs_data[16];
    void refresh();
public:
    TLC5940(PinName mosi, PinName miso, PinName sck, PinName xlat, PinName blank, PinName gsclk);
    void set(int channel, uint16_t brightness);
    void setAll(uint16_t brightness);
    void flush();
    void run();
};

#endif /* TLC5940_H_ */