summaryrefslogtreecommitdiff
path: root/src/main.cc
blob: aefad1c1545180657bae90d3d4ec904dec49b469 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
#include <util/delay.h>
#include <stdlib.h>

#include "display.h"
#include "font.h"
#include "modem.h"
#include "system.h"

int main (void)
{
	// disable ADC to save power
	PRR |= _BV(PRADC);

	// dito
	wdt_disable();

	// Enable pull-ups on PC3 and PC7 (button pins)
	PORTC |= _BV(PC3) | _BV(PC7);

	display.setString("Ohai! ");

	display.enable();
	modem.enable();

	sei();

	while (1) {
		// 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();
	}

	return 0;
}