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:
Julepalme
Date:
Sun Mar 24 16:23:29 2013 +0000
Revision:
0:bdf7a64b89a7
Child:
1:b188393f5b49
s

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"
Julepalme 0:bdf7a64b89a7 5
Julepalme 0:bdf7a64b89a7 6 class TLC5940 {
Julepalme 0:bdf7a64b89a7 7 private:
Julepalme 0:bdf7a64b89a7 8 SPI * _spi;
Julepalme 0:bdf7a64b89a7 9 PwmOut * _gsclk;
Julepalme 0:bdf7a64b89a7 10 DigitalOut * _xlat;
Julepalme 0:bdf7a64b89a7 11 DigitalOut * _blank;
Julepalme 0:bdf7a64b89a7 12 Ticker * _t;
Julepalme 0:bdf7a64b89a7 13 int gs_data[16];
Julepalme 0:bdf7a64b89a7 14 public:
Julepalme 0:bdf7a64b89a7 15 TLC5940(PinName mosi, PinName miso, PinName sck, PinName xlat, PinName blank, PinName gsclk);
Julepalme 0:bdf7a64b89a7 16 void setServo(int ch, int val);
Julepalme 0:bdf7a64b89a7 17 void flush();
Julepalme 0:bdf7a64b89a7 18 void run();
Julepalme 0:bdf7a64b89a7 19 void refresh();
Julepalme 0:bdf7a64b89a7 20 };
Julepalme 0:bdf7a64b89a7 21
Julepalme 0:bdf7a64b89a7 22 #endif /* TLC5940_H_ */