diff options
Diffstat (limited to 'src/app/energybench')
-rw-r--r-- | src/app/energybench/Makefile.inc | 2 | ||||
-rw-r--r-- | src/app/energybench/main.cc | 81 |
2 files changed, 83 insertions, 0 deletions
diff --git a/src/app/energybench/Makefile.inc b/src/app/energybench/Makefile.inc new file mode 100644 index 0000000..d7dcd37 --- /dev/null +++ b/src/app/energybench/Makefile.inc @@ -0,0 +1,2 @@ +timer_cycles ?= 1 +loop ?= 1 diff --git a/src/app/energybench/main.cc b/src/app/energybench/main.cc new file mode 100644 index 0000000..59a775e --- /dev/null +++ b/src/app/energybench/main.cc @@ -0,0 +1,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; +} |