#ifndef __ALARM_H__ #define __ALARM_H__ #include "stdint.h" #ifdef __cplusplus extern "C" { #endif #define ERR_TOF_SPI_RW (0) #define ERR_BW_FLOW (1) #define ERR_LOW_POWER (2) #define ERR_MEMORY (3) #define ERR_BLANK_PIPE (4) #define ERR_LARGE_FLOW (5) #define ERR_CNTI_FLOW (6) #define ERR_HIGH_PRESSURE (7) #define ERR_LOW_PRESSURE (8) #define ERR_LEAK (9) #define ERR_HIGH_TEMP (10) #define ERR_LOW_TEMP (11) #define ERR_CH0 (12) #define ERR_CH1 (13) #define ERR_CH2 (14) #define ERR_CH3 (15) #define ERR_END (16) #define LOG_MCU_RESET (17) #define LOG_PARA_CRC_ERROR (18) #define LOG_SET_STATIC_OT (19) #define ALARM_START_ADDR (0x17400) #define ALARM_INFO_ADDR (0x17800) #define MAX_ALARM_NUM 64 #define ALARM_DATA_SIZE 16 #define ALARM_INDEX(err_no, type) ((err_no * 2) + type) typedef struct { uint8_t flag; uint8_t time[7]; uint8_t err_no; uint8_t type; uint8_t arg[4]; // uint8_t gcnt; uint8_t check; } alarm_t; typedef struct { uint8_t flag; uint8_t start; // 当前记录起?位? uint8_t end; // 当前记录最终位?的下一? // uint8_t end_cnt;//当前记录计数? uint8_t num; } ALARM_INFO_DEF; extern void alarm_init(void); extern void all_alarm_status(uint32_t **status); extern uint8_t alarm_status(uint8_t err_no); extern void Alarm(uint8_t err_no, uint8_t type, uint32_t arg); // extern uint8_t read_alarm(uint8_t err_no, uint8_t type, alarm_t *alarm); uint8_t read_alaram(uint8_t num, alarm_t *alarm); extern void AlarmHandle(void); extern void get_alarm_info(ALARM_INFO_DEF *info); extern uint8_t get_alarm_num(void); extern uint8_t read_alarm(uint8_t num, alarm_t *alarm); extern void write_alarm(uint8_t err_no, uint8_t type, uint32_t arg); extern ALARM_INFO_DEF alarm_info; #ifdef __cplusplus } #endif #endif