diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2011-03-04 20:25:26 -0500 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2011-03-08 13:43:41 -0500 |
commit | 8863418f0595c8dfd7d01081be941541539827bb (patch) | |
tree | 94b86a04e6808df1390e88d809dd54c9aa8edccb /examples/debug-dtrrts.cpp | |
parent | 8241a4c640d036faa148350219ad3deea72a23c2 (diff) | |
download | librambutan-8863418f0595c8dfd7d01081be941541539827bb.tar.gz librambutan-8863418f0595c8dfd7d01081be941541539827bb.zip |
Brought examples/ up to date; PIN_MAP bugfix for D24.
(Cherry-pick from refactor with some modifications).
Diffstat (limited to 'examples/debug-dtrrts.cpp')
-rw-r--r-- | examples/debug-dtrrts.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/examples/debug-dtrrts.cpp b/examples/debug-dtrrts.cpp index f9f8b96..61c061a 100644 --- a/examples/debug-dtrrts.cpp +++ b/examples/debug-dtrrts.cpp @@ -1,14 +1,12 @@ -// Sample main.cpp file. Blinks an LED, sends a message out USART2 -// and turns on PWM on pin 2 +// Test sketch for figuring out DTR/RTS behavior on different platforms. #include "wirish.h" #include "usb.h" -#define LED_PIN 13 -#define PWM_PIN 2 +#define LED_PIN BOARD_LED_PIN +#define PWM_PIN 2 -void setup() -{ +void setup() { /* Set up the LED to blink */ pinMode(LED_PIN, OUTPUT); @@ -18,12 +16,10 @@ void setup() } -int toggle = 0; - void loop() { - toggle ^= 1; - digitalWrite(LED_PIN, toggle); + toggleLED(); delay(100); + Serial2.print("DTR: "); Serial2.print(usbGetDTR(), DEC); Serial2.print("\tRTS: "); @@ -31,13 +27,12 @@ void loop() { } // 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() { +// Otherwise, statically allocated objects that need libmaple may fail. +__attribute__((constructor)) void premain() { init(); } -int main(void) -{ +int main(void) { setup(); while (1) { |