get mostly one directional comms working
This commit is contained in:
23
main/dataproc.c
Normal file
23
main/dataproc.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#define MAG_SCALE (4912.0f / 32760.0f)
|
||||
#include "dataproc.h"
|
||||
|
||||
bme680_cal_factors_t dev_cal_factors;
|
||||
|
||||
ambient_temperature = 25;
|
||||
|
||||
void mpu9250_convert_data(int16_t *accel, int16_t *gyro, int16_t temp, int16_t *magnet, float *accel_out, float *gyro_out, float *temp_out, float *magnet_out)
|
||||
{
|
||||
accel_out[0] = accel[0] / 16384.0; // Accel X in g
|
||||
accel_out[1] = accel[1] / 16384.0; // Accel Y in g
|
||||
accel_out[2] = accel[2] / 16384.0; // Accel Z in g
|
||||
|
||||
gyro_out[0] = gyro[0] / 131.0; // Gyro X in deg/s
|
||||
gyro_out[1] = gyro[1] / 131.0; // Gyro Y in deg/s
|
||||
gyro_out[2] = gyro[2] / 131.0; // Gyro Z in deg/s
|
||||
|
||||
magnet_out[0] = magnet[0] * MAG_SCALE; // Gyro X in deg/s
|
||||
magnet_out[1] = magnet[1] * MAG_SCALE; // Gyro Y in deg/s
|
||||
magnet_out[2] = magnet[2] * MAG_SCALE; // Gyro Z in deg/s
|
||||
|
||||
*temp_out = (temp / 333.87) + 21.0; // Temperature in °C
|
||||
}
|
Reference in New Issue
Block a user