12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #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 20 //如果IMU初始化失败,重复初始化的次数
- #define IMU_SIGNAL_ON 1 //信号开启
- #define IMU_SIGNAL_OFF 0 //信号关闭
- //定义状态
- enum imu_state
- {
- STATE_SELF_CHECK_MODE = 1, //鞋子自检模式
- STATE_LOW_POWER_MODE, //鞋子低功耗模式
- STATE_FULL_POWER_MODE, //鞋子全功率模式
- STATE_STANDBY_POWER_MODE //鞋子待机模式
- };
- //定义事件
- enum imu_event
- {
- EVENT_ENTER_SELF_CHECK_MODE = 1, //开启自检模式
- EVENT_ENTER_FULL_POWER_MODE, //开启全功率模式
- EVENT_ENTER_LOW_POWER_MODE, //开启低功耗模式
- EVENT_ENTER_STANDBY_POWER_MODE //开启待机模式
- };
- //定义信号
- typedef enum
- {
- SIGNAL_SELF_CHECK = 1, //自检信号
- SIGNAL_LOW_POWER, //低功耗信号
- SIGNAL_FULL_POWER, //全功率信号
- SIGNAL_STANDBY_POWER //待机信号
- }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
|