Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SX1276GenericLib by
Diff: Arduino-mbed-APIs/arduino-mbed.cpp
- Revision:
- 93:c328629726a6
- Parent:
- 90:d98572047c9c
- Child:
- 96:9da7e00c9d0f
--- a/Arduino-mbed-APIs/arduino-mbed.cpp Tue Oct 24 20:02:42 2017 +0200 +++ b/Arduino-mbed-APIs/arduino-mbed.cpp Tue Oct 24 20:05:16 2017 +0200 @@ -14,7 +14,7 @@ Stream *ser; bool SerialUSB_active; -void InitSerial(Stream *serial, int timeout_ms, DigitalOut *led) { +void InitSerial(Stream *serial, int timeout_ms, DigitalOut *led, bool waitForSerial) { ser = serial; SerialUSB_active = true; if (!timeout_ms) @@ -23,6 +23,16 @@ uint32_t start = ms_getTicker(); SerialUSB_active = true; + + if (waitForSerial) { + while(!SerialUSB) { + *led = 1; + delay(80); + *led = 0; + delay(80); + } + return; + } while(!SerialUSB) { if (ms_getTicker() > start + timeout_ms) { SerialUSB_active = false; @@ -288,10 +298,11 @@ uint32_t ms_getTicker(void) { - uint32_t us = us_getTicker(); + long long ns = ns_getTicker(); + ns /= (long long)1000000; // to ms - us /= 1000; // to ms - return us; + uint32_t ms = ns & 0xffffffff; + return ms; } uint32_t us_getTicker(void)