Skip to content

Commit

Permalink
Adapted to T3 S3 V1.2 without PA
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Jun 12, 2023
1 parent f130095 commit 227e29e
Show file tree
Hide file tree
Showing 19 changed files with 295 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
#define HAS_SDCARD


#elif defined(LILYGO_T3_S3_V1_0)
#elif defined(LILYGO_T3_S3_V1_0) || defined(LILYGO_T3_S3_V1_2)

#define I2C_SDA 18
#define I2C_SCL 17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
#define HAS_SDCARD


#elif defined(LILYGO_T3_S3_V1_0)
#elif defined(LILYGO_T3_S3_V1_0) || defined(LILYGO_T3_S3_V1_2)

#define I2C_SDA 18
#define I2C_SCL 17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
#define HAS_DISPLAY
#define HAS_SDCARD

#elif defined(LILYGO_T3_S3_V1_0)
#elif defined(LILYGO_T3_S3_V1_0) || defined(LILYGO_T3_S3_V1_2)

#define I2C_SDA 18
#define I2C_SCL 17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// #define LILYGO_T3_V1_6
// #define LILYGO_T3_V2_0
// #define LILYGO_T3_S3_V1_0
// #define LILYGO_T3_S3_V1_2


/*
Expand Down Expand Up @@ -162,7 +163,7 @@
#define HAS_DISPLAY
#define HAS_SDCARD

#elif defined(LILYGO_T3_S3_V1_0)
#elif defined(LILYGO_T3_S3_V1_0) || defined(LILYGO_T3_S3_V1_2)

#define I2C_SDA 18
#define I2C_SCL 17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
#define HAS_DISPLAY
#define HAS_SDCARD

#elif defined(LILYGO_T3_S3_V1_0)
#elif defined(LILYGO_T3_S3_V1_0) ||defined(LILYGO_T3_S3_V1_2)

#define I2C_SDA 18
#define I2C_SCL 17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
#define HAS_DISPLAY
#define HAS_SDCARD

#elif defined(LILYGO_T3_S3_V1_0)
#elif defined(LILYGO_T3_S3_V1_0) ||defined(LILYGO_T3_S3_V1_2)

#define I2C_SDA 18
#define I2C_SCL 17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@
#define DIO1 9
#define DIO2 -1//33
#define DIO3 -1//34
#ifdef LILYGO_T3_S3_V1_0
#define RX_EN 21
#define TX_EN 10
#define TX_POWER 3
#else
#define RX_EN -1
#define TX_EN -1
#define TX_POWER 13
#endif

#define LORA_DEVICE DEVICE_SX1280 //we need to define the device we are using

Expand All @@ -40,7 +47,7 @@ const uint8_t SpreadingFactor = LORA_SF8; //LoRa spreading factor
const uint8_t CodeRate = LORA_CR_4_5; //LoRa coding rate
const uint16_t Calibration = 11350; //Manual Ranging calibrarion value

const int8_t RangingTXPower = 3; //Transmit power used
const int8_t RangingTXPower = TX_POWER; //Transmit power used
const uint32_t RangingAddress = 16; //must match address in recever

const uint16_t waittimemS = 10000; //wait this long in mS for packet before assuming timeout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
//connected and should be included and be set to -1.



#define I2C_SDA 18
#define I2C_SCL 17
#define RADIO_SCLK_PIN 5
Expand All @@ -26,8 +27,16 @@
#define DIO1 9
#define DIO2 -1//33
#define DIO3 -1//34

#ifdef LILYGO_T3_S3_V1_0
#define RX_EN 21
#define TX_EN 10
#define TX_POWER 3
#else
#define RX_EN -1
#define TX_EN -1
#define TX_POWER 13
#endif

#define LORA_DEVICE DEVICE_SX1280 //we need to define the device we are using

Expand All @@ -41,7 +50,7 @@ const uint8_t SpreadingFactor = LORA_SF8; //LoRa spreading factor
const uint8_t CodeRate = LORA_CR_4_5; //LoRa coding rate
const uint16_t Calibration = 11350; //Manual Ranging calibration value

const int8_t TXpower = 3; //Transmit power used
const int8_t TXpower = TX_POWER; //Transmit power used
const uint32_t RangingAddress = 16; //must match address in master

const uint16_t rangingRXTimeoutmS = 0xFFFF; //ranging RX timeout in mS
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,20 @@ void setup()
while (true);
}

#if defined(RADIO_RX_PIN) && defined(RADIO_TX_PIN)
//Set ANT Control pins
radio.setRfSwitchPins(RADIO_RX_PIN, RADIO_TX_PIN);
#endif

// Set output power to 3 dBm !!Cannot be greater than 3dbm!!
if (radio.setOutputPower(3) == RADIOLIB_ERR_INVALID_OUTPUT_POWER) {

#ifdef LILYGO_T3_S3_V1_0
// T3 S3 V1.1 with PA Version Set output power to 3 dBm !!Cannot be greater than 3dbm!!
int8_t TX_Power = 3;
#else
// T3 S3 V1.2 (No PA) Version Set output power to 3 dBm !!Cannot be greater than 3dbm!!
int8_t TX_Power = 13;
#endif
if (radio.setOutputPower(TX_Power) == RADIOLIB_ERR_INVALID_OUTPUT_POWER) {
Serial.println(F("Selected output power is invalid for this module!"));
while (true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
// #define LILYGO_T3_V1_6 //NO SUPPOTR
// #define LILYGO_T3_V2_0 //NO SUPPOTR
// #define LILYGO_T3_V1_8
#ifndef LILYGO_T3_S3_V1_0
#define LILYGO_T3_S3_V1_0
#endif
// #define LILYGO_T3_S3_V1_0 //SUPPORT
// #define LILYGO_T3_S3_V1_2 //SUPPORT

#define UNUSE_PIN (0)

Expand Down Expand Up @@ -205,7 +204,37 @@
#define BAT_ADC_PIN 1
#define BUTTON_PIN 0

// #define HAS_SDCARD
#define HAS_SDCARD
#define HAS_DISPLAY

#elif defined(LILYGO_T3_S3_V1_2)

#define I2C_SDA 18
#define I2C_SCL 17
#define OLED_RST UNUSE_PIN

#define RADIO_SCLK_PIN 5
#define RADIO_MISO_PIN 3
#define RADIO_MOSI_PIN 6
#define RADIO_CS_PIN 7
#define RADIO_DIO1_PIN 9
#define RADIO_DIO2_PIN 33
#define RADIO_DIO3_PIN 34
#define RADIO_RST_PIN 8
#define RADIO_BUSY_PIN 36

#define SDCARD_MOSI 11
#define SDCARD_MISO 2
#define SDCARD_SCLK 14
#define SDCARD_CS 13

#define BOARD_LED 37
#define LED_ON HIGH

#define BAT_ADC_PIN 1
#define BUTTON_PIN 0

#define HAS_SDCARD
#define HAS_DISPLAY

#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,18 @@ void setup()
while (true);
}

#if defined(RADIO_RX_PIN) && defined(RADIO_TX_PIN)
//Set ANT Control pins
radio.setRfSwitchPins(RADIO_RX_PIN, RADIO_TX_PIN);
#endif

#ifdef LILYGO_T3_S3_V1_0
int8_t TX_Power = 3;
#else
int8_t TX_Power = 13;
#endif
// Set output power to 3 dBm !!Cannot be greater than 3dbm!!
if (radio.setOutputPower(3) == RADIOLIB_ERR_INVALID_OUTPUT_POWER) {
if (radio.setOutputPower(TX_Power) == RADIOLIB_ERR_INVALID_OUTPUT_POWER) {
Serial.println(F("Selected output power is invalid for this module!"));
while (true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
// #define LILYGO_T3_V1_6 //NO SUPPOTR
// #define LILYGO_T3_V2_0 //NO SUPPOTR
// #define LILYGO_T3_V1_8
#ifndef LILYGO_T3_S3_V1_0
#define LILYGO_T3_S3_V1_0
#endif
// #define LILYGO_T3_S3_V1_0 //SUPPORT
// #define LILYGO_T3_S3_V1_2 //SUPPORT



Expand Down Expand Up @@ -207,7 +206,37 @@
#define BAT_ADC_PIN 1
#define BUTTON_PIN 0

// #define HAS_SDCARD
#define HAS_SDCARD
#define HAS_DISPLAY

#elif defined(LILYGO_T3_S3_V1_2)

#define I2C_SDA 18
#define I2C_SCL 17
#define OLED_RST UNUSE_PIN

#define RADIO_SCLK_PIN 5
#define RADIO_MISO_PIN 3
#define RADIO_MOSI_PIN 6
#define RADIO_CS_PIN 7
#define RADIO_DIO1_PIN 9
#define RADIO_DIO2_PIN 33
#define RADIO_DIO3_PIN 34
#define RADIO_RST_PIN 8
#define RADIO_BUSY_PIN 36

#define SDCARD_MOSI 11
#define SDCARD_MISO 2
#define SDCARD_SCLK 14
#define SDCARD_CS 13

#define BOARD_LED 37
#define LED_ON HIGH

#define BAT_ADC_PIN 1
#define BUTTON_PIN 0

#define HAS_SDCARD
#define HAS_DISPLAY

#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,47 @@ void setup()
while (true);
}

#if defined(RADIO_RX_PIN) && defined(RADIO_TX_PIN)
//Set ANT Control pins
radio.setRfSwitchPins(RADIO_RX_PIN, RADIO_TX_PIN);
#endif


// set output power to 3 dBm !!Cannot be greater than 3dbm!!
if (radio.setOutputPower(3) == RADIOLIB_ERR_INVALID_OUTPUT_POWER) {
#ifdef LILYGO_T3_S3_V1_0
// T3 S3 V1.1 with PA Version Set output power to 3 dBm !!Cannot be greater than 3dbm!!
int8_t TX_Power = 3;
#else
// T3 S3 V1.2 (No PA) Version Set output power to 3 dBm !!Cannot be greater than 3dbm!!
int8_t TX_Power = 13;
#endif
if (radio.setOutputPower(TX_Power) == RADIOLIB_ERR_INVALID_OUTPUT_POWER) {
Serial.println(F("Selected output power is invalid for this module!"));
while (true);
}

// set carrier frequency to 2410.5 MHz
if (radio.setFrequency(2400.0) == RADIOLIB_ERR_INVALID_FREQUENCY) {
Serial.println(F("Selected frequency is invalid for this module!"));
while (true);
}

// set bandwidth to 203.125 kHz
if (radio.setBandwidth(203.125) == RADIOLIB_ERR_INVALID_BANDWIDTH) {
Serial.println(F("Selected bandwidth is invalid for this module!"));
while (true);
}

// set spreading factor to 10
if (radio.setSpreadingFactor(10) == RADIOLIB_ERR_INVALID_SPREADING_FACTOR) {
Serial.println(F("Selected spreading factor is invalid for this module!"));
while (true);
}

// set coding rate to 6
if (radio.setCodingRate(6) == RADIOLIB_ERR_INVALID_CODING_RATE) {
Serial.println(F("Selected coding rate is invalid for this module!"));
while (true);
}
// set the function that will be called
// when packet transmission is finished
radio.setDio1Action(setFlag);
Expand All @@ -104,15 +131,6 @@ void setup()
while (true);
}

// if needed, 'listen' mode can be disabled by calling
// any of the following methods:
//
// radio.standby()
// radio.sleep()
// radio.transmit();
// radio.receive();
// radio.readData();
// radio.scanChannel();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
// #define LILYGO_T3_V1_6 //NO SUPPOTR
// #define LILYGO_T3_V2_0 //NO SUPPOTR
// #define LILYGO_T3_V1_8
#ifndef LILYGO_T3_S3_V1_0
#define LILYGO_T3_S3_V1_0
#endif
// #define LILYGO_T3_S3_V1_0 //SUPPORT
// #define LILYGO_T3_S3_V1_2 //SUPPORT


#define UNUSE_PIN (0)
Expand Down Expand Up @@ -209,6 +208,36 @@
#define HAS_SDCARD
#define HAS_DISPLAY

#elif defined(LILYGO_T3_S3_V1_2)

#define I2C_SDA 18
#define I2C_SCL 17
#define OLED_RST UNUSE_PIN

#define RADIO_SCLK_PIN 5
#define RADIO_MISO_PIN 3
#define RADIO_MOSI_PIN 6
#define RADIO_CS_PIN 7
#define RADIO_DIO1_PIN 9
#define RADIO_DIO2_PIN 33
#define RADIO_DIO3_PIN 34
#define RADIO_RST_PIN 8
#define RADIO_BUSY_PIN 36

#define SDCARD_MOSI 11
#define SDCARD_MISO 2
#define SDCARD_SCLK 14
#define SDCARD_CS 13

#define BOARD_LED 37
#define LED_ON HIGH

#define BAT_ADC_PIN 1
#define BUTTON_PIN 0

#define HAS_SDCARD
#define HAS_DISPLAY

#else
#error "For the first use, please define the board version and model in <utilities. h>"
#endif
Expand Down
Loading

0 comments on commit 227e29e

Please sign in to comment.