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 5:c6a960febe80, committed 2019-01-21
- Comitter:
- Helmut Tschemernjak
- Date:
- Mon Jan 21 11:56:10 2019 +0100
- Parent:
- 4:2cee8150ecb6
- Child:
- 6:b3626bb4af30
- Commit message:
- Moved PendingInterrupts into utils
InitSerial should always set the RTC when needed.
Fix RX to GND to avoid floating pins
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 |
--- a/main.cpp Sun Jan 20 16:13:11 2019 +0100
+++ b/main.cpp Mon Jan 21 11:56:10 2019 +0100
@@ -13,11 +13,9 @@
#include "RadioTest.h"
#include "GenericPingPong.h"
-volatile uint32_t PendingInterrupts; // global interrupt mask of received interrupts
DigitalOut statusLED(LED);
DigitalOut redLED(LED2);
InterruptIn buttonIntr(USER_BUTTON);
-LowPowerTimeout timeout;
void switchInput(void) {
InterrruptMSG(INT_BUTTON1);
@@ -25,6 +23,7 @@
void timerUpdate(void) {
+ static LowPowerTimeout timeout;
if (redLED == 0)
timeout.attach_us(&timerUpdate, 20000); // setup to call timerUpdate after 20 millis
else
@@ -63,6 +62,7 @@
/*
* Main event loop, process interrupts and go to sleep
* the green statusLED indicates CPU activity
+ * the red redLED indicates that low power timeout function is running.
*/
while(true) {
while ((readPendingInterrupts() == 0)) {
--- a/utils.cpp Sun Jan 20 16:13:11 2019 +0100
+++ b/utils.cpp Mon Jan 21 11:56:10 2019 +0100
@@ -3,7 +3,9 @@
* 30826 Garbsen (Hannover) Germany
*/
#include "main.h"
-
+
+volatile uint32_t PendingInterrupts; // global interrupt mask of received interrupts
+
time_t cvt_date(char const *date, char const *time);
BufferedSerial *ser;
@@ -35,11 +37,16 @@
*led = !*led;
wait_ms(100);
if (timeout) {
- if (t.read_ms() >= timeout)
- return;
+ if (t.read_ms() >= timeout) {
+ delete usb;
+ usb = NULL;
+ DigitalOut rx(USBRX);
+ rx = 0; // need to turn tx low to avoid floating signal
+ goto done;
+ }
}
}
- return;
+ goto done;
} else {
#else
{
@@ -48,11 +55,11 @@
ser->baud(230400);
ser->format(8);
}
+done:
time_t t = cvt_date(__DATE__, __TIME__);
if (t > time(NULL)) {
set_time(t);
}
-
}
void printTimeStamp()
Helmut Tschemernjak