|
FluxSand 1.0
FluxSand - Interactive Digital Hourglass
|
#include <mpu9250.hpp>

Public Member Functions | |
| Mpu9250 (SpiDevice *spi_device, Gpio *gpio_cs, Gpio *gpio_int) | |
| void | CalibrateThreadTask () |
| void | RegisterDataCallback (const std::function< void(const Type::Vector3 &, const Type::Vector3 &)> &callback) |
| Registers a callback function to be called when new data is available. | |
| void | Initialize () |
| void | ReadData () |
| void | DisplayData () |
| void | WriteMagRegister (uint8_t reg, uint8_t value) |
| void | SaveCalibrationData () |
| void | LoadCalibrationData () |
Data Fields | |
| SpiDevice * | spi_device_ |
| Gpio * | gpio_cs_ |
| Gpio * | gpio_int_ |
| Type::Vector3 | accel_ |
| Type::Vector3 | gyro_ |
| Type::Vector3 | mag_ |
| Type::Vector3 | gyro_delta_ |
| Type::Vector3 | gyro_bias_ = {0, 0, 0} |
| float | temperature_ = 0 |
| std::function< void(const Type::Vector3 &accel, const Type::Vector3 &gyro)> | data_callback_ |
| std::thread | calibrate_thread_ |
Static Public Attributes | |
| static constexpr uint8_t | WHO_AM_I = 0x75 |
| static constexpr uint8_t | PWR_MGMT_1 = 0x6B |
| static constexpr uint8_t | PWR_MGMT_2 = 0x6C |
| static constexpr uint8_t | CONFIG = 0x1A |
| static constexpr uint8_t | SMPLRT_DIV = 0x19 |
| static constexpr uint8_t | GYRO_CONFIG = 0x1B |
| static constexpr uint8_t | ACCEL_CONFIG = 0x1C |
| static constexpr uint8_t | ACCEL_CONFIG_2 = 0x1D |
| static constexpr uint8_t | ACCEL_XOUT_H = 0x3B |
| static constexpr uint8_t | GYRO_XOUT_H = 0x43 |
| static constexpr uint8_t | USER_CTRL = 0x6A |
| static constexpr uint8_t | INT_PIN_CFG = 0x37 |
| static constexpr uint8_t | INT_ENABLE = 0x38 |
| static constexpr uint8_t | I2C_MST_CTRL = 0x24 |
| static constexpr uint8_t | I2C_MST_DELAY_CTRL = 0x67 |
| static constexpr uint8_t | I2C_SLV0_CTRL = 0x27 |
| static constexpr uint8_t | AK8963_CNTL1_REG = 0x0A |
| static constexpr uint8_t | AK8963_CNTL2_REG = 0x0B |
| static constexpr uint8_t | AK8963_CNTL2_SRST = 0x01 |
MPU9250 class
Provides initialization and data retrieval for MPU9250 via SPI.
Definition at line 25 of file mpu9250.hpp.
Constructor
| spi_device | Pointer to an SPI device object |
| gpio_cs | Pointer to a GPIO object (chip select) |
Definition at line 33 of file mpu9250.hpp.
|
inline |
Definition at line 46 of file mpu9250.hpp.
|
inline |
Definition at line 52 of file mpu9250.hpp.
|
inline |
Displays the most recently read sensor data.
Definition at line 253 of file mpu9250.hpp.
|
inline |
Initializes MPU9250 settings.
Configures power management, digital low-pass filter, sensor ranges, I2C Master mode for the magnetometer, and performs a WHO_AM_I check.
Definition at line 131 of file mpu9250.hpp.
|
inline |
Load the calibration data from a file.
Definition at line 291 of file mpu9250.hpp.
|
inline |
Reads sensor data for acceleration and gyroscope.
Definition at line 197 of file mpu9250.hpp.
|
inline |
Registers a callback function to be called when new data is available.
| callback | The callback function |
Definition at line 119 of file mpu9250.hpp.
|
inline |
Save the calibration data to a file.
Definition at line 277 of file mpu9250.hpp.
|
inline |
Writes a value to the AK8963 magnetometer via I2C.
| reg | Magnetometer register address |
| value | Value to write |
Definition at line 270 of file mpu9250.hpp.
| Type::Vector3 Mpu9250::accel_ |
Definition at line 364 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 344 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 345 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 346 of file mpu9250.hpp.
|
staticconstexpr |
AK8963 Magnetometer registers
Definition at line 356 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 357 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 358 of file mpu9250.hpp.
| std::thread Mpu9250::calibrate_thread_ |
Definition at line 376 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 341 of file mpu9250.hpp.
| std::function<void(const Type::Vector3& accel, const Type::Vector3& gyro)> Mpu9250::data_callback_ |
Definition at line 374 of file mpu9250.hpp.
| Gpio* Mpu9250::gpio_cs_ |
Definition at line 361 of file mpu9250.hpp.
| Gpio* Mpu9250::gpio_int_ |
Definition at line 362 of file mpu9250.hpp.
| Type::Vector3 Mpu9250::gyro_ |
Definition at line 365 of file mpu9250.hpp.
| Type::Vector3 Mpu9250::gyro_bias_ = {0, 0, 0} |
Definition at line 369 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 343 of file mpu9250.hpp.
| Type::Vector3 Mpu9250::gyro_delta_ |
Definition at line 367 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 347 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 351 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 352 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 353 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 350 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 349 of file mpu9250.hpp.
| Type::Vector3 Mpu9250::mag_ |
Definition at line 366 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 339 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 340 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 342 of file mpu9250.hpp.
| SpiDevice* Mpu9250::spi_device_ |
Definition at line 360 of file mpu9250.hpp.
| float Mpu9250::temperature_ = 0 |
Definition at line 371 of file mpu9250.hpp.
|
staticconstexpr |
Definition at line 348 of file mpu9250.hpp.
|
staticconstexpr |
MPU9250 register addresses
Definition at line 338 of file mpu9250.hpp.