串口ok
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
|
||||
#ifndef __INERTIALSENSOR_INVENSENSE2_H__
|
||||
#define __INERTIALSENSOR_INVENSENSE2_H__
|
||||
|
||||
#include "SPIDevice.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
enum Invensensev2_Type {
|
||||
Invensensev2_ICM20948 = 0,
|
||||
Invensensev2_ICM20648,
|
||||
Invensensev2_ICM20649
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
float accel[3];
|
||||
float gyro[3];
|
||||
uint8_t accel_count;
|
||||
uint8_t gyro_count;
|
||||
} ACCUM2_t;
|
||||
|
||||
typedef struct {
|
||||
int16_t _raw_temp;
|
||||
|
||||
float temp_sensitivity; // degC/LSB
|
||||
float temp_zero; // degC
|
||||
|
||||
float _temp_filtered;
|
||||
float _accel_scale;
|
||||
float _fifo_accel_scale;
|
||||
float _fifo_gyro_scale;
|
||||
|
||||
GPIO_TypeDef* _drdy;
|
||||
uint16_t _drdy_Pin;
|
||||
SPI_DEV_t* _dev;
|
||||
const char* name;
|
||||
bool success;
|
||||
|
||||
// which sensor type this is
|
||||
enum Invensensev2_Type _inv2_type;
|
||||
|
||||
// are we doing more than 1kHz sampling?
|
||||
bool _fast_sampling;
|
||||
|
||||
// what downsampling rate are we using from the FIFO for gyros?
|
||||
uint8_t _gyro_fifo_downsample_rate;
|
||||
|
||||
// what downsampling rate are we using from the FIFO for accels?
|
||||
uint8_t _accel_fifo_downsample_rate;
|
||||
|
||||
// what rate are we generating samples into the backend for gyros?
|
||||
uint16_t _gyro_backend_rate_hz;
|
||||
|
||||
// what rate are we generating samples into the backend for accels?
|
||||
uint16_t _accel_backend_rate_hz;
|
||||
|
||||
// Last status from register user control
|
||||
uint8_t _last_stat_user_ctrl;
|
||||
|
||||
// buffer for fifo read
|
||||
uint8_t *_fifo_buffer;
|
||||
|
||||
uint8_t _current_bank;
|
||||
float _clip_limit;
|
||||
|
||||
/*
|
||||
accumulators for sensor_rate sampling
|
||||
See description in _accumulate_sensor_rate_sampling()
|
||||
*/
|
||||
ACCUM2_t _accum;
|
||||
} InertialSensor_Invensensev2_t;
|
||||
|
||||
bool InertialSensor_Invensensev2_init(InertialSensor_Invensensev2_t *imu, const char *name, SPI_DEV_t* dev, GPIO_TypeDef* drdy, uint16_t drdy_Pin);
|
||||
|
||||
void InertialSensor_Invensensev2_update(InertialSensor_Invensensev2_t *imu);
|
||||
|
||||
#endif /* __INERTIALSENSOR_INVENSENSE2_H__ */
|
||||
|
||||
Reference in New Issue
Block a user