diff options
Diffstat (limited to 'examples/blinky.cpp')
-rw-r--r-- | examples/blinky.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/examples/blinky.cpp b/examples/blinky.cpp index 91d1a47..dd72514 100644 --- a/examples/blinky.cpp +++ b/examples/blinky.cpp @@ -1,32 +1,32 @@ -// Blinks the built-in LED
-
-#include "wirish.h"
-
-void setup() {
- pinMode(BOARD_LED_PIN, OUTPUT);
-}
-
-int toggle = 1;
-
-void loop() {
- // You could just use toggleLED() instead, but this illustrates
- // the use of digitalWrite():
- digitalWrite(BOARD_LED_PIN, toggle);
- toggle ^= 1;
- delay(100);
-}
-
-// Force init to be called *first*, i.e. before static object allocation.
-// Otherwise, statically allocated objects that need libmaple may fail.
-__attribute__((constructor)) void premain() {
- init();
-}
-
-int main(void) {
- setup();
-
- while (true) {
- loop();
- }
- return 0;
-}
+// Blinks the built-in LED + +#include "wirish.h" + +void setup() { + pinMode(BOARD_LED_PIN, OUTPUT); +} + +int toggle = 1; + +void loop() { + // You could just use toggleLED() instead, but this illustrates + // the use of digitalWrite(): + digitalWrite(BOARD_LED_PIN, toggle); + toggle ^= 1; + delay(100); +} + +// Force init to be called *first*, i.e. before static object allocation. +// Otherwise, statically allocated objects that need libmaple may fail. +__attribute__((constructor)) void premain() { + init(); +} + +int main(void) { + setup(); + + while (true) { + loop(); + } + return 0; +} |