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.

34 lines
942 B

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. STANDBY = 0X00,
  13. WORKING = 0X01,
  14. ENCODER_STATE_NUMBER_AND_ERR_STATE,
  15. } encoder_light_state_t;
  16. typedef struct
  17. {
  18. TIM_HandleTypeDef *tim_handler;
  19. uint32_t tim_channel;
  20. } encoder_t;
  21. void encoder_all_start(void);
  22. void encoder_all_stop(void);
  23. bool encoder_clear_counter(encoder_usage_t encoder);
  24. void encoder_all_clear_counter(void);
  25. bool encoder_read_with_encoder(encoder_usage_t encoder, uint32_t *encoder_value);
  26. void encoder_light_schedule(void);
  27. void encoder_set_state(encoder_usage_t encoder, encoder_light_state_t state);
  28. encoder_light_state_t encoder_get_state(encoder_usage_t encoder);
  29. void encoder_all_encoder_clear_counter_and_structer_count(void);
  30. void encoder_switch_encoder_clear_count_and_structer_count(encoder_usage_t encoder);