Library for TLC5940 16-channel PWM chip

I'm trying to fade multiple LEDs, independently, and at different rates. Is it possible to have the TLC5940 (or the arduino, for that matter) to run a series of "analogWrite" commands independently?

In other words, send one "fade channel0 from 4095 to 0 in 5000ms" and, before it's finished, send "fade channel1 from 0 to 4095 in 2500ms".

I know I could chain them together, so that as soon as channel0 finishes its fade, channel1 would begin...but that's not what I'm aiming for.

I'm writing some improvements this weekend that changes to the way the library handles the BLANK pulses, and I think it would be pretty easy to add fading too:

  1. When we pulse BLANK, check to see if any fades should happen, and calculate the PWM output
  2. set an "updated" flag or something to let the user know they should call updatePWMs(). <- I don't think you could call updatePWMs() in 1. because it would put too much code in an interrupt, breaking Serial and stuff

The changes I'm making to the way BLANK pulses:

  • Instead of outputting BLANK as a PWM on TIMER1, use TIMER1 to count GSCLK pulses and call an interrupt to pulse BLANK.