diff options
author | bryan newbold <bnewbold@robocracy.org> | 2014-10-16 20:20:20 -0700 |
---|---|---|
committer | bryan newbold <bnewbold@robocracy.org> | 2014-10-16 20:20:20 -0700 |
commit | dba5a9fe68ebb996eeee69fa9b573fe5a1561ce2 (patch) | |
tree | 6d9c249686b81b2b70da9b9a3dd1e246c221b4b3 /examples/test-systick.cpp | |
parent | 160d861ba3fe50c30891d1abcb2c520be84aaa85 (diff) | |
download | librambutan-dba5a9fe68ebb996eeee69fa9b573fe5a1561ce2.tar.gz librambutan-dba5a9fe68ebb996eeee69fa9b573fe5a1561ce2.zip |
refactor: move test-style examples to ./tests
Diffstat (limited to 'examples/test-systick.cpp')
-rw-r--r-- | examples/test-systick.cpp | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/examples/test-systick.cpp b/examples/test-systick.cpp deleted file mode 100644 index 356f302..0000000 --- a/examples/test-systick.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// Tests the SysTick enable/disable functions - -#include <wirish/wirish.h> -#include <libmaple/systick.h> - -void setup() { - pinMode(BOARD_LED_PIN, OUTPUT); - pinMode(BOARD_BUTTON_PIN, INPUT); -} - -bool disable = true; -long time = 0; - -void loop() { - volatile int i = 0; - toggleLED(); - - // An artificial delay - for(i = 0; i < 150000; i++) - ; - - if (isButtonPressed()) { - if (disable) { - systick_disable(); - SerialUSB.println("Disabling SysTick"); - } else { - SerialUSB.println("Re-enabling SysTick"); - systick_enable(); - } - disable = !disable; - } - - SerialUSB.println(millis()); -} - -// Force init to be called *first*, i.e. before static object allocation. -// Otherwise, statically allocated object that need libmaple may fail. -__attribute__((constructor)) void premain() { - init(); -} - -int main(void) { - setup(); - - while (true) { - loop(); - } - return 0; -} |