Lora support for the STM B_L072Z_LRWAN1 board out of the box. Also supports HopeRF RFM95, Murata CMWX1ZZABZ and Semtech SX1276MB1MAS/SX1276MB1LAS modules.
Dependencies: BufferedSerial SX1276GenericLib mbed USBDeviceHT
Revision 20:a1029437adca, committed 2018-06-03
- Comitter:
- Helmut64
- Date:
- Sun Jun 03 19:25:37 2018 +0000
- Parent:
- 19:992eda680d91
- Commit message:
- When USB is active we keep a Timer running to avoid deepsleep.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
utils.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 992eda680d91 -r a1029437adca main.cpp --- a/main.cpp Sun Jun 03 18:33:17 2018 +0000 +++ b/main.cpp Sun Jun 03 19:25:37 2018 +0000 @@ -7,14 +7,7 @@ DigitalOut led(LED); -DigitalOut led2(LED2); -Timeout tim; -void ledBlink(void) -{ - tim.attach(callback(&ledBlink), 0.200); - led2 = !led2; -} int main() { /* @@ -27,7 +20,6 @@ dprintf("Welcome to the SX1276GenericLib"); dprintf("Starting a simple LoRa PingPong"); - ledBlink(); SX1276PingPong(); }
diff -r 992eda680d91 -r a1029437adca utils.cpp --- a/utils.cpp Sun Jun 03 18:33:17 2018 +0000 +++ b/utils.cpp Sun Jun 03 19:25:37 2018 +0000 @@ -12,6 +12,19 @@ #endif bool _useDprintf; +/* + * keep a timer running to avoid USB hangup in sleep, + * in newer mbed versions sleep calls deepsleep which may + * hangup the USBSerial. + * For this reason we keep a timer pending which avoids deepsleep. + */ +static Timeout busyTimer; + +void busyTimerFunc(void) +{ + busyTimer.attach(callback(&busyTimerFunc), 300); +} + void InitSerial(int timeout, DigitalOut *led) { _useDprintf = true; @@ -39,6 +52,7 @@ return; } } + busyTimerFunc(); return; } else { #else