WIP LoRAType

This commit is contained in:
Ben Meadors
2023-10-16 10:54:43 -05:00
parent 2c625f6ba1
commit 54240c0d87
5 changed files with 78 additions and 4 deletions

View File

@@ -7,9 +7,9 @@
#include "main.h"
#include <SPI.h>
// #ifdef HELTEC_WIRELESS_PAPER
// SPIClass *hspi = NULL;
// #endif
#if defined(HELTEC_WIRELESS_PAPER)// || defined(LORA_TYPE)
SPIClass *hspi = NULL;
#endif
#define COLORED GxEPD_BLACK
#define UNCOLORED GxEPD_WHITE
@@ -40,6 +40,10 @@
// 4.2 inch 300x400 - GxEPD2_420_M01
#define TECHO_DISPLAY_MODEL GxEPD2_420_M01
#elif defined(LORA_TYPE)
// 1.54 inch 200x200 - GxEPD2_154_M09
#define TECHO_DISPLAY_MODEL GxEPD2_154_GDEY0154D67
#elif defined(M5_COREINK)
// M5Stack CoreInk
// 1.54 inch 200x200 - GxEPD2_154_M09
@@ -146,7 +150,7 @@ bool EInkDisplay::forceDisplay(uint32_t msecLimit)
// 4.2 inch 300x400 - GxEPD2_420_M01
adafruitDisplay->nextPage();
#elif defined(PCA10059) || defined(M5_COREINK)
#elif defined(PCA10059) || defined(M5_COREINK) || defined(LORA_TYPE)
adafruitDisplay->nextPage();
#elif defined(PRIVATE_HW) || defined(my)
@@ -247,6 +251,12 @@ bool EInkDisplay::connect()
adafruitDisplay->setRotation(3);
adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight);
}
#elif defined(LORA_TYPE)
auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY);
adafruitDisplay = new GxEPD2_BW<TECHO_DISPLAY_MODEL, TECHO_DISPLAY_MODEL::HEIGHT>(*lowLevel);
adafruitDisplay->init(115200, true, 40, false, SPI, SPISettings(4000000, MSBFIRST, SPI_MODE0));
adafruitDisplay->setRotation(3);
adafruitDisplay->setPartialWindow(0, 0, EPD_WIDTH, EPD_HEIGHT);
#elif defined(M5_COREINK)
auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY);
adafruitDisplay = new GxEPD2_BW<TECHO_DISPLAY_MODEL, TECHO_DISPLAY_MODEL::HEIGHT>(*lowLevel);

View File

@@ -615,9 +615,14 @@ void setup()
SPI.begin();
#else
// ESP32
#ifdef LORA_TYPE
SPI.begin(PIN_EINK_SCLK, 15, PIN_EINK_MOSI, PIN_EINK_CS);
#else
SPI.begin(RF95_SCK, RF95_MISO, RF95_MOSI, RF95_NSS);
#endif
LOG_WARN("SPI.begin(SCK=%d, MISO=%d, MOSI=%d, NSS=%d)\n", RF95_SCK, RF95_MISO, RF95_MOSI, RF95_NSS);
SPI.setFrequency(4000000);
#endif
// Initialize the screen first so we can show the logo while we start up everything else.
@@ -661,8 +666,13 @@ void setup()
digitalWrite(SX126X_ANT_SW, 1);
#endif
#ifdef HW_SPI1_DEVICE
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI1, spiSettings);
#elif LORA_TYPE
SPIClass radioSPI(VSPI);
radioSPI.begin(RF95_SCK, RF95_MISO, RF95_MOSI, RF95_NSS);
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(radioSPI, spiSettings);
#else // HW_SPI1_DEVICE
LockingArduinoHal *RadioLibHAL = new LockingArduinoHal(SPI, spiSettings);
#endif

View File

@@ -121,6 +121,8 @@
#define HW_VENDOR meshtastic_HardwareModel_PICOMPUTER_S3
#elif defined(HELTEC_HT62)
#define HW_VENDOR meshtastic_HardwareModel_HELTEC_HT62
#elif defined(LORA_TYPE)
#define HW_VENDOR meshtastic_HardwareModel_LORA_TYPE
#endif
// -----------------------------------------------------------------------------