improved led ordering

This commit is contained in:
Stefan Rupp 2014-03-13 02:05:24 +01:00
parent a98b779412
commit 3bf2dafcbf
2 changed files with 6 additions and 65 deletions

View File

@ -54,36 +54,6 @@ static int8_t map_lednum_to_channels(uint8_t lednum, uint8_t *channel_r, uint8_t
return ret;
}
#if 0
static void write_data(uint16_t data, uint8_t le_clocks)
{
PORTC &= ~(1<<PC3);
PORTC &= ~(1<<PC2);
uint16_t mask = 0x8000;
int8_t bit;
for (bit=15; bit>=le_clocks; bit--) {
if(data&mask) { PORTC |= (1<<PC4); }
else { PORTC &= ~(1<<PC4); }
_NOP();
PORTC |= (1<<PC3);
mask >>= 1;
PORTC &= ~(1<<PC3);
_NOP();
}
PORTC |= (1<<PC2);
for (/*noting to initialize*/; bit>=0; bit--) {
if(data&mask) { PORTC |= (1<<PC4); }
else { PORTC &= ~(1<<PC4); }
_NOP();
PORTC |= (1<<PC3);
mask >>= 1;
PORTC &= ~(1<<PC3);
_NOP();
}
PORTC &= ~(1<<PC3);
}
#endif
static void write_data(uint16_t data, uint8_t le_clocks)
{
@ -179,28 +149,17 @@ void led_set(uint8_t lednum, uint16_t red, uint16_t green, uint16_t blue)
}
#if 0
void led_flush(void)
{
for (uint8_t i=0; i<NUM_LED_CHANNELS-1; i++) {
write_data_latch(ledbuffer[i]);
_delay_us(10);
}
write_global_latch(ledbuffer[NUM_LED_CHANNELS-1]);
}
#endif
void led_flush(void)
{
uint8_t channel;
for (channel=0; channel<NUM_LED1642GW_CHANNELS-1; channel++) {
write_no_command(ledbuffer[3*channel+0]);
write_no_command(ledbuffer[3*channel+1]);
write_data_latch(ledbuffer[3*channel+2]);
write_no_command(ledbuffer[channel+0]);
write_no_command(ledbuffer[channel+16]);
write_data_latch(ledbuffer[channel+32]);
}
write_no_command(ledbuffer[3*channel+0]);
write_no_command(ledbuffer[3*channel+1]);
write_global_latch(ledbuffer[3*channel+2]);
write_no_command(ledbuffer[NUM_LED1642GW_CHANNELS-3]);
write_no_command(ledbuffer[NUM_LED1642GW_CHANNELS-2]);
write_global_latch(ledbuffer[NUM_LED1642GW_CHANNELS-1]);
}

View File

@ -22,24 +22,6 @@ void rgbyteclock(void)
ledcontroller_turn_all_on();
while (1) {
//led_set(11, 0x7ff, 0x00, 0x00);
for (int c=0; c<48; c++) {
//PORTC ^= (1<<PC5);
ledcontroller_set_channel(c, 0x7ff);
led_flush();
timer_wait(1000);
}
for (int i=0; i<16; i++) {
led_set(i, 0x00, 0x00, 0x00);
}
led_flush();
timer_wait(100);
}
while (1) {
PORTC ^= (1<<PC5);
for (int i=0; i<15; i++) {