aboutsummaryrefslogtreecommitdiffstats
path: root/examples/debug-dtrrts.cpp
diff options
context:
space:
mode:
authorPerry Hung <iperry@gmail.com>2011-03-09 23:25:03 -0500
committerPerry Hung <iperry@gmail.com>2011-03-09 23:25:03 -0500
commit4651227fa9f7dece1dd24d2170db16c2e35dc04e (patch)
tree7e05d637bdca69811f04d6d55b8cc24b8c9e8cc5 /examples/debug-dtrrts.cpp
parent07536e9a1a92af2b1bad8f32b1b0f6b868957d26 (diff)
downloadlibrambutan-4651227fa9f7dece1dd24d2170db16c2e35dc04e.tar.gz
librambutan-4651227fa9f7dece1dd24d2170db16c2e35dc04e.zip
Merge refactor into i2c-wip:
Squashed commit of the following: commit 4d6662dadfda7f2fd55107535165dc98a0638a3c Merge: 174d9ab 7ddc844 Author: Marti Bolivar <mbolivar@leaflabs.com> Date: Fri Mar 4 23:18:29 2011 -0500 Merge remote branch 'origin/refactor' into refactor commit 174d9ab73cc3387a3812e6f3d3e97519bf5b2150 Author: Marti Bolivar <mbolivar@leaflabs.com> Date: Fri Mar 4 23:16:53 2011 -0500 USBSerial docs fix. commit f217acb73d94f0a88bf33a42684e6e988dcb3685 Author: Marti Bolivar <mbolivar@leaflabs.com> Date: Fri Mar 4 20:25:26 2011 -0500 Brought examples/ up to date; PIN_MAP bugfix for D24. commit c4ba3ba05fc39ef260cd80d91759966952df74ae Author: Marti Bolivar <mbolivar@leaflabs.com> Date: Fri Mar 4 19:16:42 2011 -0500 Cosmetic/documentation changes to adc.c commit e7747b4eb831621951deef6d31629f55cb5c3500 Author: Marti Bolivar <mbolivar@leaflabs.com> Date: Fri Mar 4 19:16:07 2011 -0500 Cosmetic changes to wirish/main.cxx commit e2f9d4116e59d8487c936989384228ea084a3501 Author: Marti Bolivar <mbolivar@leaflabs.com> Date: Fri Mar 4 19:15:24 2011 -0500 Untabifying docs/source/conf.py commit 7ddc84481b4eebe337065a0219e3d8dc000791e5 Author: Perry Hung <iperry@gmail.com> Date: Wed Mar 2 00:30:19 2011 -0500 cscope: Find .S instead of .s files commit 62cb09ed6357eae58b0234fbc074c44e9c0aa5e5 Author: Marti Bolivar <mbolivar@leaflabs.com> Date: Wed Mar 2 00:07:10 2011 -0500 Fixing typo in main.cpp.example.
Diffstat (limited to 'examples/debug-dtrrts.cpp')
-rw-r--r--examples/debug-dtrrts.cpp23
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) {