Moved LoRa GPIOs to platformio.ini for TBeam boards

This commit is contained in:
Kevin Le
2026-02-14 20:49:07 +07:00
parent 71e044ff60
commit daaeaafca1
7 changed files with 41 additions and 10 deletions

View File

@@ -59,13 +59,13 @@
// uint32_t P_LORA_BUSY = 0; //shared, so define at run // uint32_t P_LORA_BUSY = 0; //shared, so define at run
// uint32_t P_LORA_DIO_2 = 0; //SX1276 only, so define at run // uint32_t P_LORA_DIO_2 = 0; //SX1276 only, so define at run
#define P_LORA_DIO_0 26 // #define P_LORA_DIO_0 26
#define P_LORA_DIO_1 33 // #define P_LORA_DIO_1 33
#define P_LORA_NSS 18 // #define P_LORA_NSS 18
#define P_LORA_RESET 23 // #define P_LORA_RESET 23
#define P_LORA_SCLK 5 // #define P_LORA_SCLK 5
#define P_LORA_MISO 19 // #define P_LORA_MISO 19
#define P_LORA_MOSI 27 // #define P_LORA_MOSI 27
// #define PIN_GPS_RX 34 // #define PIN_GPS_RX 34
// #define PIN_GPS_TX 12 // #define PIN_GPS_TX 12

View File

@@ -5,6 +5,13 @@ build_flags =
${esp32_base.build_flags} ${esp32_base.build_flags}
-I variants/lilygo_tbeam_SX1262 -I variants/lilygo_tbeam_SX1262
-D TBEAM_SX1262 -D TBEAM_SX1262
-D P_LORA_DIO_0=26
-D P_LORA_DIO_1=33
-D P_LORA_NSS=18
-D P_LORA_RESET=23
-D P_LORA_SCLK=5
-D P_LORA_MISO=19
-D P_LORA_MOSI=27
-D SX126X_DIO2_AS_RF_SWITCH=true -D SX126X_DIO2_AS_RF_SWITCH=true
-D SX126X_DIO3_TCXO_VOLTAGE=1.8 -D SX126X_DIO3_TCXO_VOLTAGE=1.8
-D SX126X_CURRENT_LIMIT=140 -D SX126X_CURRENT_LIMIT=140

View File

@@ -0,0 +1,10 @@
#pragma once
#include <helpers/esp32/TBeamBoard.h>
class LilygoTBeamSX1276Board : public TBeamBoard {
public:
uint32_t getIRQGpio() override {
return P_LORA_DIO_0; // default for SX1276
}
};

View File

@@ -5,6 +5,13 @@ build_flags =
${esp32_base.build_flags} ${esp32_base.build_flags}
-I variants/lilygo_tbeam_SX1276 -I variants/lilygo_tbeam_SX1276
-D TBEAM_SX1276 -D TBEAM_SX1276
-D P_LORA_DIO_0=26
-D P_LORA_DIO_1=33
-D P_LORA_NSS=18
-D P_LORA_RESET=23
-D P_LORA_SCLK=5
-D P_LORA_MISO=19
-D P_LORA_MOSI=27
-D SX127X_CURRENT_LIMIT=120 -D SX127X_CURRENT_LIMIT=120
-D RADIO_CLASS=CustomSX1276 -D RADIO_CLASS=CustomSX1276
-D WRAPPER_CLASS=CustomSX1276Wrapper -D WRAPPER_CLASS=CustomSX1276Wrapper

View File

@@ -1,7 +1,7 @@
#include <Arduino.h> #include <Arduino.h>
#include "target.h" #include "target.h"
TBeamBoard board; LilygoTBeamSX1276Board board;
#if defined(P_LORA_SCLK) #if defined(P_LORA_SCLK)
static SPIClass spi; static SPIClass spi;

View File

@@ -3,7 +3,7 @@
#define RADIOLIB_STATIC_ONLY 1 #define RADIOLIB_STATIC_ONLY 1
//#include <RadioLib.h> //#include <RadioLib.h>
#include <helpers/radiolib/RadioLibWrappers.h> #include <helpers/radiolib/RadioLibWrappers.h>
#include <helpers/esp32/TBeamBoard.h> #include <LilygoTBeamSX1276Board.h>
#include <helpers/radiolib/CustomSX1276Wrapper.h> #include <helpers/radiolib/CustomSX1276Wrapper.h>
#include <helpers/AutoDiscoverRTCClock.h> #include <helpers/AutoDiscoverRTCClock.h>
#include <helpers/sensors/EnvironmentSensorManager.h> #include <helpers/sensors/EnvironmentSensorManager.h>
@@ -12,7 +12,7 @@
#include <helpers/ui/MomentaryButton.h> #include <helpers/ui/MomentaryButton.h>
#endif #endif
extern TBeamBoard board; extern LilygoTBeamSX1276Board board;
extern WRAPPER_CLASS radio_driver; extern WRAPPER_CLASS radio_driver;
extern AutoDiscoverRTCClock rtc_clock; extern AutoDiscoverRTCClock rtc_clock;
extern EnvironmentSensorManager sensors; extern EnvironmentSensorManager sensors;

View File

@@ -5,6 +5,13 @@ build_flags =
${esp32_base.build_flags} ${esp32_base.build_flags}
-I variants/lilygo_tbeam_supreme_SX1262 -I variants/lilygo_tbeam_supreme_SX1262
-D TBEAM_SUPREME_SX1262 -D TBEAM_SUPREME_SX1262
-D P_LORA_DIO_0=26
-D P_LORA_DIO_1=33
-D P_LORA_NSS=18
-D P_LORA_RESET=23
-D P_LORA_SCLK=5
-D P_LORA_MISO=19
-D P_LORA_MOSI=27
-D SX126X_CURRENT_LIMIT=140 -D SX126X_CURRENT_LIMIT=140
-D SX126X_RX_BOOSTED_GAIN=1 -D SX126X_RX_BOOSTED_GAIN=1
-D USE_SX1262 -D USE_SX1262