ramp_ctrl.h 475 B

123456789101112131415161718192021
  1. #ifndef _RAMP_CTRL_H__
  2. #define _RAMP_CTRL_H__
  3. #include "os/timer.h"
  4. typedef struct {
  5. timer_t timer;
  6. float start_point;
  7. float final_point;
  8. float target;
  9. u32 duration_ms;
  10. float steps;
  11. }ramp_t;
  12. void ramp_ctrl_init(ramp_t *ramp);
  13. void ramp_clear(ramp_t *ramp);
  14. void ramp_exc(ramp_t *ramp);
  15. float ramp_get_target(ramp_t *ramp);
  16. bool ramp_complete(ramp_t *ramp);
  17. void ramp_set_target(ramp_t *ramp, float start, float final, u32 duration_ms);
  18. #endif /* _RAMP_CTRL_H__ */