#ifndef __EXCEPTION_H__ #define __EXCEPTION_H__ #ifdef __cplusplus extern "C" { #endif /*Includes ------------------------------------------------------*/ #include #include /*STRUCTION -----------------------------------------------------*/ typedef struct { float preBestResult_Voltage2power ; float preBestResult_chargeV2P_f ; float P_mAh ; float kg ; float P2 ; float P1 ; float Battery_capacity_mAh ; float adc_tp4056_power ; char init; char sta ; char chargeV2P_f_init; char Voltage2power_init; } battercb_t; //EXCEPT分级 : 0~100 正常通知;100~150 警告 150以上 错误{}错误会通过企业微信推送 typedef enum { //数据异常 EXCEPT_DATA_BACK_MAG =0, //异常 —— 后脚地磁数据 EXCEPT_DATA_FRONT_ACC, //异常 —— 前脚加速度数据 EXCEPT_DATA_FRONT_GRY, //异常 —— 前脚陀螺仪数据 EXCEPT_DATA_FRONT_MAG, //异常 —— 前脚地磁数据 EXCEPT_DATA_CHARGE, //异常 —— 充电数据 EXCEPT_DATA_BATTERY, //异常 —— 电池数据 EXCEPT_IMU_SUSPEND_OVERFLOW, //异常 —— 持续处于异常挂起模式 EXCEPT_ANT_DAMAGE, //异常 —— 天线损坏 EXCEPT_FLASH, //异常 —— FLASH错误 EXCEPT_GAME, //异常 —— 游戏模式错误 EXCEPT_RealStep, //异常 —— 实时脚步异常 EXCEPT_DATEStep, //异常 —— 日常脚步异常 EXCEPT_Pair, //异常 —— 配对异常 EXCEPT_Power, //异常 —— 低功耗 EXCEPT_DFU, //异常 —— 远程升级异常 EXCEPT_CONNET, //异常 —— 连接右鞋错误 EXCEPT_OVERTURAN, //异常 —— 翻转查看电量异常 EXCEPT_UNKOWN_RESET, //异常 —— 未知重启 EXCEPT_ADC_INIT, //异常 —— adc初始化失败 EXCEPT_SPI_INIT, //异常 —— spi初始化失败 EXCEPT_SPI_RW, //异常 —— spi读写失败 EXCEPT_IIC_RW, //异常 —— IIC读写失败 EXCEPT_FLASH_INIT, //异常 —— flash初始化失败 EXCEPT_PWM_INIT, //异常 —— pwm初始化失败 EXCEPT_WDT_INIT, //异常 —— wdt初始化失败 EXCEPT_RTC_INIT, //异常 —— rtc初始化失败 EXCEPT_RTC_CONFIG, //异常 —— rtc配置失败 EXCEPT_EXCEPTION, //异常 —— 无异常 EXCEPT_QMA7981, //异常 —— QMA7981 EXCEPT_NUM, //异常 —— 异常类型数量 }ExcepType_t; /*API -------------------------------------------------------*/ void Exception_Init(void); void Except_SetExceptype(ExcepType_t excep_type); void Except_ClearExceptype(ExcepType_t excep_type); bool Except_IsError(ExcepType_t excep_type); int Except_TxError(ExcepType_t excep_type,const char *errstr); void Except_Get_Cur_Porcess_ID(uint32_t cur_process_id); void Except_Get_End_Porcess_ID(uint32_t end_process_id); void Except_Unkown_Reset_WDT_Set(void); int Except_Display(ExcepType_t excep_type,const char *errstr); /** @brief 获取电量记录缓存区地址 @return 电量记录缓存区地址 */ battercb_t* Except_Get_Battery_Record_Buff(void); #ifdef __cplusplus } #endif #endif