42 lines
612 B
C
42 lines
612 B
C
|
#ifndef __GYRO_H
|
||
|
#define __GYRO_H
|
||
|
|
||
|
|
||
|
#include "public_data.h"
|
||
|
#include "filter.h"
|
||
|
#include "icm42688p.h"
|
||
|
//#include "flash_data.h"
|
||
|
|
||
|
#define XYZ_AXIS_COUNT 3
|
||
|
|
||
|
#define CALIBRATING_GYRO_CYCLES 500
|
||
|
|
||
|
|
||
|
|
||
|
typedef struct gyroCalibration_s
|
||
|
{
|
||
|
Axis3i32 gyroSum;
|
||
|
Axis3i16 gyroZero;
|
||
|
stdev_t var[XYZ_AXIS_COUNT];
|
||
|
uint16_t cycleCount;
|
||
|
int ok;
|
||
|
int8_t gyroZeroFlashSign;
|
||
|
} gyroCalibration_t;
|
||
|
|
||
|
|
||
|
|
||
|
extern Axis3i16 gyroADC;
|
||
|
extern gyroCalibration_t gyroCalibration;
|
||
|
|
||
|
bool GYRO_Calibration(void);
|
||
|
void gyroUpdate(Axis3f *gyro);
|
||
|
bool gyroInit(float gyroUpdateRate);
|
||
|
void GYRO_Calibration_write(uint8_t data);
|
||
|
|
||
|
|
||
|
|
||
|
#endif
|
||
|
|
||
|
|
||
|
|