mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-07 14:12:31 -04:00
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:
parent
d4edb5f5f9
commit
83b65ba6ce
35 changed files with 1459 additions and 472 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue