aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-06-15 16:59:22 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-09-24 16:01:47 -0400
commit5b6bfdf598f975b26d6d0cbdced53d1b5d308cc7 (patch)
tree00057dccbbd91f5a8cce7459b8a1208c11c98d94
parent80b52e0da53ff7e63098e9f6fc6e3ffe2a99b547 (diff)
downloadlibrambutan-5b6bfdf598f975b26d6d0cbdced53d1b5d308cc7.tar.gz
librambutan-5b6bfdf598f975b26d6d0cbdced53d1b5d308cc7.zip
test-session: Add test case for disabling USB.
This replaces the previously undocumented 'd' option, which tested the pin mode INPUT_PULLDOWN. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
-rw-r--r--examples/test-session.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/examples/test-session.cpp b/examples/test-session.cpp
index 59d8ac0..6c7cfff 100644
--- a/examples/test-session.cpp
+++ b/examples/test-session.cpp
@@ -126,6 +126,15 @@ void loop () {
}
break;
+ case 'd':
+ SerialUSB.println("Disabling USB. Press BUT to re-enable.");
+ SerialUSB.end();
+ pinMode(BOARD_BUTTON_PIN, INPUT);
+ while (!isButtonPressed())
+ ;
+ SerialUSB.begin();
+ break;
+
case 'n':
cmd_adc_stats();
break;
@@ -206,19 +215,6 @@ void loop () {
cmd_servo_sweep();
break;
- case 'd':
- SerialUSB.println("Pulling down D4, D22. Press any key.");
- pinMode(22, INPUT_PULLDOWN);
- pinMode(4, INPUT_PULLDOWN);
- SerialUSB.read();
- SerialUSB.println("Pulling up D4, D22. Press any key.");
- pinMode(22, INPUT_PULLUP);
- pinMode(4, INPUT_PULLUP);
- SerialUSB.read();
- pinMode(22, OUTPUT);
- pinMode(4, OUTPUT);
- break;
-
// Be sure to update cmd_print_help() if you implement these:
case 'i': // TODO
@@ -261,6 +257,7 @@ void cmd_print_help(void) {
SerialUSB.println("");
SerialUSB.println("Command Listing");
SerialUSB.println("\t?: print this menu");
+ SerialUSB.println("\td: Disable SerialUSB (press button to re-enable)");
SerialUSB.println("\th: print this menu");
SerialUSB.println("\tw: print Hello World on all 3 USARTS");
SerialUSB.println("\tn: measure noise and do statistics");