TI OPT3001 light sensor support (#4015)

* TI OPT3001 light sensor support

* Added register interrogation to deconflict with SHT sensors on same address
This commit is contained in:
Ben Meadors
2024-06-02 07:39:08 -05:00
committed by GitHub
parent 2723ae6e9b
commit 97a5abbc82
8 changed files with 79 additions and 1 deletions

View File

@@ -46,6 +46,7 @@ class ScanI2C
RCWL9620,
NCP5623,
TSL2591,
OPT3001,
AHT10,
} DeviceType;

View File

@@ -302,6 +302,9 @@ void ScanI2CTwoWire::scanPort(I2CPort port)
if (registerValue == 0x11a2) {
type = SHT4X;
LOG_INFO("SHT4X sensor found\n");
} else if (getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x7E), 2) == 0x5449) {
type = OPT3001;
LOG_INFO("OPT3001 light sensor found\n");
} else {
type = SHT31;
LOG_INFO("SHT31 sensor found\n");
@@ -343,6 +346,7 @@ void ScanI2CTwoWire::scanPort(I2CPort port)
SCAN_SIMPLE_CASE(TCA9555_ADDR, TCA9555, "TCA9555 I2C expander found\n");
SCAN_SIMPLE_CASE(VEML7700_ADDR, VEML7700, "VEML7700 light sensor found\n");
SCAN_SIMPLE_CASE(TSL25911_ADDR, TSL2591, "TSL2591 light sensor found\n");
SCAN_SIMPLE_CASE(OPT3001_ADDRESS, OPT3001, "OPT3001 light sensor found\n");
default:
LOG_INFO("Device found at address 0x%x was not able to be enumerated\n", addr.address);