changed flush function in led1642gw, hope this is easier to understand

This commit is contained in:
Stefan Rupp 2015-01-05 04:17:07 +01:00
parent d6cce7d39c
commit 60d4bee9a6

View File

@ -209,7 +209,7 @@ void led1642gw_flush(void)
uint8_t ic;
// for each of the first 15 channels, do the following:
for (channel=0; channel<NUM_LED1642GW_CHANNELS-1; channel++) {
for (channel=0; channel<NUM_LED1642GW_CHANNELS; channel++) {
// shift data throught the first n-1 ICs with write_no_command
for (ic=0; ic<(NUM_LED1642GW_ICs-1); ic++) {
write_no_command(ledbuffer[channel+(NUM_LED1642GW_CHANNELS*ic)]);
@ -217,19 +217,17 @@ void led1642gw_flush(void)
// then, when the brightness data has propagated through the
// shift registers, write all data into the DATA LATCH of
// all of the ICs.
write_data_latch(ledbuffer[channel+(NUM_LED1642GW_CHANNELS*ic)]);
}
// for the 16th channel, we don't write to the DATA LATCH, but
// to the CLOBAL data latch.
// once more, we do the trick with write_no_command, to
// shift data through all the ICs
for (ic=1; ic<NUM_LED1642GW_ICs; ic++) {
write_no_command(ledbuffer[(ic*NUM_LED1642GW_CHANNELS)-1]);
if (channel <= NUM_LED1642GW_CHANNELS-1) {
write_data_latch(ledbuffer[channel+(NUM_LED1642GW_CHANNELS*ic)]);
}
// than, at last, write data to the global latch, to force
// the ICs to update their brightness data from the DATA LATCHES.
else {
write_global_latch(ledbuffer[(ic*NUM_LED1642GW_CHANNELS)-1]);
}
}
}