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.
26 lines
545 B
26 lines
545 B
#pragma once
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
|
|
typedef struct {
|
|
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);
|
|
double motor_drive_read_encoder();
|