RadioShuttle Lib for the STM32 L4 Heltec Board

Dependents:   Turtle_RadioShuttle

Committer:
Helmut Tschemernjak
Date:
Sun Apr 14 18:35:26 2019 +0200
Revision:
13:591254bed18b
Parent:
12:11b2d36e9217
Updated RadioStatus to be in common with mbed and Arduino

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Helmut64 0:0c31756924a2 1 /*
Helmut64 0:0c31756924a2 2 * The file is licensed under the Apache License, Version 2.0
Helmut64 0:0c31756924a2 3 * (c) 2019 Helmut Tschemernjak
Helmut64 0:0c31756924a2 4 * 30826 Garbsen (Hannover) Germany
Helmut64 0:0c31756924a2 5 */
Helmut64 0:0c31756924a2 6
Helmut Tschemernjak 12:11b2d36e9217 7 #if defined(ARDUINO_Heltec_WIFI_LoRa_32) || defined(ARDUINO_WIFI_LORA_32) \
Helmut Tschemernjak 13:591254bed18b 8 || defined(ARDUINO_WIFI_LORA_32_V2) || defined(ARDUINO_WIRELESS_STICK) \
Helmut Tschemernjak 13:591254bed18b 9 || defined(ARDUINO_ESP32_DEV) // the Heltec and ECO boards
Helmut Tschemernjak 13:591254bed18b 10 #define HAS_OLED_DISPLAY
Helmut64 0:0c31756924a2 11 #include <Wire.h>
Helmut64 0:0c31756924a2 12 #include "SSD1306.h"
Helmut64 0:0c31756924a2 13 #endif
Helmut Tschemernjak 13:591254bed18b 14
Helmut Tschemernjak 13:591254bed18b 15 #ifdef ARDUINO_ESP32_DEV
Helmut Tschemernjak 13:591254bed18b 16 #undef HAS_OLED_DISPLAY // remove this line to enable the board
Helmut Tschemernjak 13:591254bed18b 17 #endif
Helmut Tschemernjak 13:591254bed18b 18
Helmut Tschemernjak 12:11b2d36e9217 19 #ifdef FEATURE_SSD1306
Helmut Tschemernjak 12:11b2d36e9217 20 #include "SSD1306I2C.h"
Helmut Tschemernjak 13:591254bed18b 21 #define HAS_OLED_DISPLAY
Helmut Tschemernjak 12:11b2d36e9217 22 #define SSD1306 SSD1306I2C
Helmut Tschemernjak 12:11b2d36e9217 23 #endif
Helmut64 0:0c31756924a2 24
Helmut64 0:0c31756924a2 25 #ifndef UNUSED
Helmut64 0:0c31756924a2 26 #define UNUSED(x) (void)(x)
Helmut64 0:0c31756924a2 27 #endif
Helmut64 0:0c31756924a2 28
Helmut64 0:0c31756924a2 29
Helmut64 0:0c31756924a2 30 class MyRadioStatus : public RadioStatusInterface {
Helmut64 0:0c31756924a2 31 public:
Helmut64 0:0c31756924a2 32 MyRadioStatus();
Helmut64 0:0c31756924a2 33 virtual ~MyRadioStatus();
Helmut64 0:0c31756924a2 34
Helmut64 0:0c31756924a2 35 virtual void TXStart(int AppID, int toStation, int length, int dBm);
Helmut64 0:0c31756924a2 36 virtual void TXComplete(void);
Helmut64 0:0c31756924a2 37 virtual void RxDone(int size, int rssi, int snr);
Helmut64 0:0c31756924a2 38 virtual void RxCompleted(void);
Helmut64 0:0c31756924a2 39 virtual void MessageTimeout(int AppID, int toStation);
Helmut64 0:0c31756924a2 40
Helmut64 0:0c31756924a2 41 void UpdateDisplay(bool invert);
Helmut64 0:0c31756924a2 42 private:
Helmut64 0:0c31756924a2 43 DigitalOut *ledTX;
Helmut64 0:0c31756924a2 44 DigitalOut *ledRX;
Helmut64 0:0c31756924a2 45 DigitalOut *ledTimeout;
Helmut64 0:0c31756924a2 46 int _totalTX;
Helmut64 0:0c31756924a2 47 int _totalRX;
Helmut64 0:0c31756924a2 48 int _totalError;
Helmut64 0:0c31756924a2 49 int _totalTimeout;
Helmut64 0:0c31756924a2 50 bool inverted;
Helmut64 0:0c31756924a2 51
Helmut Tschemernjak 13:591254bed18b 52 #ifdef HAS_OLED_DISPLAY
Helmut64 0:0c31756924a2 53 SSD1306 *display;
Helmut64 0:0c31756924a2 54 DigitalOut *displayReset;
Helmut64 0:0c31756924a2 55 char _line1[64];
Helmut64 0:0c31756924a2 56 char _line2[64];
Helmut64 0:0c31756924a2 57 char _line3[64];
Helmut64 0:0c31756924a2 58 char _line4[64];
Helmut64 0:0c31756924a2 59 char _line5[64];
Helmut64 0:0c31756924a2 60 bool invertedDisplay;
Helmut64 0:0c31756924a2 61 #endif
Helmut64 0:0c31756924a2 62 };
Helmut64 0:0c31756924a2 63