You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1004 B

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. #pragma once
  2. #include "main.h"
  3. #include <stdbool.h>
  4. typedef enum
  5. {
  6. CAMERA_ENCODER = 0X00,
  7. DRIVEN_ENCODER_GEAR = 0X01,
  8. ENCODER_NUMBER,
  9. } encoder_usage_t;
  10. typedef enum
  11. {
  12. ENCODER_LIGHT_COLOR_RED = 0X00,
  13. ENCODER_LIGHT_COLOR_GREEN = 0X01,
  14. ENCODER_LIGHT_COLOR_BLUE = 0X02,
  15. } encoder_light_color_table_t;
  16. typedef struct
  17. {
  18. TIM_HandleTypeDef *tim_handler;
  19. uint32_t tim_channel;
  20. int32_t count;
  21. uint16_t last_count;
  22. } encoder_t;
  23. void encoder_all_start(void);
  24. void encoder_all_stop(void);
  25. void encoder_all_clear_counter(void);
  26. void encoder_switch_clear_counter(encoder_usage_t encoder);
  27. void encoder_read_with_encoder(encoder_usage_t encoder, uint32_t *encoder_value);
  28. void encoder_light_schedule(void);
  29. void encoder_light_switch_set_color(encoder_usage_t encoder, encoder_light_color_table_t color);
  30. void encoder_switch_close_light(encoder_usage_t encoder);
  31. encoder_t *encoder_get_camera_encoder_structer(void);
  32. encoder_t *encoder_get_driven_encoder_gear_structer(void);