ir_check.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef __IR_CHECK_H__
  2. #define __IR_CHECK_H__
  3. #include "define.h"
  4. #include "user_uart.h"
  5. #include "modbus.h"
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. #define MAX_REPLAY_COUNT 3
  10. #define IR_CHECK_UART_ADDR 0xC1
  11. #define IR_CHECK_MAX_COUNT 16
  12. #define DEV_TYPE (uint16_t)193
  13. #define REG_DEV_TYPE_ADDR (uint16_t)0x0000
  14. #define REG_VERSION_ADDR (uint16_t)0x0003
  15. #define REG_COLL_STAT_ADDR (uint16_t)0x0010
  16. #define REG_COLL_COUNT_ADDR (uint16_t)0x0011
  17. #define REG_COLL_SW_01_STAT_ADDR (uint16_t)0x0020
  18. #define REG_COLL_SW_02_STAT_ADDR (uint16_t)0x0022
  19. typedef struct{
  20. uint16_t ir_01_ready:8;
  21. uint16_t ir_02_ready:8;
  22. }ir_check_ready_s;
  23. typedef struct{
  24. uint16_t count:8;
  25. uint16_t :8;
  26. }ir_check_count_s;
  27. typedef struct{
  28. uint32_t sw_idx00:2;
  29. uint32_t sw_idx01:2;
  30. uint32_t sw_idx02:2;
  31. uint32_t sw_idx03:2;
  32. uint32_t sw_idx04:2;
  33. uint32_t sw_idx05:2;
  34. uint32_t sw_idx06:2;
  35. uint32_t sw_idx07:2;
  36. uint32_t sw_idx08:2;
  37. uint32_t sw_idx09:2;
  38. uint32_t sw_idx10:2;
  39. uint32_t sw_idx11:2;
  40. uint32_t sw_idx12:2;
  41. uint32_t sw_idx13:2;
  42. uint32_t sw_idx14:2;
  43. uint32_t sw_idx15:2;
  44. }ir_check_sw_stat_s;
  45. typedef struct{
  46. uint32_t sw_stat:16;
  47. uint32_t sw_enable:16;
  48. }ir_check_sw_set_stat_s;
  49. typedef enum{
  50. IR_CHECK_DEV_TYPE = 0,
  51. IR_CHECK_COLL_REDAY_STAT,
  52. IR_CHECK_COLL_COUNT,
  53. IR_CHECK_SW_STAT,
  54. IR_CHECK_SW_SET,
  55. }ir_check_work_stat_e;
  56. typedef struct{
  57. ir_check_work_stat_e workStat;
  58. ir_check_ready_s ir_check_ready;
  59. ir_check_count_s ir_check_count;
  60. ir_check_sw_stat_s sw_stat[IR_CHECK_MAX_COUNT];
  61. ir_check_sw_set_stat_s set_stat[IR_CHECK_MAX_COUNT];
  62. bool set_stat_enable[IR_CHECK_MAX_COUNT];
  63. uint8_t set_stat_enable_idx;
  64. }ir_check_work_s;
  65. void vIr_check_init(void);
  66. void vIr_check_pro(void);
  67. void vIr_check_tick(void);
  68. #ifdef __cplusplus
  69. }
  70. #endif
  71. #endif //__IR_CHECK_H__