soft_flow.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #ifndef _SOFT_FLOW_H
  2. #define _SOFT_FLOW_H
  3. #include "common.h"
  4. //恩曌流量计
  5. #define CAN_MIMO_FLOW (0x210)
  6. #define CAN_MIMO_FLOW_K (0xFB)
  7. #define FlOW_KP 22
  8. //恩曌雷达版本信息应答
  9. #define CAN_MIMO_VERSION (0XFB)
  10. #pragma pack(1)
  11. typedef struct
  12. {
  13. uint8_t ch;
  14. uint16_t flow_speed;
  15. uint16_t total_ml;
  16. uint8_t status;
  17. uint8_t circu_time;
  18. uint8_t signal_str;
  19. bool get_k;
  20. bool set_k;
  21. uint16_t flow_k; //当前K
  22. uint16_t flow_calk;//校准K
  23. char soft_version[2];
  24. char sn[14];
  25. uint16_t last_total_ml;
  26. uint8_t overturn_count;
  27. }mimo_flow;
  28. #pragma pack()
  29. extern mimo_flow flow_mimo1;
  30. extern mimo_flow flow_mimo2;
  31. #pragma pack(1)
  32. typedef struct
  33. {
  34. uint16_t speed;
  35. uint16_t ml;
  36. uint8_t warn;
  37. uint16_t last_ml;
  38. uint16_t overturn;
  39. uint16_t k;
  40. uint16_t k_multiple;
  41. bool get_k;
  42. bool set_k;
  43. uint16_t cal_k;
  44. bool clear_background;
  45. }flow_info;
  46. #pragma pack()
  47. #pragma pack(1)
  48. typedef struct
  49. {
  50. uint8_t ch;
  51. flow_info ch1,ch2;
  52. }flow;
  53. #pragma pack()
  54. extern flow flow_inf;
  55. //霍尔流量计
  56. #pragma pack(1)
  57. typedef struct
  58. {
  59. bool count_flag;
  60. uint32_t time;
  61. uint32_t last_time;
  62. uint32_t irq_count; //单位时间内经过的液体体积
  63. uint32_t irq_last_count;
  64. bool exti_error;
  65. int speed;
  66. bool rising_delay_flag;
  67. bool falling_delay_falg;
  68. uint32_t cal_delay_time;
  69. uint8_t irq_flag;
  70. bool sem_flag;
  71. uint32_t rising_delay_time;
  72. uint32_t falling_delay_time;
  73. }flow_hl;
  74. extern flow_hl flow_dev1;
  75. extern flow_hl flow_dev2;
  76. #pragma pack()
  77. extern GPIO_PinState L3_status;
  78. extern GPIO_PinState L4_status;
  79. void can_recv_mimor_flow_function(uint32_t CanID, uint8_t data[], uint8_t len);
  80. void Flow_recieved_hookfuction(uint32_t cellCanID,uint8_t data[], uint8_t len);
  81. void can_sendmsg_flow(void);
  82. #endif