Update BPF pins
This commit is contained in:
parent
76360ae536
commit
2ba44e2101
135 changed files with 14085 additions and 630 deletions
|
|
@ -4,6 +4,7 @@
|
|||
* @license MIT
|
||||
* @copyright Copyright (c) 2024 ShenZhen XinYuan Electronic Technology Co., Ltd
|
||||
* @date 2024-04-24
|
||||
* @last-update 2024-08-07
|
||||
*
|
||||
*/
|
||||
|
||||
|
|
@ -29,6 +30,11 @@ HardwareSerial SerialGPS(GPS_RX_PIN, GPS_TX_PIN);
|
|||
DISPLAY_MODEL *u8g2 = NULL;
|
||||
static DevInfo_t devInfo;
|
||||
|
||||
#ifdef HAS_GPS
|
||||
static bool find_gps = false;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef HAS_PMU
|
||||
XPowersLibInterface *PMU = NULL;
|
||||
|
|
@ -69,7 +75,7 @@ bool beginPower()
|
|||
return false;
|
||||
}
|
||||
|
||||
PMU->setChargingLedMode(XPOWERS_CHG_LED_BLINK_1HZ);
|
||||
PMU->setChargingLedMode(XPOWERS_CHG_LED_CTRL_CHG);
|
||||
|
||||
pinMode(PMU_IRQ, INPUT_PULLUP);
|
||||
attachInterrupt(PMU_IRQ, setPmuFlag, FALLING);
|
||||
|
|
@ -199,6 +205,41 @@ bool beginPower()
|
|||
PMU->disablePowerOutput(XPOWERS_DLDO2);
|
||||
PMU->disablePowerOutput(XPOWERS_VBACKUP);
|
||||
|
||||
|
||||
#elif defined(T_BEAM_S3_BPF)
|
||||
|
||||
//gps
|
||||
PMU->setPowerChannelVoltage(XPOWERS_ALDO4, 3300);
|
||||
PMU->enablePowerOutput(XPOWERS_ALDO4);
|
||||
|
||||
//Sdcard
|
||||
PMU->setPowerChannelVoltage(XPOWERS_ALDO2, 3300);
|
||||
PMU->enablePowerOutput(XPOWERS_ALDO2);
|
||||
|
||||
// Extern Power source
|
||||
PMU->setPowerChannelVoltage(XPOWERS_DCDC3, 3300);
|
||||
PMU->enablePowerOutput(XPOWERS_DCDC3);
|
||||
|
||||
PMU->setPowerChannelVoltage(XPOWERS_DCDC5, 3300);
|
||||
PMU->enablePowerOutput(XPOWERS_DCDC5);
|
||||
|
||||
PMU->setPowerChannelVoltage(XPOWERS_ALDO1, 3300);
|
||||
PMU->enablePowerOutput(XPOWERS_ALDO1);
|
||||
|
||||
//not use channel
|
||||
PMU->disablePowerOutput(XPOWERS_BLDO1);
|
||||
PMU->disablePowerOutput(XPOWERS_BLDO2);
|
||||
PMU->disablePowerOutput(XPOWERS_DCDC4);
|
||||
PMU->disablePowerOutput(XPOWERS_DCDC2);
|
||||
PMU->disablePowerOutput(XPOWERS_DCDC4);
|
||||
PMU->disablePowerOutput(XPOWERS_DCDC5);
|
||||
PMU->disablePowerOutput(XPOWERS_DLDO1);
|
||||
PMU->disablePowerOutput(XPOWERS_DLDO2);
|
||||
PMU->disablePowerOutput(XPOWERS_VBACKUP);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// Set constant current charge current limit
|
||||
PMU->setChargerConstantCurr(XPOWERS_AXP2101_CHG_CUR_500MA);
|
||||
|
||||
|
|
@ -218,7 +259,6 @@ bool beginPower()
|
|||
// XPOWERS_AXP2101_PKEY_NEGATIVE_IRQ | XPOWERS_AXP2101_PKEY_POSITIVE_IRQ | //POWER KEY
|
||||
);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
PMU->enableSystemVoltageMeasure();
|
||||
|
|
@ -290,10 +330,66 @@ bool beginPower()
|
|||
|
||||
void disablePeripherals()
|
||||
{
|
||||
if (!PMU)return;
|
||||
|
||||
#if defined(T_BEAM_S3_BPF)
|
||||
PMU->disablePowerOutput(XPOWERS_ALDO4); //gps
|
||||
PMU->disablePowerOutput(XPOWERS_ALDO2); //Sdcard
|
||||
PMU->disablePowerOutput(XPOWERS_DCDC3); // Extern Power source
|
||||
PMU->disablePowerOutput(XPOWERS_DCDC5);
|
||||
PMU->disablePowerOutput(XPOWERS_ALDO1);
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
void loopPMU()
|
||||
{
|
||||
#ifdef HAS_PMU
|
||||
if (!PMU) {
|
||||
return;
|
||||
}
|
||||
if (!pmuInterrupt) {
|
||||
return;
|
||||
}
|
||||
|
||||
pmuInterrupt = false;
|
||||
// Get PMU Interrupt Status Register
|
||||
uint32_t status = PMU->getIrqStatus();
|
||||
Serial.print("STATUS => HEX:");
|
||||
Serial.print(status, HEX);
|
||||
Serial.print(" BIN:");
|
||||
Serial.println(status, BIN);
|
||||
|
||||
if (PMU->isVbusInsertIrq()) {
|
||||
Serial.println("isVbusInsert");
|
||||
}
|
||||
if (PMU->isVbusRemoveIrq()) {
|
||||
Serial.println("isVbusRemove");
|
||||
}
|
||||
if (PMU->isBatInsertIrq()) {
|
||||
Serial.println("isBatInsert");
|
||||
}
|
||||
if (PMU->isBatRemoveIrq()) {
|
||||
Serial.println("isBatRemove");
|
||||
}
|
||||
if (PMU->isPekeyShortPressIrq()) {
|
||||
Serial.println("isPekeyShortPress");
|
||||
}
|
||||
if (PMU->isPekeyLongPressIrq()) {
|
||||
Serial.println("isPekeyLongPress");
|
||||
}
|
||||
if (PMU->isBatChagerDoneIrq()) {
|
||||
Serial.println("isBatChagerDone");
|
||||
}
|
||||
if (PMU->isBatChagerStartIrq()) {
|
||||
Serial.println("isBatChagerStart");
|
||||
}
|
||||
// Clear PMU Interrupt Status Register
|
||||
PMU->clearIrqStatus();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool beginDisplay()
|
||||
{
|
||||
Wire.beginTransmission(DISPLAY_ADDR);
|
||||
|
|
@ -339,8 +435,12 @@ bool beginSDCard()
|
|||
|
||||
void beginWiFi()
|
||||
{
|
||||
|
||||
|
||||
if (!WiFi.softAP(BOARD_VARIANT_NAME)) {
|
||||
log_e("Soft AP creation failed.");
|
||||
}
|
||||
IPAddress myIP = WiFi.softAPIP();
|
||||
Serial.print("AP IP address: ");
|
||||
Serial.println(myIP);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -449,13 +549,13 @@ void getChipInfo()
|
|||
|
||||
|
||||
|
||||
void setupBoards()
|
||||
void setupBoards(bool disable_u8g2 )
|
||||
{
|
||||
Serial.begin(115200);
|
||||
|
||||
Serial.println("setupBoards");
|
||||
// while (!Serial);
|
||||
|
||||
Serial.begin(115200);
|
||||
Serial.println("setupBoards");
|
||||
|
||||
getChipInfo();
|
||||
|
||||
|
|
@ -474,6 +574,7 @@ void setupBoards()
|
|||
|
||||
#ifdef I2C_SDA
|
||||
Wire.begin(I2C_SDA, I2C_SCL);
|
||||
scanDevices(&Wire);
|
||||
#endif
|
||||
|
||||
#ifdef I2C1_SDA
|
||||
|
|
@ -531,14 +632,26 @@ void setupBoards()
|
|||
SerialGPS.println("@GSR"); delay(300);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RADIO_LDO_EN
|
||||
pinMode(RADIO_LDO_EN, OUTPUT);
|
||||
digitalWrite(RADIO_LDO_EN, HIGH);
|
||||
#endif
|
||||
|
||||
beginPower();
|
||||
|
||||
beginSDCard();
|
||||
|
||||
beginDisplay();
|
||||
if (!disable_u8g2) {
|
||||
beginDisplay();
|
||||
}
|
||||
|
||||
beginWiFi();
|
||||
|
||||
#ifdef HAS_GPS
|
||||
find_gps = beginGPS();
|
||||
#endif
|
||||
|
||||
Serial.println("init done . ");
|
||||
}
|
||||
|
||||
|
|
@ -566,6 +679,10 @@ void printResult(bool radio_online)
|
|||
Serial.println(( PMU ) ? "+" : "-");
|
||||
#endif
|
||||
|
||||
#ifdef HAS_GPS
|
||||
Serial.print("GPS : ");
|
||||
Serial.println(( find_gps ) ? "+" : "-");
|
||||
#endif
|
||||
|
||||
if (u8g2) {
|
||||
|
||||
|
|
@ -589,6 +706,7 @@ void printResult(bool radio_online)
|
|||
|
||||
u8g2->sendBuffer();
|
||||
|
||||
delay(2000);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -615,5 +733,112 @@ void flashLed()
|
|||
}
|
||||
|
||||
|
||||
void scanDevices(TwoWire *w)
|
||||
{
|
||||
uint8_t err, addr;
|
||||
int nDevices = 0;
|
||||
uint32_t start = 0;
|
||||
|
||||
Serial.println("I2C Devices scanning");
|
||||
for (addr = 1; addr < 127; addr++) {
|
||||
start = millis();
|
||||
w->beginTransmission(addr); delay(2);
|
||||
err = w->endTransmission();
|
||||
if (err == 0) {
|
||||
nDevices++;
|
||||
switch (addr) {
|
||||
case 0x77:
|
||||
case 0x76:
|
||||
Serial.println("\tFind BMX280 Sensor!");
|
||||
break;
|
||||
case 0x34:
|
||||
Serial.println("\tFind AXP192/AXP2101 PMU!");
|
||||
break;
|
||||
case 0x3C:
|
||||
Serial.println("\tFind SSD1306/SH1106 dispaly!");
|
||||
break;
|
||||
case 0x51:
|
||||
Serial.println("\tFind PCF8563 RTC!");
|
||||
break;
|
||||
case 0x1C:
|
||||
Serial.println("\tFind QMC6310 MAG Sensor!");
|
||||
break;
|
||||
default:
|
||||
Serial.print("\tI2C device found at address 0x");
|
||||
if (addr < 16) {
|
||||
Serial.print("0");
|
||||
}
|
||||
Serial.print(addr, HEX);
|
||||
Serial.println(" !");
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (err == 4) {
|
||||
Serial.print("Unknow error at address 0x");
|
||||
if (addr < 16) {
|
||||
Serial.print("0");
|
||||
}
|
||||
Serial.println(addr, HEX);
|
||||
}
|
||||
}
|
||||
if (nDevices == 0)
|
||||
Serial.println("No I2C devices found\n");
|
||||
|
||||
Serial.println("Scan devices done.");
|
||||
Serial.println("\n");
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAS_GPS
|
||||
bool beginGPS()
|
||||
{
|
||||
SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
|
||||
bool result = false;
|
||||
uint32_t startTimeout ;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n");
|
||||
delay(5);
|
||||
// Get version information
|
||||
startTimeout = millis() + 3000;
|
||||
Serial.print("Try to init L76K . Wait stop .");
|
||||
while (SerialGPS.available()) {
|
||||
Serial.print(".");
|
||||
SerialGPS.readString();
|
||||
if (millis() > startTimeout) {
|
||||
Serial.println("Wait L76K stop NMEA timeout!");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
Serial.println();
|
||||
SerialGPS.flush();
|
||||
delay(200);
|
||||
|
||||
SerialGPS.write("$PCAS06,0*1B\r\n");
|
||||
startTimeout = millis() + 500;
|
||||
String ver = "";
|
||||
while (!SerialGPS.available()) {
|
||||
if (millis() > startTimeout) {
|
||||
Serial.println("Get L76K timeout!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
SerialGPS.setTimeout(10);
|
||||
ver = SerialGPS.readStringUntil('\n');
|
||||
if (ver.startsWith("$GPTXT,01,01,02")) {
|
||||
Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n");
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
delay(500);
|
||||
}
|
||||
// Initialize the L76K Chip, use GPS + GLONASS
|
||||
SerialGPS.write("$PCAS04,5*1C\r\n");
|
||||
delay(250);
|
||||
// only ask for RMC and GGA
|
||||
SerialGPS.write("$PCAS03,1,0,0,0,1,0,0,0,0,0,,,0,0*02\r\n");
|
||||
delay(250);
|
||||
// Switch to Vehicle Mode, since SoftRF enables Aviation < 2g
|
||||
SerialGPS.write("$PCAS11,3*1E\r\n");
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* @license MIT
|
||||
* @copyright Copyright (c) 2024 ShenZhen XinYuan Electronic Technology Co., Ltd
|
||||
* @date 2024-04-25
|
||||
*
|
||||
* @last-update 2024-08-07
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
@ -60,7 +60,7 @@ typedef struct {
|
|||
} DevInfo_t;
|
||||
|
||||
|
||||
void setupBoards();
|
||||
void setupBoards(bool disable_u8g2 = false);
|
||||
|
||||
bool beginSDCard();
|
||||
|
||||
|
|
@ -74,6 +74,12 @@ void printResult(bool radio_online);
|
|||
|
||||
void flashLed();
|
||||
|
||||
void scanDevices(TwoWire *w);
|
||||
|
||||
bool beginGPS();
|
||||
|
||||
void loopPMU();
|
||||
|
||||
#ifdef HAS_PMU
|
||||
extern XPowersLibInterface *PMU;
|
||||
extern bool pmuInterrupt;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* @license MIT
|
||||
* @copyright Copyright (c) 2024 ShenZhen XinYuan Electronic Technology Co., Ltd
|
||||
* @date 2024-05-12
|
||||
*
|
||||
* @last-update 2024-08-07
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
|
@ -37,6 +37,8 @@
|
|||
|
||||
// #define T3_C6
|
||||
|
||||
// #define T_BEAM_S3_BPF
|
||||
|
||||
|
||||
#define UNUSED_PIN (0)
|
||||
|
||||
|
|
@ -278,14 +280,14 @@
|
|||
defined(T3_S3_V1_2_SX1278) || defined(ARDUINO_LILYGO_T3S3_SX1278) || \
|
||||
defined(T3_S3_V1_2_SX1280) || defined(ARDUINO_LILYGO_T3S3_SX1280) || \
|
||||
defined(T3_S3_V1_2_SX1280_PA) || defined(ARDUINO_LILYGO_T3S3_SX1280PA) || \
|
||||
defined(T3_S3_V1_2_LR1121) || defined(ARDUINO_LILYGO_T3S3_LR1121)
|
||||
defined(T3_S3_V1_2_LR1121) || defined(ARDUINO_LILYGO_T3S3_LR1121)
|
||||
|
||||
|
||||
#if defined(T3_S3_V1_2_SX1262) || defined(ARDUINO_LILYGO_T3S3_SX1262)
|
||||
#if defined(T3_S3_V1_2_SX1262) || defined(ARDUINO_LILYGO_T3S3_SX1262)
|
||||
#ifndef USING_SX1262
|
||||
#define USING_SX1262
|
||||
#endif
|
||||
#elif defined(T3_S3_V1_2_SX1276) || defined(ARDUINO_LILYGO_T3S3_SX1276)
|
||||
#elif defined(T3_S3_V1_2_SX1276) || defined(ARDUINO_LILYGO_T3S3_SX1276)
|
||||
#ifndef USING_SX1276
|
||||
#define USING_SX1276
|
||||
#endif
|
||||
|
|
@ -509,6 +511,72 @@
|
|||
#define BOARD_VARIANT_NAME "T3-C6"
|
||||
|
||||
#define USING_DIO2_AS_RF_SWITCH
|
||||
|
||||
|
||||
#elif defined(T_BEAM_S3_BPF)
|
||||
|
||||
|
||||
#ifndef USING_SX1278
|
||||
#define USING_SX1278
|
||||
#endif
|
||||
|
||||
#define I2C_SDA 8
|
||||
#define I2C_SCL 9
|
||||
|
||||
#define PMU_IRQ 4
|
||||
|
||||
#define GPS_RX_PIN 5
|
||||
#define GPS_TX_PIN 6
|
||||
#define GPS_PPS_PIN 7
|
||||
|
||||
#define BUTTON_PIN 0
|
||||
#define BUTTON_PIN_MASK GPIO_SEL_0
|
||||
#define BUTTON_CONUT (2)
|
||||
#define BUTTON_ARRAY {BUTTON_PIN,3}
|
||||
|
||||
#define RADIO_SCLK_PIN (41)
|
||||
#define RADIO_MISO_PIN (42)
|
||||
#define RADIO_MOSI_PIN (2)
|
||||
#define RADIO_CS_PIN (1)
|
||||
#define RADIO_RST_PIN (18)
|
||||
|
||||
#define RADIO_DIO0_PIN (14)
|
||||
#define RADIO_DIO1_PIN (21)
|
||||
#define RADIO_DIO2_PIN (15)
|
||||
|
||||
#define RADIO_TCXO_ENABLE (17)
|
||||
#define RADIO_LDO_EN (16)
|
||||
#define RADIO_BUSY_PIN (RADIO_DIO1_PIN)
|
||||
|
||||
#define SPI_MOSI (11)
|
||||
#define SPI_SCK (12)
|
||||
#define SPI_MISO (13)
|
||||
#define SPI_CS (10)
|
||||
|
||||
#define SDCARD_MOSI SPI_MOSI
|
||||
#define SDCARD_MISO SPI_MISO
|
||||
#define SDCARD_SCLK SPI_SCK
|
||||
#define SDCARD_CS SPI_CS
|
||||
|
||||
#define PIN_NONE (-1)
|
||||
|
||||
#define GPS_BAUD_RATE 9600
|
||||
|
||||
#define HAS_SDCARD
|
||||
#define HAS_GPS
|
||||
#define HAS_DISPLAY
|
||||
#define HAS_PMU
|
||||
|
||||
#define __HAS_SPI1__
|
||||
#define __HAS_SENSOR__
|
||||
|
||||
#define PMU_WIRE_PORT Wire
|
||||
#define DISPLAY_MODEL U8G2_SH1106_128X64_NONAME_F_HW_I2C
|
||||
#define BOARD_VARIANT_NAME "T-Beam BPF"
|
||||
|
||||
|
||||
|
||||
|
||||
#else
|
||||
#error "When using it for the first time, please define the board model in <utilities.h>"
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue