throttle.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef _THROTTLE_H__
  2. #define _THROTTLE_H__
  3. #define THRO1_5V_ERR_BIT 0x01
  4. #define THRO2_5V_ERR_BIT 0x02
  5. #define THRO1_SIG_ERR_BIT 0x04
  6. #define THRO2_SIG_ERR_BIT 0x08
  7. #define THRO_NOT_RELEASED 0x10
  8. typedef struct {
  9. bool accl;
  10. float torque_req;
  11. float torque_real;
  12. float torque_acc_;
  13. float vel_filted;
  14. float thro_ration;
  15. float thro_ration_last;
  16. u8 gear;
  17. }throttle_torque_t;
  18. void throttle_init(void);
  19. bool throttle_is_released(void);
  20. bool throttle_is_all_error(void);
  21. bool throttle_not_released_err(void);
  22. u8 throttle_get_errors(void);
  23. float throttle_get_signal(void);
  24. void throttle_detect(bool ready);
  25. bool throttle1_is_error(void);
  26. bool throttle2_is_error(void);
  27. float throttle_start_vol(void);
  28. float throttle_end_vol(void);
  29. float throttle_vol_range(void);
  30. void throttle_set_torque(mot_contrl_t * ctrl, float torque);
  31. float throttle_get_torque(mot_contrl_t * ctrl, float vol);
  32. float throttle_get_open_ration_filted(void);
  33. float get_user_request_torque(void);
  34. float throttle_open_ration_to_vol(float r);
  35. float throttle_vol_to_open_ration(float thro_val);
  36. void throttle_torque_reset(void);
  37. #endif /* _THROTTLE_H__ */