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

Fork of TLC5940 by Stefan Nielsen

Committer:
deton
Date:
Tue Oct 13 12:20:23 2015 +0000
Revision:
2:b411648dfe54
Parent:
1:b188393f5b49
Child:
3:2c0af5f5fa13
Remove unused setAll().; ; Comment out sclk pulse before grayscale data,; becaue it works without this pulse.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Julepalme 0:bdf7a64b89a7 1 #ifndef TLC5940_H_
Julepalme 0:bdf7a64b89a7 2 #define TLC5940_H_
Julepalme 0:bdf7a64b89a7 3
Julepalme 0:bdf7a64b89a7 4 #include "mbed.h"
deton 1:b188393f5b49 5 #include "SWSPI.h"
Julepalme 0:bdf7a64b89a7 6
Julepalme 0:bdf7a64b89a7 7 class TLC5940 {
Julepalme 0:bdf7a64b89a7 8 private:
deton 1:b188393f5b49 9 SWSPI _spi;
deton 1:b188393f5b49 10 PwmOut _gsclk;
deton 1:b188393f5b49 11 DigitalOut _sclk;
deton 1:b188393f5b49 12 DigitalOut _xlat;
deton 1:b188393f5b49 13 DigitalOut _blank;
deton 1:b188393f5b49 14 Ticker _t;
deton 1:b188393f5b49 15 uint16_t gs_data[16];
deton 1:b188393f5b49 16 void refresh();
Julepalme 0:bdf7a64b89a7 17 public:
Julepalme 0:bdf7a64b89a7 18 TLC5940(PinName mosi, PinName miso, PinName sck, PinName xlat, PinName blank, PinName gsclk);
deton 1:b188393f5b49 19 void set(int channel, uint16_t brightness);
Julepalme 0:bdf7a64b89a7 20 void flush();
Julepalme 0:bdf7a64b89a7 21 void run();
Julepalme 0:bdf7a64b89a7 22 };
Julepalme 0:bdf7a64b89a7 23
Julepalme 0:bdf7a64b89a7 24 #endif /* TLC5940_H_ */