An example project for the Heltec Turtle LoRa board (STM32L4 and SX1276 chips). The projects is only supported for the Nucleo-L432KC board platform in the mbed online and offline compiler environment. Visit www.radioshuttle.de (choose Turtle board) for instructions. Note that most source files and libraries are open source, however some files especially the RadioShuttle core protocol is copyrighted work. Check header for details.
Dependencies: mbed BufferedSerial SX1276GenericLib OLED_SSD1306 HELIOS_Si7021 NVProperty RadioShuttle-STM32L4 USBDeviceHT
Revision 45:22bb680cad5a, committed 2019-02-24
- Comitter:
- Helmut Tschemernjak
- Date:
- Sun Feb 24 14:57:36 2019 +0100
- Parent:
- 44:cda7bca43f3b
- Child:
- 46:a9241f24f4b7
- Commit message:
- Added support that InitSerial gets the intr pointer to allow
to about 30 seconds USB waiting when a user clicks the user
button
The main loop does not need to avoid sleeps on active USB
connections because USB CDC will use the sleep manager to
indicate active CDC sessions to avoid deespsleep().
Updated USBDeviceHT.lib with sleep manager support
Changed in this revision
--- a/USBDeviceHT.lib Fri Feb 15 10:53:47 2019 +0100 +++ b/USBDeviceHT.lib Sun Feb 24 14:57:36 2019 +0100 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/Helmut64/code/USBDeviceHT/#8a5cc0d9bfa2 +https://os.mbed.com/users/Helmut64/code/USBDeviceHT/#961423d1da74
--- a/Utils/utils.cpp Fri Feb 15 10:53:47 2019 +0100
+++ b/Utils/utils.cpp Sun Feb 24 14:57:36 2019 +0100
@@ -21,7 +21,7 @@
#endif
bool _useDprintf;
-void InitSerial(int timeout, DigitalOut *led)
+void InitSerial(int timeout, DigitalOut *led, InterruptIn *intr)
{
_useDprintf = true;
bool uartActive = true;
@@ -40,7 +40,7 @@
*led = !*led;
wait_ms(100);
if (timeout) {
- if (t.read_ms() >= timeout) {
+ if (t.read_ms() >= timeout || (intr && intr->read())) {
delete usb;
usb = NULL;
DigitalOut rx(USBRX);
@@ -446,7 +446,7 @@
" x -- LoRa TX Continuous Wave Test\r\n" \
" d -- Hexdump of memory address [offset count]\r\n"
" r -- Reset\r\n" \
- " c -- Continue with RadioShuttle\r\n" \
+ " c -- Continue with RadioShuttle RadioTest\r\n" \
"\r\n" \
"waiting 10 secs ...\r\n" \
"\r\n";
--- a/main.cpp Fri Feb 15 10:53:47 2019 +0100
+++ b/main.cpp Sun Feb 24 14:57:36 2019 +0100
@@ -6,7 +6,8 @@
/*
* TODO:
- * Compiler Date/Time is not set correctly on startup
+ * Compiler Date/Time is not set correctly on startup using gcc
+ * USB Serial block deepsleep
*/
#include "main.h"
#include "RadioTest.h"
@@ -40,7 +41,7 @@
* blinking LED means USBSerial detected, waiting for a connect.
* It waits up to 30 seconds for a USB terminal connections
*/
- InitSerial(30*1000, &statusLED);
+ InitSerial(30*1000, &statusLED, &buttonIntr);
RunStartup();
dprintf("Welcome to RadioShuttle v%d.%d", RS_MAJOR, RS_MINOR);
timerUpdate(); // start timer for status blinked, can be disalbed to save energy
@@ -57,17 +58,14 @@
#endif
/*
- * Main event loop, process interrupts and go to sleep
+ * Main event loop, process interrupts and goes to sleep when idle.
* the green statusLED indicates CPU activity
- * the red redLED indicates that low power timeout function is running.
+ * the red redLED indicates that low power timerUpdate function is running.
*/
while(true) {
while ((readPendingInterrupts() == 0)) {
statusLED = 0;
-#ifdef FEATURE_USBSERIAL
- if (!(usb && usb->connected()))
-#endif
- sleep();
+ sleep();
statusLED = 1;
}
--- a/main.h Fri Feb 15 10:53:47 2019 +0100 +++ b/main.h Sun Feb 24 14:57:36 2019 +0100 @@ -32,7 +32,7 @@ extern USBSerialBuffered *usb; #endif extern bool _useDprintf; -extern void InitSerial(int timeout, DigitalOut *led); +extern void InitSerial(int timeout, DigitalOut *led, InterruptIn *intr); extern void RunStartup(void); extern size_t MemoryAvailable(bool print);
Helmut Tschemernjak