From a557014d95ffa4df0a752f13b0f1bbbf259fc5a5 Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 7 Mar 2020 17:19:56 +0700 Subject: [PATCH] skip wait for Serial in bleuart sketch --- cores/nRF5/main.cpp | 12 +++++++++--- .../examples/Peripheral/bleuart/bleuart.ino | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cores/nRF5/main.cpp b/cores/nRF5/main.cpp index f621e918..fc190f04 100644 --- a/cores/nRF5/main.cpp +++ b/cores/nRF5/main.cpp @@ -44,13 +44,19 @@ static void loop_task(void* arg) { (void) arg; - setup(); - #if CFG_DEBUG // If Serial is not begin(), call it to avoid hard fault if ( !Serial ) Serial.begin(115200); + + // Wait for Serial connection in debug mode + while ( !Serial ) yield(); + dbgPrintVersion(); - // dbgMemInfo(); +#endif + + setup(); + +#if CFG_DEBUG Bluefruit_printInfo(); #endif diff --git a/libraries/Bluefruit52Lib/examples/Peripheral/bleuart/bleuart.ino b/libraries/Bluefruit52Lib/examples/Peripheral/bleuart/bleuart.ino index b1624fa4..739ff03c 100644 --- a/libraries/Bluefruit52Lib/examples/Peripheral/bleuart/bleuart.ino +++ b/libraries/Bluefruit52Lib/examples/Peripheral/bleuart/bleuart.ino @@ -24,7 +24,7 @@ BLEBas blebas; // battery void setup() { Serial.begin(115200); - while ( !Serial ) delay(10); // for nrf52840 with native usb +// while ( !Serial ) delay(10); // for nrf52840 with native usb Serial.println("Bluefruit52 BLEUART Example"); Serial.println("---------------------------\n");