summaryrefslogtreecommitdiff
path: root/src/app/energybench/main.cc
blob: 59a775e791a912519420c3dc4c8a6c11cd313450 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include "arch.h"
#include "driver/gpio.h"
#include "driver/stdout.h"
#include "driver/uptime.h"

#ifndef TIMER_CYCLES
#error makeflag timer_cycles=1 required
#endif

void loop(void)
{
#if 0
	static unsigned char i = 0;

	switch (i) {
		case 0:
			gpio.led_on(0);
			gpio.led_off(0);
			break;
		case 1:
			gpio.led_on(0);
			arch.delay_us(1);
			gpio.led_off(0);
			break;
		case 2:
			gpio.led_on(0);
			arch.delay_us(2);
			gpio.led_off(0);
			break;
		case 3:
			gpio.led_on(1);
			gpio.led_off(1);
			break;
		case 4:
			gpio.led_on(1);
			arch.delay_us(1);
			gpio.led_off(1);
			break;
		case 5:
			gpio.led_on(1);
			arch.delay_us(2);
			gpio.led_off(1);
			break;
		case 6:
			gpio.led_on(0);
			break;
		case 7:
			gpio.led_off(0);
			break;
		case 8:
			gpio.led_on(1);
			break;
		case 9:
			gpio.led_off(1);
			break;
		default:
			break;
	}
	

	i = (i+1) % 10;
#endif
}

int main(void)
{
	arch.setup();
	gpio.setup();
	kout.setup();

	kout << "Hello, World!" << endl;
	kout << "Test, World!" << endl;
	kout << dec << uptime.get_cycles() << endl;
	kout << dec << uptime.get_cycles() << endl;
	kout << dec << uptime.get_cycles() << endl;
	kout << dec << uptime.get_cycles() << endl;

	arch.idle_loop();

	return 0;
}