Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP LoRAType #2919

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/graphics/EInkDisplay2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*/

// Constructor

EInkDisplay::EInkDisplay(uint8_t address, int sda, int scl, OLEDDISPLAY_GEOMETRY geometry, HW_I2C i2cBus)
{
// Set dimensions in OLEDDisplay base class
Expand Down Expand Up @@ -182,6 +183,12 @@ bool EInkDisplay::connect()
adafruitDisplay->setRotation(0);
adafruitDisplay->setPartialWindow(0, 0, EINK_WIDTH, EINK_HEIGHT);
}
#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 EINK_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY);
adafruitDisplay = new GxEPD2_BW<EINK_DISPLAY_MODEL, EINK_DISPLAY_MODEL::HEIGHT>(*lowLevel);
Expand Down
9 changes: 9 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "configuration.h"

Check failure on line 1 in src/main.cpp

View workflow job for this annotation

GitHub Actions / Trunk Check

clang-format

Incorrect formatting, autoformat by running 'trunk fmt'
#if !MESHTASTIC_EXCLUDE_GPS
#include "GPS.h"
#endif
Expand Down Expand Up @@ -727,8 +727,13 @@
SPI.begin();
#else
// ESP32
#ifdef LORA_TYPE
SPI.begin(PIN_EINK_SCLK, 15, PIN_EINK_MOSI, PIN_EINK_CS);
LOG_WARN("SPI.begin(SCK=%d, MISO=15, MOSI=%d, NSS=%d)\n", PIN_EINK_SCLK, PIN_EINK_MOSI, PIN_EINK_CS);
#else
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
LOG_DEBUG("SPI.begin(SCK=%d, MISO=%d, MOSI=%d, NSS=%d)", LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
#endif
SPI.setFrequency(4000000);
#endif

Expand Down Expand Up @@ -937,6 +942,10 @@

#elif defined(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
Expand Down
2 changes: 2 additions & 0 deletions src/platform/esp32/architecture.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@
#define HW_VENDOR meshtastic_HardwareModel_SENSELORA_S3
#elif defined(HELTEC_HT62)
#define HW_VENDOR meshtastic_HardwareModel_HELTEC_HT62
#elif defined(LORA_TYPE)
#define HW_VENDOR meshtastic_HardwareModel_LORA_TYPE
#elif defined(CHATTER_2)
#define HW_VENDOR meshtastic_HardwareModel_CHATTER_2
#elif defined(STATION_G2)
Expand Down
16 changes: 16 additions & 0 deletions variants/lora_type/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[env:lora_type]
extends = esp32_base
board = esp32doit-devkit-v1
board_level = extra
build_flags =
${esp32_base.build_flags}
-DLORA_TYPE
-DEBYTE_E22
-Ivariants/lora_type
-DEPD_HEIGHT=200
-DEPD_WIDTH=200
-DEINK_DISPLAY_MODEL=GxEPD2_154_GDEY0154D67
-DM5_COREINK
lib_deps =
${esp32_base.lib_deps}
zinggjm/GxEPD2@^1.4.9
37 changes: 37 additions & 0 deletions variants/lora_type/variant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#define BUTTON_PIN 39 // The middle button GPIO on the T-Beam

Check failure on line 1 in variants/lora_type/variant.h

View workflow job for this annotation

GitHub Actions / Trunk Check

clang-format

Incorrect formatting, autoformat by running 'trunk fmt'
#define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
#define ADC_CHANNEL ADC1_GPIO35_CHANNEL
#define ADC_MULTIPLIER 2.0 // (R1 = 27k, R2 = 100k)
#define LED_PIN 33 // add status LED (compatible with core-pcb and DIY targets)

#define LORA_DIO0 RADIOLIB_NC // a No connect on the SX1262/SX1268 module
#define LORA_RESET 16 // RST for SX1276, and for SX1262/SX1268
#define LORA_DIO1 4 // IRQ for SX1262/SX1268
#define LORA_DIO2 26 // BUSY for SX1262/SX1268
#define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262/SX1268, if DIO3 is high the TXCO is enabled

#define RF95_SCK 18
#define RF95_MISO 19
#define RF95_MOSI 23
#define RF95_NSS 5

#define USE_SX1262

#define SX126X_CS 5 // NSS for SX126X
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_DIO2
#define SX126X_RESET LORA_RESET
#define SX126X_RXEN 25
#define SX126X_TXEN RADIOLIB_NC
#define SX126X_DIO2_AS_RF_SWITCH

#define SX126X_DIO3_TCXO_VOLTAGE 1.8

#define USE_EINK
#define PIN_EINK_EN -1 // N/C
#define PIN_EINK_CS 15 // EPD_CS
#define PIN_EINK_BUSY 27 // EPD_BUSY
#define PIN_EINK_DC 12 // EPD_D/C
#define PIN_EINK_RES 32 // Connected but not needed
#define PIN_EINK_SCLK 14 // EPD_SCLK
#define PIN_EINK_MOSI 13 // GxEPD2_EPDEPD_MOSI
Loading