soft_flow.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef _SOFT_FLOW_H
  2. #define _SOFT_FLOW_H
  3. #include "stdint.h"
  4. #include "stdbool.h"
  5. #include "gpio.h"
  6. #include "common.h"
  7. #define MAXPUMPCLIB_NUM 38
  8. #define CLIB_SPRAY_SPEED 500
  9. #define FlOW_KP 22
  10. #define EXTI_FALL 1
  11. #define EXTI_UP 2
  12. float flow_dete2(void);
  13. float flow_dete3(void);
  14. float flow_dete4(void);
  15. void flow_count_add(uint8_t flow_num,uint8_t exti_status);
  16. void flow_function(void);
  17. void write_flash_function(void);
  18. void L1L2_GPIO_check(void);
  19. void can_recv_mimor_flow_function(uint32_t CanID, uint8_t data[], uint8_t len);
  20. //extern bool L1_status;
  21. //extern bool L2_status;
  22. #pragma pack(1)
  23. typedef struct
  24. {
  25. uint8_t ch;
  26. uint16_t flow_speed;
  27. uint16_t total_ml;
  28. uint8_t status;
  29. uint8_t circu_time;
  30. uint8_t signal_str;
  31. uint8_t get_k_count;
  32. uint8_t send_k_count;
  33. uint16_t flow_k; //当前K
  34. uint16_t flow_calk;//校准K
  35. char soft_version[2];
  36. char sn[14];
  37. uint16_t last_total_ml;
  38. uint8_t overturn_count;
  39. }mimo_flow;
  40. extern mimo_flow flow_mimo1;
  41. extern mimo_flow flow_mimo2;
  42. #pragma pack()
  43. //霍尔流量计
  44. #pragma pack(1)
  45. typedef struct
  46. {
  47. bool count_flag;
  48. uint32_t time;
  49. uint32_t last_time;
  50. uint32_t irq_count; //单位时间内经过的液体体积
  51. uint32_t irq_last_count;
  52. bool exti_error;
  53. int speed;
  54. bool rising_delay_flag;
  55. bool falling_delay_falg;
  56. uint32_t cal_delay_time;
  57. uint8_t irq_flag;
  58. bool sem_flag;
  59. uint32_t rising_delay_time;
  60. uint32_t falling_delay_time;
  61. }flow_hl;
  62. extern flow_hl flow_dev1;
  63. extern flow_hl flow_dev2;
  64. #pragma pack()
  65. typedef struct
  66. {
  67. uint16_t speed;
  68. uint32_t flow_ml;
  69. uint16_t warn;
  70. }vk_flow;
  71. extern vk_flow flow_vkdev1;
  72. extern vk_flow flow_vkdev2;
  73. extern GPIO_PinState L3_status;
  74. extern GPIO_PinState L4_status;
  75. #endif