22
33#include <stdint.h>
44
5+ #define MOTION_FX_STATE_SIZE (size_t)(2432)
6+
7+ /*
8+ * Bias correction thresholds from MotionFX example implementations.
9+ * Lower GBIAS_* = more correction, higher = more stability.
10+ * Adjust if drift or instability occurs.
11+ */
12+ #define GBIAS_ACC_TH_SC (2.0f * 0.000765f)
13+ #define GBIAS_GYRO_TH_SC (2.0f * 0.002f)
14+ #define GBIAS_MAG_TH_SC 0.0f
15+
16+ /*
17+ * DECIMATION controls how often sensor data is processed.
18+ * 1U = use every sample, higher = skip samples
19+ * Increase to ignore more samples if CPU usage is too high.
20+ */
21+ #define DECIMATION 1U
22+
523/**
624 * @brief initializes the lsm6dsv imu
725 * @return whether there were errors initializing the lsm6dsv imu
826 */
927uint16_t init_imu ();
1028
11- /**
12- * @brief reads and sends data from the lsm6dsv
13- * @return whether there were errors in reading/sending the data
14- */
15- uint8_t read_imu ();
16-
1729/**
1830 * @brief initializes Magnetometer for reading
1931 * @return returns tx status for errors
2032 */
2133uint16_t init_magnetometer ();
2234
2335/**
24- * @brief reads and returns the information from magnetometer
25- * @return returns any tx errors in reading from the magnetometer
36+ * @brief reads data from the lsm6dsv and lis2mdl, and performs motionfx rotation calculations
37+ * @return whether there were errors in reading the data
38+ */
39+ uint16_t read_imu_and_magnometer ();
40+
41+ /**
42+ * @brief sends data from the lsm6dsv, lis2mdl, and motionfx rotation data over CAN
43+ */
44+ void send_imu_and_magnometer_data ();
45+
46+ /**
47+ * @brief initializes the motion fx library
48+ */
49+ void motion_fx_init ();
50+
51+ /**
52+ * @brief zeros the motion fx rotation data
2653 */
27- uint16_t read_magnetometer ();
54+ void calibrate ();
2855
2956/**
3057 * @brief initializes the sht30 for reading temp and humidity
3158 * @return whether there were errors initializing the sht30
3259 */
33- uint8_t init_sht30 ();
60+ uint16_t init_sht30 ();
61+
62+ /**
63+ * @brief reads temp and humidity data from the sht30
64+ * @return whether there were errors in reading the data
65+ */
66+ uint16_t read_sht30 ();
3467
3568/**
36- * @brief reads and sends temp and humidity data from the sht30
37- * @return whether there were errors in reading/sending the data
69+ * @brief sends temp and humidity data from the sht30 over CAN
3870 */
39- uint8_t read_sht30 ();
71+ void send_sht30_data ();
0 commit comments