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

#pragma once
#include "main.h"
#include <stdbool.h>
typedef enum
{
CAMERA_ENCODER = 0X00,
DRIVEN_ENCODER_GEAR = 0X01,
ENCODER_NUMBER,
} encoder_usage_t;
typedef enum
{
ENCODER_LIGHT_COLOR_RED = 0X00,
ENCODER_LIGHT_COLOR_GREEN = 0X01,
ENCODER_LIGHT_COLOR_BLUE = 0X02,
} encoder_light_color_table_t;
typedef struct
{
TIM_HandleTypeDef *tim_handler;
uint32_t tim_channel;
int32_t count;
uint16_t last_count;
} encoder_t;
void encoder_all_start(void);
void encoder_all_stop(void);
void encoder_all_clear_counter(void);
void encoder_switch_clear_counter(encoder_usage_t encoder);
void encoder_read_with_encoder(encoder_usage_t encoder, uint32_t *encoder_value);
void encoder_light_schedule(void);
void encoder_light_switch_set_color(encoder_usage_t encoder, encoder_light_color_table_t color);
void encoder_switch_close_light(encoder_usage_t encoder);
encoder_t *encoder_get_camera_encoder_structer(void);
encoder_t *encoder_get_driven_encoder_gear_structer(void);