32 : slave(bus, cs, spiConfig)
40 spi.
writeRegister(CTRL_REG1, NORMAL_MODE | CTRL_REG1_Z_EN | CTRL_REG1_Y_EN |
53 ctrl1 = (ctrl1 & ~CTRL_REG1_DR) | odr;
62 ctrl4 = (ctrl4 & ~CTRL_REG4_FS) | fs;
66 sensitivity = 6.0 / 32767.0;
68 sensitivity = 12.0 / 32767.0;
70 sensitivity = 24.0 / 32767.0;
82 spi.
readRegisters(0x40 | OUT_X_L,
reinterpret_cast<uint8_t*
>(&val), 2);
85 spi.
readRegisters(0x40 | OUT_Y_L,
reinterpret_cast<uint8_t*
>(&val), 2);
88 spi.
readRegisters(0x40 | OUT_Z_L,
reinterpret_cast<uint8_t*
>(&val), 2);
LIS331HHData 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.
LIS331HH(SPIBusInterface &bus, miosix::GpioPin cs, SPIBusConfig spiConfig)
void setFullScaleRange(FullScaleRange fs)
void setOutputDataRate(OutputDataRate odr)
bool selfTest() override
Check if the sensor is working.
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 readRegisters(uint8_t reg, uint8_t *data, size_t size)
Reads multiple bytes starting from the specified register.
void writeRegister(uint8_t reg, uint8_t data)
Writes an 8 bit register.
uint64_t getTimestamp()
Returns the current timer value in microseconds.
This file includes all the types the logdecoder script will decode.
uint64_t accelerationTimestamp
SPI Bus configuration for a specific slave.