Die TLC Bibliothek nutzt die verfügbaren Timer-Resourcen des ATmega328 ziemlich aus, Umstellungen der Timer sind nicht so einfach möglich. Da nur Timer1 zwei Output Compare Register und ein konfigurierbares TOP hat, können die Timer1 und Timer2 nicht einfach getauscht werden.
Aufgrund des Timing-Diagrams im Datasheet könnte aber der Trick mit der ISR funktionieren.
In Tlc5940.cpp muss die ISR angepasst werden:
/** Interrupt for XLAT pulses and BLANK line */
ISR(TIMER1_OVF_vect)
{
BLANK_PORT |= _BV(BLANK_PIN);
if (tlc_needXLAT) {
XLAT_PORT |= _BV(XLAT_PIN);
XLAT_PORT &= ~_BV(XLAT_PIN);
}
tlc_needXLAT = 0;
BLANK_PORT &= ~_BV(BLANK_PIN);
if (tlc_onUpdateFinished) {
sei();
tlc_onUpdateFinished();
}
}
in der selben Datei die Initialisierung:
setAll(initialValue);
update();
disable_XLAT_pulses();
set_XLAT_interrupt();
tlc_needXLAT = 0;
pulse_pin(XLAT_PORT, XLAT_PIN);
/* Timer Setup */
/* Timer 1 - BLANK / XLAT */
TCCR1A = 0; // no output on OC1B, BLANK and XLAT is handled in ISR
TCCR1B = _BV(WGM13); // Phase/freq correct PWM, ICR1 top
ICR1 = TLC_PWM_PERIOD; // see tlc_config.h
in Tcl5940.h muss dafür gesorgt werden, dass der Interrupt immer ausgeführt wird:
/** Enables the Timer1 Overflow interrupt, which will fire after an XLAT
pulse */
#define set_XLAT_interrupt() TIFR1 |= _BV(TOV1); TIMSK1 = _BV(TOIE1)
/** Disables any Timer1 interrupts */
#define clear_XLAT_interrupt()
#endif
/** Enables the output of XLAT pulses */
#define enable_XLAT_pulses()
/** Disables the output of XLAT pulses */
#define disable_XLAT_pulses()
Das Timing auf dem BLANK-Ausgang ändert sich zwar geringfügig, aber einen Versuch ist es wert. Wenn ich nichts übersehen habe, könnte es funktionieren. Du solltest dann die Pins XLAT und BLANK auch frei definieren können. Der Nachteil: Du hast deutlich mehr Interrupts, der Prozessor ist also etwas mehr beschäftigt.