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.
Dependents: Turtle_RadioShuttle
Revision 13:591254bed18b, committed 2019-04-14
- Comitter:
- Helmut Tschemernjak
- Date:
- Sun Apr 14 18:35:26 2019 +0200
- Parent:
- 12:11b2d36e9217
- Commit message:
- Updated RadioStatus to be in common with mbed and Arduino
Changed in this revision
| RadioStatus.cpp | Show annotated file Show diff for this revision Revisions of this file |
| RadioStatus.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/RadioStatus.cpp Wed Apr 10 16:05:31 2019 +0200
+++ b/RadioStatus.cpp Sun Apr 14 18:35:26 2019 +0200
@@ -71,25 +71,39 @@
ledRX = new DigitalOut(12); // red
*ledRX = 0;
#endif
-#ifdef HAS_HELTEC_LoRa_DISPLAY
+#if defined(ARDUINO_Heltec_WIFI_LoRa_32) || defined(ARDUINO_WIFI_LORA_32) \
+ || defined(ARDUINO_WIFI_LORA_32_V2) || defined(ARDUINO_WIRELESS_STICK) \
+ || defined(ARDUINO_WIRELESS_STICK_LITE) // the Heltec boards
+ ledTX = new DigitalOut(25); // white
+ *ledTX = 0;
+#endif
+
+#ifdef HAS_OLED_DISPLAY
invertedDisplay = false;
_line1[0] = 0;
_line2[0] = 0;
_line3[0] = 0;
_line4[0] = 0;
_line5[0] = 0;
-#ifndef DISPLAY_ADDRESS
+ displayReset = NULL;
+#if defined(ARDUINO_Heltec_WIFI_LoRa_32) || defined(ARDUINO_WIFI_LORA_32) \
+ || defined(ARDUINO_WIFI_LORA_32_V2) || defined(ARDUINO_WIRELESS_STICK)
#define DISPLAY_ADDRESS 0x3c
#define DISPLAY_SDA 4
#define DISPLAY_SCL 15
-#endif
-#ifdef DISPLAY_RESET
-#define DISPLAY_RESET 16
+ #define DISPLAY_RESET 16
displayReset = new DigitalOut(DISPLAY_RESET);
#endif
- *displayReset = 0;
- wait_ms(50);
- *displayReset = 1;
+#ifdef ARDUINO_ESP32_DEV // ESP32_ECO_POWER_REV_1
+ #define DISPLAY_ADDRESS 0x3c
+ #define DISPLAY_SDA 21
+ #define DISPLAY_SCL 22
+#endif
+ if (displayReset) {
+ *displayReset = 0;
+ wait_ms(50);
+ *displayReset = 1;
+ }
display = new SSD1306(DISPLAY_ADDRESS, DISPLAY_SDA, DISPLAY_SCL);
display->init();
// display->flipScreenVertically();
@@ -145,7 +159,7 @@
else
*ledTX = 1;
}
-#ifdef HAS_HELTEC_LoRa_DISPLAY
+#ifdef HAS_OLED_DISPLAY
snprintf(_line2, sizeof(_line2), "TX(%d) ID(%d) %d dBm", length, toStation, dBm);
UpdateDisplay(true);
#endif
@@ -161,7 +175,7 @@
else
*ledTX = 0;
}
-#ifdef HAS_HELTEC_LoRa_DISPLAY
+#ifdef HAS_OLED_DISPLAY
UpdateDisplay(false);
#endif
}
@@ -179,7 +193,7 @@
*ledRX = 1;
}
_totalRX++;
-#ifdef HAS_HELTEC_LoRa_DISPLAY
+#ifdef HAS_OLED_DISPLAY
snprintf(_line3, sizeof(_line3), "RX(%d) RSSI(%d) SNR(%d)", size, rssi, snr);
UpdateDisplay(true);
#endif
@@ -194,7 +208,7 @@
else
*ledRX = 0;
}
-#ifdef HAS_HELTEC_LoRa_DISPLAY
+#ifdef HAS_OLED_DISPLAY
UpdateDisplay(false);
#endif
}
@@ -207,7 +221,7 @@
if (ledTimeout)
*ledTimeout = 1;
_totalTimeout++;
-#ifdef HAS_HELTEC_LoRa_DISPLAY
+#ifdef HAS_OLED_DISPLAY
UpdateDisplay(false);
#endif
}
@@ -217,7 +231,7 @@
MyRadioStatus::UpdateDisplay(bool invertDisplay)
{
UNUSED(invertDisplay);
-#ifdef HAS_HELTEC_LoRa_DISPLAY
+#ifdef HAS_OLED_DISPLAY
int yoff = 0;
int hight = 12;
time_t t = time(NULL);
--- a/RadioStatus.h Wed Apr 10 16:05:31 2019 +0200
+++ b/RadioStatus.h Sun Apr 14 18:35:26 2019 +0200
@@ -5,14 +5,20 @@
*/
#if defined(ARDUINO_Heltec_WIFI_LoRa_32) || defined(ARDUINO_WIFI_LORA_32) \
- || defined(ARDUINO_WIFI_LORA_32_V2) || defined(ARDUINO_WIRELESS_STICK) // the Heltec boards
-#define HAS_HELTEC_LoRa_DISPLAY
+ || defined(ARDUINO_WIFI_LORA_32_V2) || defined(ARDUINO_WIRELESS_STICK) \
+ || defined(ARDUINO_ESP32_DEV) // the Heltec and ECO boards
+#define HAS_OLED_DISPLAY
#include <Wire.h>
#include "SSD1306.h"
#endif
+
+#ifdef ARDUINO_ESP32_DEV
+#undef HAS_OLED_DISPLAY // remove this line to enable the board
+#endif
+
#ifdef FEATURE_SSD1306
#include "SSD1306I2C.h"
-#define HAS_HELTEC_LoRa_DISPLAY
+#define HAS_OLED_DISPLAY
#define SSD1306 SSD1306I2C
#endif
@@ -43,7 +49,7 @@
int _totalTimeout;
bool inverted;
-#ifdef HAS_HELTEC_LoRa_DISPLAY
+#ifdef HAS_OLED_DISPLAY
SSD1306 *display;
DigitalOut *displayReset;
char _line1[64];