summaryrefslogtreecommitdiff
path: root/src/app/countertest
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-03-06 07:54:55 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-03-06 07:54:55 +0100
commitd1668a6fc12062c2c180534e7825910e6fcb05b0 (patch)
tree3ea0b93e1f0b22d1dc8c7d6fea9c78cab348bb60 /src/app/countertest
parentbe3efdeb8840fb7cdf5c4d2f014e321a4bfe8bcd (diff)
add counter test application
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;
+}