@@ -123,11 +123,26 @@ static const std::map<std::string, FnCreateI2CDriver> I2cFactory = {
123123 const char *driver_name) -> drvBase * {
124124 return new drvHtu21d (i2c, addr, mux_channel, driver_name);
125125 }},
126+ {" htu31d" ,
127+ [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
128+ const char *driver_name) -> drvBase * {
129+ return new drvHtu31d (i2c, addr, mux_channel, driver_name);
130+ }},
131+ {" hdc302x" ,
132+ [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
133+ const char *driver_name) -> drvBase * {
134+ return new drvHdc302x (i2c, addr, mux_channel, driver_name);
135+ }},
126136 {" ina219" ,
127137 [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
128138 const char *driver_name) -> drvBase * {
129139 return new drvIna219 (i2c, addr, mux_channel, driver_name);
130140 }},
141+ {" ina260" ,
142+ [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
143+ const char *driver_name) -> drvBase * {
144+ return new drvIna260 (i2c, addr, mux_channel, driver_name);
145+ }},
131146 {" lc709203f" ,
132147 [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
133148 const char *driver_name) -> drvBase * {
@@ -148,6 +163,11 @@ static const std::map<std::string, FnCreateI2CDriver> I2cFactory = {
148163 const char *driver_name) -> drvBase * {
149164 return new drvLps25hb (i2c, addr, mux_channel, driver_name);
150165 }},
166+ {" lps28dfw" ,
167+ [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
168+ const char *driver_name) -> drvBase * {
169+ return new drvLps28dfw (i2c, addr, mux_channel, driver_name);
170+ }},
151171 {" ltr329" ,
152172 [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
153173 const char *driver_name) -> drvBase * {
@@ -223,6 +243,11 @@ static const std::map<std::string, FnCreateI2CDriver> I2cFactory = {
223243 const char *driver_name) -> drvBase * {
224244 return new drvScd30 (i2c, addr, mux_channel, driver_name);
225245 }},
246+ {" sgp30" ,
247+ [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
248+ const char *driver_name) -> drvBase * {
249+ return new drvSgp30 (i2c, addr, mux_channel, driver_name);
250+ }},
226251 {" sgp40" ,
227252 [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
228253 const char *driver_name) -> drvBase * {
@@ -278,6 +303,36 @@ static const std::map<std::string, FnCreateI2CDriver> I2cFactory = {
278303 const char *driver_name) -> drvBase * {
279304 return new drvSen5x (i2c, addr, mux_channel, driver_name);
280305 }},
306+ {" sen60" ,
307+ [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
308+ const char *driver_name) -> drvBase * {
309+ return new drvSen6x (i2c, addr, mux_channel, driver_name);
310+ }},
311+ {" sen63c" ,
312+ [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
313+ const char *driver_name) -> drvBase * {
314+ return new drvSen6x (i2c, addr, mux_channel, driver_name);
315+ }},
316+ {" sen65" ,
317+ [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
318+ const char *driver_name) -> drvBase * {
319+ return new drvSen6x (i2c, addr, mux_channel, driver_name);
320+ }},
321+ {" sen66" ,
322+ [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
323+ const char *driver_name) -> drvBase * {
324+ return new drvSen6x (i2c, addr, mux_channel, driver_name);
325+ }},
326+ {" sen68" ,
327+ [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
328+ const char *driver_name) -> drvBase * {
329+ return new drvSen6x (i2c, addr, mux_channel, driver_name);
330+ }},
331+ {" sen6x" ,
332+ [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
333+ const char *driver_name) -> drvBase * {
334+ return new drvSen6x (i2c, addr, mux_channel, driver_name);
335+ }},
281336 {" shtc3" ,
282337 [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
283338 const char *driver_name) -> drvBase * {
@@ -318,6 +373,11 @@ static const std::map<std::string, FnCreateI2CDriver> I2cFactory = {
318373 const char *driver_name) -> drvBase * {
319374 return new drvVncl4040 (i2c, addr, mux_channel, driver_name);
320375 }},
376+ {" vncl4200" ,
377+ [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
378+ const char *driver_name) -> drvBase * {
379+ return new drvVncl4200 (i2c, addr, mux_channel, driver_name);
380+ }},
321381 {" vl53l0x" ,
322382 [](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
323383 const char *driver_name) -> drvBase * {
@@ -365,10 +425,14 @@ static const std::unordered_map<uint16_t, std::vector<const char *>>
365425 {0x2A , {" nau7802" }},
366426 {0x38 , {" aht20" , " max17048" }},
367427 {0x39 , {" tsl2591" }},
368- {0x40 , {" htu21d" , " ina219" , " ms8607" , " si7021" , " stemma_soil" }},
369- {0x41 , {" ina219" }},
370- {0x44 , {" sht3x" , " sht4x" }},
371- {0x45 , {" sht3x" }},
428+ {0x40 ,
429+ {" htu21d" , " htu31d" , " ina219" , " ina260" , " ms8607" , " si7021" ,
430+ " stemma_soil" }},
431+ {0x41 , {" htu31d" , " ina219" , " ina260" }},
432+ {0x44 , {" hdc302x" , " ina260" , " sht3x" , " sht4x" }},
433+ {0x45 , {" hdc302x" , " ina260" , " sht3x" }},
434+ {0x46 , {" hdc302x" }},
435+ {0x47 , {" hdc302x" }},
372436 {0x48 , {" adt7410" , " pct2075" , " tmp117" }},
373437 {0x49 , {" adt7410" , " pct2075" , " tmp117" , " tsl2591" }},
374438 {0x4A , {" adt7410" , " pct2075" , " tmp117" }},
@@ -377,17 +441,21 @@ static const std::unordered_map<uint16_t, std::vector<const char *>>
377441 {0x4D , {" pct2075" }},
378442 {0x4E , {" pct2075" }},
379443 {0x4F , {" pct2075" }},
444+ {0x51 , {" vcnl4200" }},
380445 {0x52 , {" ens160" }},
381446 {0x53 , {" ens160" , " ltr390" }},
447+ {0x58 , {" sgp30" }},
382448 {0x59 , {" sgp40" }},
383- {0x5C , {" bh1750" , " lps22hb" , " lps25hb" }},
384- {0x5D , {" lps22hb" , " lps25hb" }},
449+ {0x5C ,
450+ {" bh1750" , " lps22hb" , " lps25hb" , " lps28dfw" , " lps33hw" , " lps35hw" }},
451+ {0x5D , {" lps22hb" , " lps25hb" , " lps28dfw" , " lps33hw" , " lps35hw" }},
385452 {0x5F , {" hts2221" }},
386453 {0x60 , {" mpl115a2" , " vncl4040" }},
387454 {0x61 , {" scd30" }},
388455 {0x62 , {" scd40" }},
389456 {0x68 , {" mcp3421" }},
390- {0x69 , {" sen50" }},
457+ {0x69 , {" sen55" }},
458+ {0x6B , {" sen66" }},
391459 {0x70 , {" pct2075" , " shtc3" }},
392460 {0x71 , {" pct2075" }},
393461 {0x72 , {" pct2075" }},
@@ -862,11 +930,39 @@ bool I2cController::Handle_I2cDeviceAddOrReplace(pb_istream_t *stream) {
862930*/
863931/* **********************************************************************/
864932bool I2cController::ScanI2cBus (bool default_bus = true ) {
865- _i2c_bus_default-> InitBus (default_bus);
933+ // zero-out the scan I2cBusScanned message before attempting a scan
866934 _scan_results = wippersnapper_i2c_I2cBusScanned_init_zero;
867- if (!default_bus)
935+
936+ // Scan the desired i2c bus
937+ if (default_bus) {
938+ if (_i2c_bus_default->GetBusStatus () !=
939+ wippersnapper_i2c_I2cBusStatus_I2C_BUS_STATUS_SUCCESS) {
940+ _i2c_bus_default->InitBus (default_bus);
941+ }
942+ return _i2c_bus_default->ScanBus (&_scan_results);
943+ } else {
944+ if (_i2c_bus_alt->GetBusStatus () !=
945+ wippersnapper_i2c_I2cBusStatus_I2C_BUS_STATUS_SUCCESS) {
946+ _i2c_bus_alt->InitBus (default_bus);
947+ }
868948 return _i2c_bus_alt->ScanBus (&_scan_results);
869- return _i2c_bus_default->ScanBus (&_scan_results);
949+ }
950+ }
951+
952+ /* **********************************************************************/
953+ /* !
954+ @brief Returns the I2C bus object.
955+ @param is_alt_bus
956+ True if the alternative I2C bus is being used, False
957+ otherwise.
958+ @returns A pointer to the I2C bus object.
959+ */
960+ /* **********************************************************************/
961+ TwoWire *I2cController::GetI2cBus (bool is_alt_bus) {
962+ if (is_alt_bus) {
963+ return _i2c_bus_alt->GetBus ();
964+ }
965+ return _i2c_bus_default->GetBus ();
870966}
871967
872968/* **********************************************************************/
@@ -934,6 +1030,13 @@ void I2cController::ConfigureMuxChannel(uint32_t mux_channel, bool is_alt_bus) {
9341030 _i2c_bus_default->SelectMuxChannel (mux_channel);
9351031}
9361032
1033+ void I2cController::PrintAllDrivers () {
1034+ WS_DEBUG_PRINTLN (" [i2c] Printing all drivers..." );
1035+ for (drvBase *drv : _i2c_drivers) {
1036+ drv->printSensorInfo ();
1037+ }
1038+ }
1039+
9371040/* **********************************************************************/
9381041/* !
9391042 @brief Handles polling, reading, and logger for i2c devices
0 commit comments