summaryrefslogtreecommitdiff
path: root/src/app/countertest
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/countertest')
-rw-r--r--src/app/countertest/Makefile.inc2
-rw-r--r--src/app/countertest/main.cc60
2 files changed, 62 insertions, 0 deletions
diff --git a/src/app/countertest/Makefile.inc b/src/app/countertest/Makefile.inc
new file mode 100644
index 0000000..7e15c58
--- /dev/null
+++ b/src/app/countertest/Makefile.inc
@@ -0,0 +1,2 @@
+loop ?= 1
+arch_drivers += ,counter
diff --git a/src/app/countertest/main.cc b/src/app/countertest/main.cc
new file mode 100644
index 0000000..85ac7ce
--- /dev/null
+++ b/src/app/countertest/main.cc
@@ -0,0 +1,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_ms(1);
+ counter.stop();
+ kout << "1ms: " << 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(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;
+}