35 : slave(bus, cs, getDefaultSPIConfig())
41 : slave(bus, cs, spiConfig), config(config)
60 LOG_ERR(logger,
"Attempted to initialized sensor twice");
82 LOG_ERR(logger,
"Invoked selfTest() but sensor was uninitialized");
92 if (whoamiValue != WHO_AM_I_VALUE)
94 LOG_ERR(logger,
"WHO_AM_I: read 0x{:x} but expected 0x{:x}",
95 whoamiValue, WHO_AM_I_VALUE);
145 LOG_ERR(logger,
"Invoked sampleImpl() but sensor was not initialized");
151 uint8_t statusValue = 0;
165 }
while (!(statusValue & (STATUS::P_DA | STATUS::T_DA)));
176 if (statusValue & STATUS::P_DA)
189 if (statusValue & STATUS::T_DA)
#define LOG_ERR(logger,...)
void setConfig(const Config &config)
Sets and saves the configurations passed on the parameters.
void setOutputDataRate(ODR odr)
Sets and saves the output data rate.
AVG
Oversampling average values.
static SPIBusConfig getDefaultSPIConfig()
LPS22DFData sampleImpl() override
Read a data sample from the sensor. In case of errors, the method should return the last available co...
bool selfTest() override
The self test method returns true if we read the right whoami value. We can't make a better self test...
ODR
Enumeration for Output Data Rate Configuration.
LPS22DF(SPIBusInterface &bus, miosix::GpioPin cs)
Constructor that stores the initial default settings (without applying them to the sensor).
bool init() override
Initializes the sensor with the current settings.
void setAverage(AVG avg)
Sets and saves the oversampling on the sensor.
Interface for low level access of a SPI bus as a master.
Provides high-level access to the SPI Bus for a single transaction.
uint8_t readRegister(uint8_t reg)
Reads an 8 bit register.
void writeRegister(uint8_t reg, uint8_t data)
Writes an 8 bit register.
uint32_t readRegister24(uint8_t reg)
Reads a 24 bit register.
uint16_t readRegister16(uint8_t reg)
Reads a 16 bit register.
@ TEMP_OUT_L
Temperature output value LSB data.
@ WHO_AM_I
Device Who am I register.
@ CTRL_REG1
Control Register 1 [ODR, AVG].
@ PRESS_OUT_XL
Pressure output value LSB data.
uint64_t getTimestamp()
Returns the current timer value in microseconds.
This file includes all the types the logdecoder script will decode.
Struct that sums up all the settings of the sensor.
uint64_t pressureTimestamp
SPI Bus configuration for a specific slave.
SPI::ClockDivider clockDivider
< Peripheral clock division
uint64_t temperatureTimestamp