#ifndef __Err_code__H_ #define __Err_code__H_ #include #include #include //#define __Err_Debug__ #define Err_Code_Max 16 #define Err_Code_Max_NUM (Err_Code_Max*8) extern uint8_t Err_Code_BitMap[Err_Code_Max]; typedef struct { uint8_t index; char* data; }ErrCode_info; enum Fault_typeSDDC{ Recoverable_shutdown_failure = 0,/*可恢复停机故障*/ Unrecoverable_shutdown_failure = 1,/*不可恢复停机故障*/ First_Primary_power_limiting_fault = 2,/*一级限制功率故障*/ Second_Primary_power_limiting_fault = 3,/*二级限制功率故障*/ Third_Primary_power_limiting_fault = 4,/*三级限制功率故障*/ Fault_typeSDDC_Len = 5, }; #define ARRAY_LENGTH(arr) (sizeof(arr) / sizeof(arr[0])) struct Err_shine { uint8_t Star_Num; uint8_t Err_shine_len; }; //设置故障码 bool Err_Set(uint8_t Err_NUM); //清除故障码 bool Err_Clear(uint8_t Err_NUM); //读取故障码 bool Err_Read(uint8_t Err_NUM); //是否有故障码 bool Err_Check(void); //遍历故障码,并通过串口输出 bool Err_Traverse(void); void Print_Err(void); //查询是否有级别故障 bool Err_ScanHierarchical_fault(enum Fault_typeSDDC Fault_type); //查询先后顺序故障码 void ErrGetSequence(void); //清除全部故障码 void ErrClearSequence(void); #endif