one more pattern

This commit is contained in:
Stefan Rupp 2014-03-14 22:05:42 +01:00
parent 0938c1025e
commit c39347c317
3 changed files with 45 additions and 5 deletions

View File

@ -49,5 +49,5 @@ bin: $(PRG).bin
$(OBJCOPY) -j .text -j .data -O binary $< $@ $(OBJCOPY) -j .text -j .data -O binary $< $@
prg: $(PRG).bin prg: $(PRG).bin
python2 ../megaHidProg/megaHidProg.py -C -c 1000 -t 4 -b $(PRG).bin python2 megaHidProg.py -C -c 1000 -t 4 -b $(PRG).bin

10
main.c
View File

@ -28,12 +28,16 @@ int main(void)
ledcontroller_init(); ledcontroller_init();
sei(); sei();
//lcd_init(); lcd_init();
DDRC |= (1<<PC5); // Test LED DDRC |= (1<<PC5); // Test LED
//DDRD |= (1<<PD4); // Backlight DDRD |= (1<<PD4); // Backlight
//PORTD |= (1<<PD4); PORTD |= (1<<PD4);
lcd_puts("RGByteclock");
lcd_locate(1,0);
lcd_puts("www.bytewerk.org");
/* /*
while (1) { while (1) {

View File

@ -54,6 +54,41 @@ void rgbyteclock_rounds(void)
} }
void rgbyteclock_rounds_colored(void)
{
uint16_t brightness = 0x00ff;
uint8_t color_start = 0;
uint8_t color;
while (1) {
color_start++;
if (color_start > 2) { color_start = 0; }
color = color_start;
for (int led=0; led<12; led++) {
color++;
switch (color) {
case 1:
led_set(led, 0x00, brightness, 0x00);
break;
case 2:
led_set(led, 0x00, 0x00, brightness);
break;
default:
color = 0;
led_set(led, brightness, 0x00, 0x00);
break;
}
led_flush();
timer_wait(5);
}
brightness = brightness + brightness/20;
if (brightness > 0x4fff) {
brightness = 0xff;
}
}
}
void rgbyteclock_secwatch(void) void rgbyteclock_secwatch(void)
{ {
uint8_t hours, mins; uint8_t hours, mins;
@ -143,6 +178,7 @@ void rgbyteclock_secwatch_glide(void)
void rgbyteclock(void) void rgbyteclock(void)
{ {
//rgbyteclock_rounds(); //rgbyteclock_rounds();
rgbyteclock_rounds_colored();
//rgbyteclock_secwatch(); //rgbyteclock_secwatch();
rgbyteclock_secwatch_glide(); //rgbyteclock_secwatch_glide();
} }