12 #ifndef _MPU_MATH_HPP_
13 #define _MPU_MATH_HPP_
17 #include "sdkconfig.h"
25 inline namespace math {
40 return 131.f / (1 << fs);
88 #if defined CONFIG_MPU6500 || defined CONFIG_MPU9250
93 #elif defined CONFIG_MPU6000 || defined CONFIG_MPU6050 || defined CONFIG_MPU9150
112 #if defined CONFIG_MPU_AK89xx
113 inline int16_t
magAdjust(
const int16_t axis,
const uint8_t adjValue) {
116 constexpr
float factor = 0.5f / 128;
117 return axis * ((adjValue - 128) * factor + 1);
gyro_fs_t
Gyroscope full-scale range.
Definition: types.hpp:51
constexpr float kTempSensitivity
Definition: math.hpp:91
float gyroRadPerSec(const int16_t axis, const gyro_fs_t fs)
Definition: math.hpp:75
float accelGravity(const int16_t axis, const accel_fs_t fs)
Definition: math.hpp:51
constexpr int16_t kRoomTempOffset
Definition: math.hpp:89
constexpr float kTempResolution
Definition: math.hpp:99
Declare Types and Definitions used within mpud namespace.
float tempFahrenheit(const int16_t temp)
Definition: math.hpp:108
float accelResolution(const accel_fs_t fs)
Definition: math.hpp:43
accel_fs_t
Accel full-scale range.
Definition: types.hpp:59
axes_t< float > float_axes_t
Axes type to hold converted sensor data.
Definition: types.hpp:493
uint8_t accelFSRvalue(const accel_fs_t fs)
Definition: math.hpp:27
float gyroSensitivity(const gyro_fs_t fs)
Definition: math.hpp:39
constexpr float kCelsiusOffset
Definition: math.hpp:90
axes_t< int16_t > raw_axes_t
Axes type to hold gyroscope, accelerometer, magnetometer raw data.
Definition: types.hpp:492
uint16_t accelSensitivity(const accel_fs_t fs)
Definition: math.hpp:35
float gyroResolution(const gyro_fs_t fs)
Definition: math.hpp:47
constexpr float kFahrenheitOffset
Definition: math.hpp:100
int16_t magAdjust(const int16_t axis, const uint8_t adjValue)
Definition: math.hpp:113
float gyroDegPerSec(const int16_t axis, const gyro_fs_t fs)
Definition: math.hpp:63
float tempCelsius(const int16_t temp)
Definition: math.hpp:103
uint16_t gyroFSRvalue(const gyro_fs_t fs)
Definition: math.hpp:31