I2C device manager (#2282)

* message on dev list change

* dc detect

* added sht3x sensor.

* separete environment data from light

* max17055 moved to i2c dev

* sht fix, goterror detection fix

* fix ext sensor app display for a lot of devices.

* added bh1750 driver

* autoscan on main view

* added devlist mutex

* better timing

* fix h2 sw8 on poweron by usb
This commit is contained in:
Totoo 2024-10-06 22:14:27 +02:00 committed by GitHub
parent d4edb5f5f9
commit 83b65ba6ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 1459 additions and 472 deletions

View file

@ -29,6 +29,21 @@ void I2C::stop() {
i2cStop(_driver);
}
bool I2C::probe(i2caddr_t addr, systime_t timeout) {
i2cAcquireBus(_driver);
chSysLock();
_driver->errors = I2CD_NO_ERROR;
_driver->state = I2C_ACTIVE_TX;
msg_t rdymsg = i2c_lld_master_transmit_timeout(_driver, addr, nullptr, 0, nullptr, 0, timeout);
if (rdymsg == RDY_TIMEOUT)
_driver->state = I2C_LOCKED;
else
_driver->state = I2C_READY;
chSysUnlock();
i2cReleaseBus(_driver);
return (rdymsg == RDY_OK);
}
bool I2C::transfer(
const address_t slave_address,
const uint8_t* const data_tx,