alarm.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef __ALARM_H__
  2. #define __ALARM_H__
  3. #include "stdint.h"
  4. #ifdef __cplusplus
  5. extern "C"
  6. {
  7. #endif
  8. #define ERR_TOF_SPI_RW (0)
  9. #define ERR_BW_FLOW (1)
  10. #define ERR_LOW_POWER (2)
  11. #define ERR_MEMORY (3)
  12. #define ERR_BLANK_PIPE (4)
  13. #define ERR_LARGE_FLOW (5)
  14. #define ERR_CNTI_FLOW (6)
  15. #define ERR_HIGH_PRESSURE (7)
  16. #define ERR_LOW_PRESSURE (8)
  17. #define ERR_LEAK (9)
  18. #define ERR_HIGH_TEMP (10)
  19. #define ERR_LOW_TEMP (11)
  20. #define ERR_CH0 (12)
  21. #define ERR_CH1 (13)
  22. #define ERR_CH2 (14)
  23. #define ERR_CH3 (15)
  24. #define ERR_END (16)
  25. #define LOG_MCU_RESET (17)
  26. #define LOG_PARA_CRC_ERROR (18)
  27. #define LOG_SET_STATIC_OT (19)
  28. #define ALARM_START_ADDR (0x17400)
  29. #define ALARM_INFO_ADDR (0x17800)
  30. #define MAX_ALARM_NUM 64
  31. #define ALARM_DATA_SIZE 16
  32. #define ALARM_INDEX(err_no, type) ((err_no * 2) + type)
  33. typedef struct
  34. {
  35. uint8_t flag;
  36. uint8_t time[7];
  37. uint8_t err_no;
  38. uint8_t type;
  39. uint8_t arg[4];
  40. // uint8_t gcnt;
  41. uint8_t check;
  42. } alarm_t;
  43. typedef struct
  44. {
  45. uint8_t flag;
  46. uint8_t start; // 当�记录起���
  47. uint8_t end; // 当�记录最终��的下一�
  48. // uint8_t end_cnt;//当�记录计数�
  49. uint8_t num;
  50. } ALARM_INFO_DEF;
  51. extern void alarm_init(void);
  52. extern void all_alarm_status(uint32_t **status);
  53. extern uint8_t alarm_status(uint8_t err_no);
  54. extern void Alarm(uint8_t err_no, uint8_t type, uint32_t arg);
  55. // extern uint8_t read_alarm(uint8_t err_no, uint8_t type, alarm_t *alarm);
  56. uint8_t read_alaram(uint8_t num, alarm_t *alarm);
  57. extern void AlarmHandle(void);
  58. extern void get_alarm_info(ALARM_INFO_DEF *info);
  59. extern uint8_t get_alarm_num(void);
  60. extern uint8_t read_alarm(uint8_t num, alarm_t *alarm);
  61. extern void write_alarm(uint8_t err_no, uint8_t type, uint32_t arg);
  62. extern ALARM_INFO_DEF alarm_info;
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #endif