|
@ -0,0 +1,25 @@ |
|
|
|
|
|
#pragma once |
|
|
|
|
|
#include <stdint.h> |
|
|
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
|
|
int mark; |
|
|
|
|
|
// int uartNum; |
|
|
|
|
|
} motor_t; |
|
|
|
|
|
typedef enum { |
|
|
|
|
|
kRunToPosition, |
|
|
|
|
|
} motor_event_t; |
|
|
|
|
|
typedef void (*motor_on_event_t)(motor_event_t event); |
|
|
|
|
|
|
|
|
|
|
|
void motor_init(motor_t* motor); |
|
|
|
|
|
void motor_set_zero_point(); |
|
|
|
|
|
/** |
|
|
|
|
|
* @brief 返回当前电机所在位置0->360 |
|
|
|
|
|
* |
|
|
|
|
|
* @return uint32_t |
|
|
|
|
|
*/ |
|
|
|
|
|
uint32_t motor_get_position_degree(); |
|
|
|
|
|
/** |
|
|
|
|
|
* @brief 电机转到多少度 |
|
|
|
|
|
*/ |
|
|
|
|
|
void motor_run_to_postion(int potion); |
|
|
|
|
|
void motor_reg_event_cb(motor_on_event_t onevent); |