Skip to content

Commit 6c215f9

Browse files
committed
Add ID'ing ICs for Torch
Allows Torches that are missing a given IC (ie, bare board with no battery) to still boot.
1 parent b75ab4c commit 6c215f9

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

Firmware/RTK_Everywhere/Begin.ino

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,36 @@ void identifyBoard()
8181
if (productVariant == RTK_UNKNOWN)
8282
{
8383
// Torch
84-
// Check if a bq40Z50 battery manager is on the I2C bus
84+
// Check if unique ICs are on the I2C bus
8585
if (i2c_0 == nullptr)
8686
i2c_0 = new TwoWire(0);
8787
int pin_SDA = 15;
8888
int pin_SCL = 4;
8989

9090
i2c_0->begin(pin_SDA, pin_SCL); // SDA, SCL
91+
9192
// 0x0B - BQ40Z50 Li-Ion Battery Pack Manager / Fuel gauge
9293
bool bq40z50Present = i2cIsDevicePresent(i2c_0, 0x0B);
94+
95+
// 0x5C - MP2762A Charger
96+
bool mp2762aPresent = i2cIsDevicePresent(i2c_0, 0x5C);
97+
98+
// 0x08 - HUSB238 - USB C PD Sink Controller
99+
bool husb238Present = i2cIsDevicePresent(i2c_0, 0x08);
100+
93101
i2c_0->end();
94102

95-
if (bq40z50Present)
103+
if (bq40z50Present || mp2762aPresent || husb238Present)
96104
productVariant = RTK_TORCH;
105+
106+
if (productVariant == RTK_TORCH && bq40z50Present == false)
107+
systemPrintln("Error: Torch ID'd with no BQ40Z50 present");
108+
109+
if (productVariant == RTK_TORCH && mp2762aPresent == false)
110+
systemPrintln("Error: Torch ID'd with no MP2762A present");
111+
112+
if (productVariant == RTK_TORCH && husb238Present == false)
113+
systemPrintln("Error: Torch ID'd with no HUSB238 present");
97114
}
98115

99116
if (productVariant == RTK_UNKNOWN)

0 commit comments

Comments
 (0)