Skip to content

Commit 45726c5

Browse files
author
ladyada
committed
Merge remote-tracking branch 'bot-fork/main'
2 parents fb40030 + 2f7c23a commit 45726c5

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Adafruit_AS7343.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,21 @@ bool Adafruit_AS7343::_init() {
7272
return false;
7373
}
7474

75+
// Software reset — forces a full power-on reset to clear any stale state
76+
{
77+
uint8_t buf[2] = {AS7343_CONTROL, 0x08}; // bit 3 = SW_RESET
78+
i2c_dev->write(buf, 2);
79+
delay(200); // Wait for reset to complete
80+
81+
// Chip reboots with REG_BANK=0, PON=0 — poll until I2C responds
82+
for (uint8_t retries = 0; retries < 20; retries++) {
83+
if (i2c_dev->detected()) {
84+
break;
85+
}
86+
delay(50);
87+
}
88+
}
89+
7590
// Power on
7691
if (!powerOn(true)) {
7792
return false;

0 commit comments

Comments
 (0)