summaryrefslogtreecommitdiff
path: root/src/app/countertest/main.cc
blob: ad560e57a9ad9e7b384ebfcabad1d77f9791ae5b (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
#include "arch.h"
#include "driver/gpio.h"
#include "driver/stdout.h"
#include "driver/counter.h"

void loop(void)
{
	counter.start();
	counter.stop();
	kout << "nop: " << counter.value << "/" << counter.overflow << endl;

	counter.start();
	arch.delay_us(10);
	counter.stop();
	kout << "10us: " << counter.value << "/" << counter.overflow << endl;

	counter.start();
	arch.delay_us(20);
	counter.stop();
	kout << "20us: " << counter.value << "/" << counter.overflow << endl;

	counter.start();
	arch.delay_ms(1);
	counter.stop();
	kout << "1ms: " << counter.value << "/" << counter.overflow << endl;

	counter.start();
	arch.delay_ms(2);
	counter.stop();
	kout << "2ms: " << counter.value << "/" << counter.overflow << endl;

	counter.start();
	arch.delay_ms(4);
	counter.stop();
	kout << "4ms: " << counter.value << "/" << counter.overflow << endl;

	counter.start();
	arch.delay_ms(8);
	counter.stop();
	kout << "8ms: " << counter.value << "/" << counter.overflow << endl;

	counter.start();
	arch.delay_ms(16);
	counter.stop();
	kout << "16ms: " << counter.value << "/" << counter.overflow << endl;

	counter.start();
	arch.delay_ms(32);
	counter.stop();
	kout << "32ms: " << counter.value << "/" << counter.overflow << endl;
}

int main(void)
{
	arch.setup();
	gpio.setup();
	kout.setup();
	arch.idle_loop();
	return 0;
}