| #ifndef ST_SENSOR_H |
| #define ST_SENSOR_H |
| |
| |
| #ifndef GRAVITY_EARTH |
| #define GRAVITY_EARTH 9.8066f |
| #endif |
| |
| #ifndef PI |
| #define PI (float)3.14159265358979323846 |
| #endif |
| |
| #define SCALE_A (0.244f ) |
| #define SCALE_G (0.07f) |
| #define SCALE_M (0.479f) |
| #define SCALE_B (4096) |
| #define SCALE_T (480) |
| #define SCALE_TIME_US2NS 1000LL |
| #define SCALE_TIME_MS2US 1000LL |
| |
| // conversion of acceleration data to SI units (m/s^2) |
| #define CONVERT_A (SCALE_A * GRAVITY_EARTH / 1000) |
| #define CONVERT_A_X (-CONVERT_A) |
| #define CONVERT_A_Y (-CONVERT_A) |
| #define CONVERT_A_Z (CONVERT_A) |
| |
| // conversion of magnetic data to uT units |
| #define CONVERT_M (SCALE_M * 1.0f/10.0f) |
| #define CONVERT_M_X (-CONVERT_M) |
| #define CONVERT_M_Y (-CONVERT_M) |
| #define CONVERT_M_Z (CONVERT_M) |
| |
| // conversion of gyro data to SI units (radian/sec) |
| #define CONVERT_G (SCALE_G * ((float)PI / 180.0f)) |
| #define CONVERT_G_X (CONVERT_G) |
| #define CONVERT_G_Y (CONVERT_G) |
| #define CONVERT_G_Z (CONVERT_G) |
| |
| // conversion of baro data to hectopascal (hPa) |
| #define CONVERT_B (SCALE_B) |
| |
| // conversion of temperature data to degree Celsius |
| #define CONVERT_T (SCALE_T) |
| |
| #endif |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |