Skip to content
Open
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
26 changes: 26 additions & 0 deletions variants/lilygo_techo_lite/TechoBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,30 @@ uint16_t TechoBoard::getBattMilliVolts() {
// divider into account (providing the actual LIPO voltage)
return (uint16_t)((float)adcvalue * REAL_VBAT_MV_PER_LSB);
}

void TechoBoard::setRfSwitchTx(bool tx) {
if (tx) { // TX
digitalWrite(S68F_RF_VC1, HIGH);
digitalWrite(S68F_RF_VC2, LOW);
} else { // RX
digitalWrite(S68F_RF_VC1, LOW);
digitalWrite(S68F_RF_VC2, HIGH);
}
}

void TechoBoard::onBeforeTransmit() {
// RF switching NOT handled by RadioLib via SX126X_DIO2_AS_RF_SWITCH and setRfSwitchPins()
#if defined(P_LORA_TX_LED)
digitalWrite(P_LORA_TX_LED, LOW); // TX LED on
#endif
TechoBoard::setRfSwitchTx(true);
}

void TechoBoard::onAfterTransmit() {
TechoBoard::setRfSwitchTx(false);
#if defined(P_LORA_TX_LED)
digitalWrite(P_LORA_TX_LED, HIGH); // TX LED off
#endif
}

#endif
4 changes: 4 additions & 0 deletions variants/lilygo_techo_lite/TechoBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)

class TechoBoard : public NRF52BoardDCDC {
private:
void setRfSwitchTx(bool tx);
public:
TechoBoard() : NRF52Board("TECHO_OTA") {}
void begin();
uint16_t getBattMilliVolts() override;
void onBeforeTransmit() override;
void onAfterTransmit() override;

const char* getManufacturerName() const override {
return "LilyGo T-Echo";
Expand Down
2 changes: 1 addition & 1 deletion variants/lilygo_techo_lite/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ build_flags = ${nrf52_base.build_flags}
-D SX126X_POWER_EN=30
-D SX126X_CURRENT_LIMIT=140
-D SX126X_RX_BOOSTED_GAIN=1
-D P_LORA_TX_LED=LED_GREEN
-D P_LORA_TX_LED=LED_RED
-D DISABLE_DIAGNOSTIC_OUTPUT
-D ENV_INCLUDE_GPS=1
-D GPS_BAUD_RATE=9600
Expand Down
6 changes: 6 additions & 0 deletions variants/lilygo_techo_lite/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ void initVariant() {
pinMode(PIN_BUTTON1, INPUT_PULLUP);
pinMode(PIN_BUTTON2, INPUT_PULLUP);

pinMode(S68F_RF_VC1, OUTPUT);
pinMode(S68F_RF_VC2, OUTPUT);
// TX
digitalWrite(S68F_RF_VC1, HIGH);
digitalWrite(S68F_RF_VC2, LOW);

pinMode(LED_RED, OUTPUT);
pinMode(LED_GREEN, OUTPUT);
pinMode(LED_BLUE, OUTPUT);
Expand Down
27 changes: 24 additions & 3 deletions variants/lilygo_techo_lite/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@

#include "WVariant.h"

// # T-Echo-Lite_V1.0.pdf
// S68F
// ====
// * RF_VC1 <-- P0.27
// * RF_VC2 <-- P1.01
// * DIO1 <-> P1.08
// * DIO2 <-> P0.05
//
// # EK-S62F_UserGuide_Ver.A.pdf
// MODE A
// ------
// Tx/Rx RF_VC1 RF_VC2
// Tx H L
// Rx L H
//
// MODE B
// ------
// DIO2 --- RF_VC1
// RF_VC2 = H -> NON SLEEP
// RF_VC2 = L -> SLEEP

////////////////////////////////////////////////////////////////////////////////
// Low frequency clock source

Expand Down Expand Up @@ -76,7 +97,7 @@
////////////////////////////////////////////////////////////////////////////////
// Builtin LEDs

#define LED_RED _PINNUM(1, 14) // LED_3
#define LED_RED _PINNUM(1, 14) // LED_3 (CORE)
#define LED_BLUE _PINNUM(1, 5) // LED_2
#define LED_GREEN _PINNUM(1, 7) // LED_1

Expand Down Expand Up @@ -107,8 +128,8 @@
#define SX126X_DIO1 _PINNUM(1, 8)
#define SX126X_BUSY _PINNUM(0, 14)
#define SX126X_RESET _PINNUM(0, 7)
#define SX126X_RF_VC1 _PINNUM(0, 27)
#define SX126X_RF_VC2 _PINNUM(0, 33)
#define S68F_RF_VC1 _PINNUM(0, 27)
#define S68F_RF_VC2 _PINNUM(1, 1)

#define P_LORA_DIO_1 SX126X_DIO1
#define P_LORA_NSS LORA_CS
Expand Down