diff --git a/tron-bag/main.c b/tron-bag/main.c index 55b10ab..4dc4390 100644 --- a/tron-bag/main.c +++ b/tron-bag/main.c @@ -2,24 +2,10 @@ #include #include -/* -#include -AVR_MCU(F_CPU, "attiny85"); - -const struct avr_mmcu_vcd_trace_t _mytrace[] _MMCU_ = { - { AVR_MCU_VCD_SYMBOL("GTCCR"), .what = (void *)>CCR, }, - { AVR_MCU_VCD_SYMBOL("TCCR0A"), .what = (void *)&TCCR0A, }, - { AVR_MCU_VCD_SYMBOL("TCCR0B"), .what = (void *)&TCCR0B, }, - { AVR_MCU_VCD_SYMBOL("PORTB"), .what = (void *)&PORTB, }, - { AVR_MCU_VCD_SYMBOL("TCNT0"), .what = (void *)&TCNT0, }, -}; -*/ - #define FPS 10 #define FPS_MS 1000 / FPS #define MULT 5 -/* typedef struct { uint8_t value; int8_t inc; @@ -39,26 +25,26 @@ void counter_update(counter_t *self) { self->value = value; } } -*/ int main(void) { DDRB = 0xff; PORTB = 0; + GTCCR = 0; TCCR0A = _BV(COM0A1) | _BV(COM0B1) | _BV(WGM01) | _BV(WGM00); TCCR0B = _BV(CS00); - uint8_t brightness = 1; - - GTCCR = 0; + counter_t red = (counter_t){ .value = 128, .inc = 1 }; + counter_t blue = (counter_t){ .value = 0, .inc = 1 }; while(1) { - OCR0A = brightness; - OCR0B = brightness; + OCR0A = red.value; + OCR0B = blue.value; - _delay_ms(100); + _delay_ms(10); - brightness += 1; + counter_update(&red); + counter_update(&blue); } return 0;