diff --git a/cores/nRF5/wiring.h b/cores/nRF5/wiring.h index ac87c7b3..bf802e4c 100644 --- a/cores/nRF5/wiring.h +++ b/cores/nRF5/wiring.h @@ -24,6 +24,11 @@ extern "C" { extern void init(void); +static inline void sleep(void) +{ + __WFE(); +} + extern void enterSerialDfu(void); extern void enterOTADfu(void); diff --git a/libraries/Bluefruit52Lib/examples/Peripheral/bleuart/bleuart.ino b/libraries/Bluefruit52Lib/examples/Peripheral/bleuart/bleuart.ino index 6d13bf1c..ff1d4b8f 100644 --- a/libraries/Bluefruit52Lib/examples/Peripheral/bleuart/bleuart.ino +++ b/libraries/Bluefruit52Lib/examples/Peripheral/bleuart/bleuart.ino @@ -87,7 +87,7 @@ void loop() } // forward from Serial to BLEUART - if (Serial.available()) + while (Serial.available()) { // delay to get enough inputs, since we have limited number of transmission buffer delay(2); @@ -98,12 +98,14 @@ void loop() } // forward from BLEUART to Serial - if ( bleuart.available() ) + while ( bleuart.available() ) { uint8_t ch; ch = (uint8_t) bleuart.read(); Serial.write(ch); } + + sleep(); } void connect_callback(void)