25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

84 satır
1.4KB

  1. #ifndef CONTROLLER_H
  2. #define CONTROLLER_H
  3. #include "event.h"
  4. #include "gb_math.h"
  5. #include "stepper.h"
  6. #include "servo.h"
  7. #include "path.h"
  8. #include "angle.h"
  9. #ifndef SERVO_RAISED
  10. #define SERVO_RAISED (500U)
  11. #endif
  12. #ifndef SERVO_LOWERED
  13. #define SERVO_LOWERED (750U)
  14. #endif
  15. #define VEL_DIV 1024
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. enum {
  20. CONTROLLER_OK = 0,
  21. CONTROLLER_ERR = -1,
  22. CONTROLLER_NO_PATH = -2,
  23. CONTROLLER_STATISFIED = -3,
  24. };
  25. typedef struct {
  26. stepper_t *stepper_a;
  27. stepper_t *stepper_b;
  28. uint32_t time_step;
  29. servo_t *servo;
  30. bool lifted;
  31. path_t *path;
  32. thread_flags_t flags;
  33. } controller_t;
  34. /**
  35. * @brief Initialize controller
  36. *
  37. * @param[out] control struct describing the controller
  38. */
  39. int controller_init(controller_t *control);
  40. /**
  41. * @brief execute main loop of the controller
  42. *
  43. * @param[in] control struct describing the controller
  44. */
  45. int controller_loop(controller_t *control);
  46. /**
  47. * @brief home both stepper motors
  48. *
  49. * @param[in] control struct describing the controller
  50. */
  51. int controller_home(controller_t *control);
  52. /**
  53. * @brief lower the marker position
  54. *
  55. * @param[in] control struct describing the controller
  56. */
  57. void controller_lower_marker(controller_t *control);
  58. /**
  59. * @brief raise the marker position
  60. *
  61. * @param[in] control struct describing the controller
  62. */
  63. void controller_raise_marker(controller_t *control);
  64. #ifdef __cplusplus
  65. }
  66. #endif
  67. #endif /* CONTROLLER_H */