diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-03-06 07:54:55 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-03-06 07:54:55 +0100 |
commit | d1668a6fc12062c2c180534e7825910e6fcb05b0 (patch) | |
tree | 3ea0b93e1f0b22d1dc8c7d6fea9c78cab348bb60 /src/app/countertest/main.cc | |
parent | be3efdeb8840fb7cdf5c4d2f014e321a4bfe8bcd (diff) |
add counter test application
Diffstat (limited to 'src/app/countertest/main.cc')
-rw-r--r-- | src/app/countertest/main.cc | 60 |
1 files changed, 60 insertions, 0 deletions
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; +} |