summaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-01-16 18:55:40 +0100
committerDaniel Friesel <derf@finalrewind.org>2016-01-16 18:55:40 +0100
commitcd52b9a6b0272466f414ce4802ce50a0ec38dd29 (patch)
treeb68e8c8910053165322ed150a88f7047532acf19 /src/main.cc
parent69b343aac3dce2ac87830ce5181eea8d11144de2 (diff)
display: rename turn_on/off to enable/disable, move setup code from main to enable
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/main.cc b/src/main.cc
index ac8b68a..fbb40c9 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -19,20 +19,9 @@ int main (void)
// dito
wdt_disable();
- // Ports B and D drive the dot matrix display -> set all as output
- DDRB = 0xff;
- DDRD = 0xff;
- PORTB = 0;
- PORTD = 0;
-
// Enable pull-ups on PC3 and PC7 (button pins)
PORTC |= _BV(PC3) | _BV(PC7);
- // Enable 8bit counter with prescaler=8 (-> timer frequency = 1MHz)
- TCCR0A = _BV(CS01);
- // raise timer interrupt on counter overflow (-> interrupt frequency = ~4kHz)
- TIMSK0 = _BV(TOIE0);
-
disp[0] = 0x01;
disp[1] = 0x02;
disp[2] = 0x04;
@@ -78,6 +67,7 @@ int main (void)
disp[31] = 0x00;
#endif
+ display.enable();
modem.enable();
sei();
@@ -86,6 +76,8 @@ int main (void)
// nothing to do here, go to idle to save power
SMCR = _BV(SE);
asm("sleep");
+ // The display timer causes a wakeup after 256µs. Run the system
+ // loop after the timer's ISR is done.
rocket.loop();
}