Skip to content
Snippets Groups Projects
Commit 0c6bb318 authored by Fabrizio Monti's avatar Fabrizio Monti Committed by Alberto Nidasio
Browse files

[LSM6DSRX] Modified initInterrupts() in order to have 2 spi writes instead of 4.

parent 4135c4fc
No related branches found
No related tags found
No related merge requests found
......@@ -210,23 +210,21 @@ void LSM6DSRX::initFifo()
void LSM6DSRX::initInterrupts()
{
uint8_t ui8Value = 0;
uint8_t buf[] = {0, 0};
SPITransaction spi{spiSlave};
// set interrupt on pin INT1
spi.writeRegister(LSM6DSRXDefs::REG_INT1_CTRL,
static_cast<uint8_t>(config.int1InterruptSelection));
// set interrupt on pin INT2
spi.writeRegister(LSM6DSRXDefs::REG_INT2_CTRL,
static_cast<uint8_t>(config.int2InterruptSelection));
buf[0] = static_cast<uint8_t>(
config.int1InterruptSelection); // set interrupt on pin INT1
buf[1] = static_cast<uint8_t>(
config.int2InterruptSelection); // set interrupt on pin INT2
spi.writeRegisters(LSM6DSRXDefs::REG_INT1_CTRL, buf, 2);
// set watermark level
ui8Value = static_cast<uint8_t>(config.fifoWatermark &
buf[0] = static_cast<uint8_t>(config.fifoWatermark &
255); // the first 8bits of the number.
spi.writeRegister(LSM6DSRXDefs::REG_FIFO_CTRL1, ui8Value);
ui8Value = static_cast<uint8_t>((config.fifoWatermark >> 8) &
buf[1] = static_cast<uint8_t>((config.fifoWatermark >> 8) &
0x01); // the 9th bit of the number.
spi.writeRegister(LSM6DSRXDefs::REG_FIFO_CTRL2, ui8Value);
spi.writeRegisters(LSM6DSRXDefs::REG_FIFO_CTRL1, buf, 2);
}
bool LSM6DSRX::selfTestAcc()
......
......@@ -200,8 +200,17 @@ struct LSM6DSRXConfig
// interrupt
INTERRUPT int1InterruptSelection; ///< interrupts selected on INT1 pin.
INTERRUPT int2InterruptSelection; ///< interrupts selected on INT2 pin.
uint16_t fifoWatermark; ///< fifo watermark level (expressed as number of
///< sample). Expressed as a 9 bits number.
/**
* @brief Fifo watermark level (expressed as a 9 bits number). Warning: this
* number represents the number of samples extracted from the sensor's fifo,
* not the actual number of samples that will be present inside the driver's
* fifo `lastFifo`.
*
* The sensor's fifo max size is 511 samples, and those samples can be
* accelerometer data, gyroscope data or timestamps.
*/
uint16_t fifoWatermark;
};
} // namespace Boardcore
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment