Merge branch 'master' into support-rak14004

This commit is contained in:
Ben Meadors 2022-10-07 06:58:08 -05:00 committed by GitHub
commit b2e84dfd29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 84 additions and 9 deletions

View File

@ -368,8 +368,21 @@ bool Power::axpChipInit()
#ifdef HAS_PMU #ifdef HAS_PMU
TwoWire * w = NULL;
// Use macro to distinguish which wire is used by PMU
#ifdef PMU_USE_WIRE1
w = &Wire1;
#else
w = &Wire;
#endif
/**
* It is not necessary to specify the wire pin,
* just input the wire, because the wire has been initialized in main.cpp
*/
if (!PMU) { if (!PMU) {
PMU = new XPowersAXP2101(Wire, I2C_SDA, I2C_SCL); PMU = new XPowersAXP2101(*w);
if (!PMU->init()) { if (!PMU->init()) {
DEBUG_MSG("Warning: Failed to find AXP2101 power management\n"); DEBUG_MSG("Warning: Failed to find AXP2101 power management\n");
delete PMU; delete PMU;
@ -380,7 +393,7 @@ bool Power::axpChipInit()
} }
if (!PMU) { if (!PMU) {
PMU = new XPowersAXP192(Wire, I2C_SDA, I2C_SCL); PMU = new XPowersAXP192(*w);
if (!PMU->init()) { if (!PMU->init()) {
DEBUG_MSG("Warning: Failed to find AXP192 power management\n"); DEBUG_MSG("Warning: Failed to find AXP192 power management\n");
delete PMU; delete PMU;
@ -396,7 +409,9 @@ bool Power::axpChipInit()
* In order not to affect other devices, if the initialization of the PMU fails, Wire needs to be re-initialized once, * In order not to affect other devices, if the initialization of the PMU fails, Wire needs to be re-initialized once,
* if there are multiple devices sharing the bus. * if there are multiple devices sharing the bus.
* * */ * * */
Wire.begin(I2C_SDA, I2C_SCL); #ifndef PMU_USE_WIRE1
w->begin(I2C_SDA, I2C_SCL);
#endif
return false; return false;
} }
@ -456,6 +471,23 @@ bool Power::axpChipInit()
PMU->setPowerChannelVoltage(XPOWERS_DCDC3, 3300); PMU->setPowerChannelVoltage(XPOWERS_DCDC3, 3300);
PMU->enablePowerOutput(XPOWERS_DCDC3); PMU->enablePowerOutput(XPOWERS_DCDC3);
/**
* ALDO2 cannot be turned off.
* It is a necessary condition for sensor communication.
* It must be turned on to properly access the sensor and screen
* It is also responsible for the power supply of PCF8563
*/
PMU->setPowerChannelVoltage(XPOWERS_ALDO2, 3300);
PMU->enablePowerOutput(XPOWERS_ALDO2);
// 6-axis , magnetometer ,bme280 , oled screen power channel
PMU->setPowerChannelVoltage(XPOWERS_ALDO1, 3300);
PMU->enablePowerOutput(XPOWERS_ALDO1);
// sdcard power channle
PMU->setPowerChannelVoltage(XPOWERS_BLDO1, 3300);
PMU->enablePowerOutput(XPOWERS_BLDO1);
// PMU->setPowerChannelVoltage(XPOWERS_DCDC4, 3300); // PMU->setPowerChannelVoltage(XPOWERS_DCDC4, 3300);
// PMU->enablePowerOutput(XPOWERS_DCDC4); // PMU->enablePowerOutput(XPOWERS_DCDC4);

View File

@ -108,7 +108,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MCP9808_ADDR 0x18 #define MCP9808_ADDR 0x18
#define INA_ADDR 0x40 #define INA_ADDR 0x40
#define INA_ADDR_ALTERNATE 0x41 #define INA_ADDR_ALTERNATE 0x41
#define QMC6310_ADDR 0x1C
#define QMI8658_ADDR 0x6B
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// GPS // GPS
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -145,6 +145,14 @@ void scanI2Cdevice(void)
nodeTelemetrySensorsMap[TelemetrySensorType_MCP9808] = addr; nodeTelemetrySensorsMap[TelemetrySensorType_MCP9808] = addr;
DEBUG_MSG("MCP9808 sensor found at address 0x%x\n", (uint8_t)addr); DEBUG_MSG("MCP9808 sensor found at address 0x%x\n", (uint8_t)addr);
} }
if(addr == QMC6310_ADDR){
DEBUG_MSG("QMC6310 3-Axis magnetic sensor found at address 0x%x\n", (uint8_t)addr);
// nodeTelemetrySensorsMap[TelemetrySensorType_QMC6310] = addr; //Uncomment after protobufs PR is merged
}
if(addr == QMI8658_ADDR){
DEBUG_MSG("QMI8658 6-Axis inertial measurement sensor found at address 0x%x\n", (uint8_t)addr);
// nodeTelemetrySensorsMap[TelemetrySensorType_QMI8658] = addr; //Uncomment after protobufs PR is merged
}
} else if (err == 4) { } else if (err == 4) {
DEBUG_MSG("Unknow error at address 0x%x\n", addr); DEBUG_MSG("Unknow error at address 0x%x\n", addr);
} }

View File

@ -214,6 +214,10 @@ void setup()
// router = new DSRRouter(); // router = new DSRRouter();
router = new ReliableRouter(); router = new ReliableRouter();
#ifdef I2C_SDA1
Wire1.begin(I2C_SDA1, I2C_SCL1);
#endif
#ifdef I2C_SDA #ifdef I2C_SDA
Wire.begin(I2C_SDA, I2C_SCL); Wire.begin(I2C_SDA, I2C_SCL);
#elif HAS_WIRE #elif HAS_WIRE
@ -229,7 +233,6 @@ void setup()
delay(1); delay(1);
#endif #endif
scanI2Cdevice();
#ifdef RAK4630 #ifdef RAK4630
// scanEInkDevice(); // scanEInkDevice();
#endif #endif
@ -269,6 +272,12 @@ void setup()
powerStatus->observe(&power->newStatus); powerStatus->observe(&power->newStatus);
power->setup(); // Must be after status handler is installed, so that handler gets notified of the initial configuration power->setup(); // Must be after status handler is installed, so that handler gets notified of the initial configuration
/*
* Move the scanning I2C device to the back of power initialization.
* Some boards need to be powered on to correctly scan to the device address, such as t-beam-s3-core
*/
scanI2Cdevice();
// Init our SPI controller (must be before screen and lora) // Init our SPI controller (must be before screen and lora)
initSPI(); initSPI();
#ifndef ARCH_ESP32 #ifndef ARCH_ESP32

View File

@ -25,5 +25,12 @@ static const uint8_t MOSI = 11;
static const uint8_t MISO = 13; static const uint8_t MISO = 13;
static const uint8_t SCK = 12; static const uint8_t SCK = 12;
#define SDMMC_CMD (35)
#define SDMMC_CLK (36)
#define SDMMC_DATA (37)
#define ACCEL_INT1 (34)
#define ACCEL_INT2 (33)
#define RTC_INT (14)
#endif /* Pins_Arduino_h */ #endif /* Pins_Arduino_h */

View File

@ -5,7 +5,9 @@ board = tbeam-s3-core
lib_deps = lib_deps =
${esp32s3_base.lib_deps} ${esp32s3_base.lib_deps}
lewisxhe/PCF8563_Library@1.0.1
build_flags = build_flags =
${esp32s3_base.build_flags} ${esp32s3_base.build_flags}
-Ivariants/tbeam-s3-core -Ivariants/tbeam-s3-core
-DPCF8563_RTC=0x51 ;Putting definitions in variant.h does not compile correctly

View File

@ -1,12 +1,18 @@
// #define BUTTON_NEED_PULLUP // if set we need to turn on the internal CPU pullup during sleep // #define BUTTON_NEED_PULLUP // if set we need to turn on the internal CPU pullup during sleep
#define I2C_SDA 42 #define I2C_SDA1 42 //Used for PMU management
#define I2C_SCL 41 #define I2C_SCL1 41 //Used for PMU management
#define I2C_SDA 17 //For sensors and screens
#define I2C_SCL 18 //For sensors and screens
#define BUTTON_PIN 0 // The middle button GPIO on the T-Beam S3 #define BUTTON_PIN 0 // The middle button GPIO on the T-Beam S3
//#define BUTTON_PIN_ALT 13 // Alternate GPIO for an external button if needed. Does anyone use this? It is not documented anywhere. //#define BUTTON_PIN_ALT 13 // Alternate GPIO for an external button if needed. Does anyone use this? It is not documented anywhere.
// #define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module. // #define EXT_NOTIFY_OUT 13 // Default pin to use for Ext Notify Module.
#define BUTTON1_PIN 47 //Additional keys
#define LED_INVERTED 1 #define LED_INVERTED 1
// #define LED_PIN 4 // Newer tbeams (1.1) have an extra led on GPIO4 // #define LED_PIN 4 // Newer tbeams (1.1) have an extra led on GPIO4
@ -36,6 +42,9 @@
// #define PMU_IRQ 40 // #define PMU_IRQ 40
#define HAS_AXP2101 #define HAS_AXP2101
// Specify the PMU as Wire1. In the t-beam-s3-core, the PMU enjoys a separate bus
#define PMU_USE_WIRE1
#define RF95_SCK 12 #define RF95_SCK 12
#define RF95_MISO 13 #define RF95_MISO 13
#define RF95_MOSI 11 #define RF95_MOSI 11
@ -47,3 +56,10 @@
#define GPS_1PPS_PIN 6 #define GPS_1PPS_PIN 6
#define HAS_SDCARD //Have 3-bit SDMMC interface SD card slot
// PCF8563 RTC Module
// #define PCF8563_RTC 0x51 //Putting definitions in variant. h does not compile correctly
#define HAS_RTC 1

View File

@ -1,4 +1,4 @@
[VERSION] [VERSION]
major = 1 major = 1
minor = 3 minor = 3
build = 42 build = 43