Modified by ChatGPT for migration to microRecticulum_Firmware, not verified by me... yet, but I am preserving to document this stage.
This commit is contained in:
parent
1be5b59c7a
commit
432f17b2be
12 changed files with 188 additions and 162 deletions
|
|
@ -4,14 +4,8 @@
|
|||
|
||||
#include <Arduino.h>
|
||||
#include <Wire.h>
|
||||
#include <XPowersLib.h>
|
||||
#include "tbeam_supreme_adapter.h"
|
||||
|
||||
#ifndef I2C_SDA1
|
||||
#define I2C_SDA1 42
|
||||
#endif
|
||||
#ifndef I2C_SCL1
|
||||
#define I2C_SCL1 41
|
||||
#endif
|
||||
#ifndef RTC_I2C_ADDR
|
||||
#define RTC_I2C_ADDR 0x51
|
||||
#endif
|
||||
|
|
@ -50,26 +44,7 @@ static void logf(const char* fmt, ...) {
|
|||
}
|
||||
|
||||
static bool initPmuForRtc() {
|
||||
Wire1.begin(I2C_SDA1, I2C_SCL1);
|
||||
|
||||
if (!g_pmu) {
|
||||
g_pmu = new XPowersAXP2101(Wire1);
|
||||
}
|
||||
|
||||
if (!g_pmu->init()) {
|
||||
logf("PMU: AXP2101 init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Keep RTC/I2C-related rails on, matching tbeam-s3-core behavior.
|
||||
g_pmu->setPowerChannelVoltage(XPOWERS_ALDO2, 3300);
|
||||
g_pmu->enablePowerOutput(XPOWERS_ALDO2);
|
||||
g_pmu->setPowerChannelVoltage(XPOWERS_ALDO1, 3300);
|
||||
g_pmu->enablePowerOutput(XPOWERS_ALDO1);
|
||||
|
||||
logf("PMU: AXP2101 ready, ALDO2=%s",
|
||||
g_pmu->isPowerChannelEnable(XPOWERS_ALDO2) ? "ON" : "OFF");
|
||||
return true;
|
||||
return tbeam_supreme::initPmuForPeripherals(g_pmu, &Serial);
|
||||
}
|
||||
|
||||
static bool rtcRead(RtcDateTime& out, bool& lowVoltageFlag) {
|
||||
|
|
@ -206,7 +181,8 @@ void setup() {
|
|||
Serial.println("\r\n==================================================");
|
||||
Serial.println("Exercise 06: RTC check (PCF8563)");
|
||||
Serial.println("==================================================");
|
||||
Serial.printf("RTC I2C: SDA1=%d SCL1=%d ADDR=0x%02X\r\n", I2C_SDA1, I2C_SCL1, RTC_I2C_ADDR);
|
||||
Serial.printf("RTC I2C: SDA1=%d SCL1=%d ADDR=0x%02X\r\n",
|
||||
tbeam_supreme::i2cSda(), tbeam_supreme::i2cScl(), RTC_I2C_ADDR);
|
||||
|
||||
initPmuForRtc();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue