1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #ifndef __hal_imu_h__
- #define __hal_imu_h__
- #include <stdbool.h>
- #include <stdint.h>
- #include <string.h>
- #include "sdk_common.h"
- #include "SEGGER_RTT.h"
- #include "usr_config.h"
- #define IMU_BUFF_SIZE (LowPower_Interval * 2/10) //乘以2是为了防止fifo会满,导致fifo溢出。
- #define IMU_INIT_TIMES 1 //如果IMU初始化失败,重复初始化的次数
- #define IMU_SIGNAL_ON 1 //信号开启
- #define IMU_SIGNAL_OFF 0 //信号关闭
- //定义状态
- enum imu_state
- {
- STATE_SELF_CHECK_MODE = 1, //IMU自检模式
- STATE_LOW_POWER_MODE, //IMU低功耗模式
- STATE_FULL_POWER_MODE, //IMU全功率模式
- STATE_STANDBY_POWER_MODE, //IMU待机模式
- STATE_EXCEPT_SUSPEND_MODE //IMU异常挂起模式
- };
- //定义事件
- enum imu_event
- {
- EVENT_ENTER_SELF_CHECK_MODE = 1, //IMU开启自检模式
- EVENT_ENTER_FULL_POWER_MODE, //IMU开启全功率模式
- EVENT_ENTER_LOW_POWER_MODE, //IMU开启低功耗模式
- EVENT_ENTER_STANDBY_POWER_MODE //IMU开启待机模式
- };
- //定义信号
- typedef enum
- {
- SIGNAL_SELF_CHECK = 1, //IMU自检信号
- SIGNAL_LOW_POWER, //IMU低功耗信号
- SIGNAL_FULL_POWER, //IMU全功率信号
- SIGNAL_STANDBY_POWER //IMU待机信号
- }imu_signal;
- void IMU_Initialize(uint8_t is_host);
- void IMU_SetSlaveData(uint8_t* pdat,uint8_t len);
- int16_t IMU_Get_Front_Data_Num(void);
- void IMU_Get_Front_Data(int16_t index, int16_t *gry, int16_t *acc, int16_t *mag, int32_t *timestamp);
- void IMU_Get_Back_Data(int16_t *mag);
- /*------------------------------------------------------------------------------------------------------------------------*/
- void IMU_SetSignal(imu_signal signal, uint8_t on_off);
- uint8_t IMU_IsNoSignal(void);
- uint8_t IMU_GetCurrentMode(void);
- void IMU_PowerOffProcess(void);
- #endif
|