40 ctrlReg1 |=
static_cast<uint8_t
>(odr) << 4;
70 pressure |=
static_cast<uint32_t
>(buffer[0]) << 16;
71 pressure |=
static_cast<uint32_t
>(buffer[1]) << 8;
72 pressure |=
static_cast<uint32_t
>(buffer[2]);
74 int32_t temperature = 0;
75 temperature |=
static_cast<uint32_t
>(buffer[3]) << 8;
76 temperature |=
static_cast<uint32_t
>(buffer[4]);
92bool LPS331AP::checkWhoAmI()
96 if (bus.
readRegister(slaveConfig, REG_WHO_AM_I, whoAmIValue))
98 if (whoAmIValue == WHO_AM_I_VAL)
104 LOG_ERR(logger,
"Invalid WHO AM I");
#define LOG_ERR(logger,...)
High level driver for the I2C peripherals.
bool readFromRegister(const I2CDriver::I2CSlaveConfig &slaveConfig, const uint8_t registerAddress, void *buffer, const size_t nBytes)
Non blocking operation to read n-bytes from register from a slave.
bool writeRegister(const I2CDriver::I2CSlaveConfig &slaveConfig, const uint8_t registerAddress, const uint8_t registerContent)
Non blocking operation to write an 8-bit register from a slave.
bool readRegister(const I2CDriver::I2CSlaveConfig &slaveConfig, const uint8_t registerAddress, uint8_t ®isterContent)
Non blocking operation to read an 8-bit register from a slave.
LPS331APData sampleImpl() override
Read a data sample from the sensor. In case of errors, the method should return the last available co...
bool init() override
Initialize the sensor.
LPS331AP(I2C &bus, ODR odr=ODR::ODR_25Hz)
bool selfTest() override
Check if the sensor is working.
uint64_t getTimestamp()
Returns the current timer value in microseconds.
This file includes all the types the logdecoder script will decode.
uint64_t pressureTimestamp
uint64_t temperatureTimestamp