#ifndef __DETECTOR_H #define __DETECTOR_H #ifdef __cplusplus extern "C" { #endif /* Header File Including ------------------------------------------------------------------------ */ #include #include #include #include "pdr_base.h" #include "buffer.h" #include "pdr_ahrs.h" /* Macro Declaration ---------------------------------------------------------------------------- */ #define DETECTOR_NO_ERROR 0 #define DETECTOR_OUT_OF_MEMORY 1 #define MAG_BUF_LEN 256 #define MAG_LEN 6 /* Struct Declaration --------------------------------------------------------------------------- */ typedef void (*DETECTOR_update_callback)(DETECTOR *detector); /* Global Variable Declaration ------------------------------------------------------------------ */ extern BUFFER_SHORT g_acc_frq_buf[3]; extern BUFFER_SHORT g_acc_amp_buf[3]; extern BUFFER_SHORT g_gyr_frq_buf[3]; extern BUFFER_SHORT g_gyr_amp_buf[3]; /* Function Declaration ------------------------------------------------------------------------- */ /**--------------------------------------------------------------------- * Function : pdr_getDetector * Description : 获取PDR运动分类器的结构体指针 * Date : 2020/02/16 yuanlin_rjyb@vivo.com & zhanli@vivo.com *---------------------------------------------------------------------**/ DETECTOR *pdr_getDetector(void); /**--------------------------------------------------------------------- * Function : pdr_initDetector * Description : 初始化运动分类器,识别用户处于哪一种运动模式 * Date : 2020/02/16 yuanlin_rjyb@vivo.com & zhanli@vivo.com *---------------------------------------------------------------------**/ DETECTOR* pdr_initDetector(void); /**--------------------------------------------------------------------- * Function : pdr_resetDetector * Description : 重置PDR运动分类器 * Date : 2020/02/16 yuanlin_rjyb@vivo.com & zhanli@vivo.com *---------------------------------------------------------------------**/ void pdr_resetDetector(void); /**--------------------------------------------------------------------- * Function : pdr_motionTypeDetect * Description : pdr运动类型检测 * Date : 2020/7/20 yuanlin_rjyb@vivo.com *---------------------------------------------------------------------**/ int pdr_motionTypeDetect(void); /**--------------------------------------------------------------------- * Function : predict * Description : 判断手机携带方式(静止、手持、摆手等) * Date : 2020/7/20 yuanlin_rjyb@vivo.com *---------------------------------------------------------------------**/ int pdr_detectorPredict(float* feature); void mag_calibration(IMU *imu); void mag_m_trans(float a[MAG_BUF_LEN][3], float r[3][MAG_BUF_LEN]); void mag_min(float a[MAG_BUF_LEN], float *mag_min); void mag_max(float a[MAG_BUF_LEN], float *mag_max); void mag_rand(float r[6]); void updateDetectorImu(imu* imu); #ifdef __cplusplus } #endif #endif