van_BSP_Com_Pwm.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /******************************************************************************
  2. *Copyright(C),2024-2024,万众一芯生
  3. *van_BSP_Pwm_pump.h
  4. * pwm 控制泵阀驱动
  5. *修改历史
  6. author 范义东 新建 2024/01/27
  7. ******************************************************************************/
  8. #ifndef __VAN_BSP_COM_PWM_H
  9. #define __VAN_BSP_COM_PWM_H
  10. #include "van_com_define.h"
  11. #define MAX_PWM_VALUE 999
  12. typedef enum
  13. {
  14. PWM_CHIPKK5 = 30000,
  15. PWM_PIPE = 30001,
  16. PWM_TOPCON = 30002,
  17. PWM_BOTCON = 30003,
  18. PWM_PERIS1 = 30020,
  19. PWM_PERIS2 = 30021,
  20. PWM_DIAPHR = 30022,
  21. } enPWM_004_V1;
  22. typedef enum {
  23. PWM_BUMP_ST_IDLE,
  24. PWM_BUMP_ST_RUN,
  25. PWM_BUMP_ST_FEEDERR, /*转速反馈异常*/
  26. } COM_PWM_State;
  27. typedef enum {
  28. COM_PWM_BASE,
  29. COM_PWM_8870, /*带方向*/
  30. COM_PWM_8873, /*带转速反馈*/
  31. COM_PWM_DIR_FEED_CNT, /*带方向转速反馈*/
  32. } COM_PWM_Type;
  33. typedef struct {
  34. unsigned int ID; //泵编号
  35. unsigned char Name[16]; //泵名
  36. COM_PWM_State state; //状态
  37. COM_PWM_Type type; //类型
  38. void* timerHandle; /*定时器端口*/
  39. unsigned int pwmChanle; /*定时器通道*/
  40. void* feedbackTimer; /*反馈定时器*/
  41. unsigned int feedbackChanlen; /*反馈通道*/
  42. void* dirPort; /*方向端口*/
  43. unsigned int dirPin; /*方向管脚*/
  44. unsigned int dirState; // 正向电平
  45. unsigned int feedbackconter; /*反馈脉冲数*/
  46. float setValue; /*设定值*/
  47. float getValue; /*反馈值*/
  48. float range_Max; /*范围*/
  49. float range_Min; /*范围*/
  50. unsigned int plusconter; /*转动脉冲计数*/
  51. } VAN_COM_PWM_Def, *P_VAN_COM_PWM_Def;
  52. void com_pwm_Set(unsigned int devId, float value);
  53. unsigned int com_pwm_Getconter(unsigned int devId);
  54. bool com_pwm_test(unsigned int Id, int value);
  55. void show_com_pwm(void);
  56. bool com_pwm_FindChanle(unsigned int devId, P_VAN_COM_PWM_Def *pdev);
  57. bool PWM_Find_feed_By_ch(unsigned int devId, P_VAN_COM_PWM_Def *pdev);
  58. void Paltform_Set_PWM_Pause(unsigned int id);
  59. void Paltform_Set_PWM_Resume(unsigned int id);
  60. void thread_Proportiona_ctrl(void* );
  61. void com_feed_Add_Pulse(uint16_t GPIO_Pin);
  62. void check_Pwm_Plus_feedOK(void);
  63. void Paltform_Get_PWM_Current(void *param);
  64. void Paltform_Set_PWM_Goal(void *param) ;
  65. void Paltform_Set_PWM_Stop(void *param);
  66. unsigned int load_com_pwm_Cfg(pDeviceBasicInfdef pDevice);
  67. #endif