Cascaded led driver to write use write into leds[i] = 0x0 or 0xfff
Fork of TLC5940 by
TLC5940.cpp
- Committer:
- slisgrinder
- Date:
- 2013-01-25
- Revision:
- 0:1fb7b50d16b1
- Child:
- 1:05d2234c0965
File content as of revision 0:1fb7b50d16b1:
#include "TLC5940.h" void setup (SPI &driver, PwmOut &gsclk, PinName xlat, PinName blank, PinName dcprg, PinName vprg, int num_ics) { xlat = 0; // hold GS/DC data constant blank = 1; // Blank (squelch) all outputs dcprg = 1; // dcprg points DC data to DC register. vprg = 0; // sets drivers to GS mode. Set to 1 to change to DC mode gsclk.period_us (1); // set grayscale clock to 1 MHz gsclk = 0.5; // turn on grayscale clock to 50% duty cycle at afore mentioned frequency if (num_ics <= 0) { num_drivers = 1; { else { num_drivers = num_ics; } driver.format (16,0); driver.frequency (30000000); } void update_led (SPI &driver, uint16_t LEDS [][]) { blank = 1; dcprg = 1; vprg = 0; xlat = 0; for (int k = 0; k < num_drivers; k++) { for (int i = 0; i < 16; i++) { driver.write (LEDS [k][i]); } } xlat = 1; xlat = 0; blank = 0; }