TLC5940 library which supports SWSPI, has API to specify grayscale PWM period and has API like Arduino library.
Fork of TLC5940 by
Diff: TLC5940.h
- Revision:
- 1:b188393f5b49
- Parent:
- 0:bdf7a64b89a7
- Child:
- 2:b411648dfe54
--- a/TLC5940.h Sun Mar 24 16:23:29 2013 +0000 +++ b/TLC5940.h Mon Oct 12 04:28:01 2015 +0000 @@ -2,21 +2,24 @@ #define TLC5940_H_ #include "mbed.h" +#include "SWSPI.h" class TLC5940 { private: - SPI * _spi; - PwmOut * _gsclk; - DigitalOut * _xlat; - DigitalOut * _blank; - Ticker * _t; - int gs_data[16]; + 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 setServo(int ch, int val); + void set(int channel, uint16_t brightness); + void setAll(uint16_t brightness); void flush(); void run(); - void refresh(); }; #endif /* TLC5940_H_ */ \ No newline at end of file