lps25: get 3 register in one access

After e7c3223151 fix it is possible
to read more than one register in one transaction.
This commit is contained in:
Andrey Gusakov 2024-07-15 00:19:19 +03:00 committed by rusefillc
parent aed819170e
commit 78ba473c2a
1 changed files with 6 additions and 17 deletions

View File

@ -87,9 +87,6 @@ expected<float> Lps25::readPressureKpa() {
return unexpected;
}
/*
TODO: why doesn't this work?
// Sequential multi-byte reads need to set the high bit of the
// register address to enable multi-byte read
constexpr uint8_t readAddr = REG_PressureOutXl | 0x80;
@ -99,14 +96,6 @@ expected<float> Lps25::readPressureKpa() {
// Glue the 3 bytes back in to a 24 bit integer
uint32_t counts = buffer[2] << 16 | buffer[1] << 8 | buffer[0];
*/
auto xl = m_i2c.readRegister(addr, REG_PressureOutXl);
auto l = m_i2c.readRegister(addr, REG_PressureOutL);
auto h = m_i2c.readRegister(addr, REG_PressureOutH);
// Glue the 3 bytes back in to a 24 bit integer
uint32_t counts = h << 16 | l << 8 | xl;
// 4096 counts per hectopascal
// = 40960 counts per kilopascal