197 unsigned short samplingRate = 100,
214 bool init()
override;
229 void selectAutoClock();
252 void setSampleRate(
unsigned short rate);
254 void enableMpuI2CMasterInterface();
261 void setI2CMasterSlaveRead(uint8_t addr, uint8_t reg, uint8_t nBytes = 1,
267 void setI2CMasterSlaveWrite(uint8_t addr, uint8_t reg, uint8_t data,
273 void disableI2CMasterSlave(uint8_t slave = 0);
281 uint8_t readFromAk(uint8_t reg);
289 void writeToAk(uint8_t reg, uint8_t data);
310 bool checkAkWhoAmI();
312 inline void writeSPIWithDelay(
SPITransaction& transaction, uint8_t reg,
315 inline float normalizeAcceleration(int16_t rawValue);
317 inline float normalizeTemperature(int16_t rawValue);
319 inline float normalizeGyroscope(int16_t rawValue);
321 inline float normalizeMagnetometer(int16_t rawValue,
float adjustmentCoeff);
325 const unsigned short samplingRate;
329 float magSensAdjCoeff[3];
331 bool initialized =
false;
static PrintLogger getLogger(const string &name)
Driver class for MPU9250.
const float GYROSCOPE_FS_MAP[4]
static constexpr uint8_t AK8963_REG_CNTL1_SELF_TEST_MODE
static constexpr uint8_t REG_WHO_AM_I_VAL
static constexpr uint8_t AK8963_REG_CNTL1_SINGLE_MES_MODE
bool selfTest() override
Self test.
static constexpr uint8_t REG_I2C_SLV_CTRL_EN
static constexpr uint8_t AK8963_REG_CNTL1_FUSE_ROM_ACCESS_MODE
static constexpr uint8_t AK8963_REG_WHO_AM_I_VAL
MPU9250(SPIBusInterface &bus, miosix::GpioPin cs, SPIBusConfig config=getDefaultSPIConfig(), unsigned short samplingRate=100, GyroFSR gyroFsr=GYRO_FSR_250DPS, AccelFSR accelFsr=ACCEL_FSR_2G)
Instantiates the driver.
static constexpr uint8_t REG_USER_CTRL_I2C_MST_EN
static constexpr uint8_t AK8963_REG_CNTL1_BIT_16_BIT_OUT
static constexpr uint8_t REG_PWR_MGMT_1_BIT_H_RESET
static constexpr uint8_t REG_CONFIG_DLPF_CFG_1
static constexpr uint8_t AK8963_REG_CNTL1_CONT_MES_MODE_1
static constexpr uint8_t AK8963_REG_CNTL1_CONT_MES_MODE_2
bool init() override
Initialize the device.
static constexpr uint8_t AK8963_REG_CNTL1_POWER_DOWN_MODE
static constexpr uint8_t REG_PWR_MGMT_1_CLKSEL_AUTO
const float ACCELERATION_FS_MAP[4]
static constexpr uint8_t AK8963_ADDR
MPU9250Data sampleImpl() override
Read a data sample from the sensor. In case of errors, the method should return the last available co...
static SPIBusConfig getDefaultSPIConfig()
Constructs the default config for SPI Bus.
static constexpr uint8_t AK8963_REG_CNTL2_BIT_SRST
Interface for low level access of a SPI bus as a master.
Provides high-level access to the SPI Bus for a single transaction.
Base sensor class with has to be extended by any sensor driver.
This file includes all the types the logdecoder script will decode.
SPI Bus configuration for a specific slave.
Contains information about a single SPI slave device.
struct __attribute__((packed)) MPU9250RawDataBits