From 5b6bfdf598f975b26d6d0cbdced53d1b5d308cc7 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Wed, 15 Jun 2011 16:59:22 -0400 Subject: 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 --- examples/test-session.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'examples') 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"); -- cgit v1.2.3