Выполняется корректное чтение данных иму. Оси и наклоны соответствуют рабочим прошивке и дрону
This commit is contained in:
@@ -5,18 +5,19 @@
|
||||
|
||||
#include "stm32g431xx.h"
|
||||
|
||||
#define ICM_ADDR 0x68
|
||||
#define ICM_ADDR 0x68
|
||||
#define REG_PWR_MGMT_1 0x06
|
||||
#define REG_BANK_SEL 0x7F
|
||||
#define REG_BANK_SEL 0x7F
|
||||
#define REG_GYRO_CONFIG_1 0x01
|
||||
#define REG_ACCEL_CONFIG 0x14
|
||||
#define IMU_DT 0.002f // 2 ms
|
||||
#define IMU_DT 0.002f // 2 ms
|
||||
|
||||
#define GYRO_FS_SEL_2000 3 << 1
|
||||
#define GYRO_DLPFCFG_73 3 << 3
|
||||
#define GYRO_FCHOICE_ON 1
|
||||
#define GYRO_FCHOICE_OFF 0
|
||||
|
||||
#define ACCEL_FS_SEL_4 1 << 1
|
||||
#define ACCEL_FS_SEL_8 2 << 1
|
||||
#define ACCEL_DLPFCFG_69 3 << 3
|
||||
#define ACCEL_FCHOICE_ON 1
|
||||
@@ -24,8 +25,8 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float ax, ay, az; // lsb
|
||||
float gx, gy, gz; // lsb
|
||||
int16_t ax, ay, az; // lsb
|
||||
int16_t gx, gy, gz; // lsb
|
||||
} imu_raw_t;
|
||||
|
||||
void imu_pow_init();
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
#include "imu.h"
|
||||
|
||||
|
||||
#define ACCEL_SENS_SCALE_FACTOR 8192.0f
|
||||
#define ACCEL_SENS_SCALE_FACTOR 4096.0f
|
||||
#define GYRO_SENS_SCALE_FACTOR 16.4f
|
||||
#define PI 3.14159265359f
|
||||
#define DEG2RAD PI / 180.0f
|
||||
#define PI 3.14159265359f
|
||||
#define DEG2RAD PI / 180.0f
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -19,6 +19,7 @@ void imu_processing_init();
|
||||
|
||||
void imu_read_scaled(imu_scaled_t* out, const uint8_t* allowed_calib);
|
||||
void imu_calib(imu_raw_t* imu, long gyrLim, long accZero, long accMax);
|
||||
uint16_t Rev16(uint16_t v);
|
||||
|
||||
void imu_calibrate();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user