This commit is contained in:
Stefan Rupp 2015-01-05 04:17:42 +01:00
commit 46bb236221

View File

@ -209,27 +209,25 @@ void led1642gw_flush(void)
uint8_t ic; uint8_t ic;
// for each of the first 15 channels, do the following: // 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 // shift data throught the first n-1 ICs with write_no_command
for (ic=0; ic<(NUM_LED1642GW_ICs-1); ic++) { for (ic=0; ic<(NUM_LED1642GW_ICs-1); ic++) {
write_no_command(ledbuffer[channel+(NUM_LED1642GW_CHANNELS*ic)]); write_no_command(ledbuffer[channel+(NUM_LED1642GW_CHANNELS*ic)]);
} }
// then, when the brightness data has propagated through the // then, when the brightness data has propagated through the
// shift registers, write all data into the DATA LATCH of // shift registers, write all data into the DATA LATCH of
// all of the ICs. // 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
if (channel <= NUM_LED1642GW_CHANNELS-1) {
write_data_latch(ledbuffer[channel+(NUM_LED1642GW_CHANNELS*ic)]);
}
else {
write_global_latch(ledbuffer[(ic*NUM_LED1642GW_CHANNELS)-1]);
}
} }
// 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]);
}
// than, at last, write data to the global latch, to force
// the ICs to update their brightness data from the DATA LATCHES.
write_global_latch(ledbuffer[(ic*NUM_LED1642GW_CHANNELS)-1]);
} }