diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index c3cbdfe..8c6393c 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -1,6 +1,7 @@ idf_component_register(SRCS # "ble_spp_server_demo.c" "main.c" + "motor_drive.c" INCLUDE_DIRS # "../dep/" ".") diff --git a/main/motor_drive.c b/main/motor_drive.c new file mode 100644 index 0000000..93e69c0 --- /dev/null +++ b/main/motor_drive.c @@ -0,0 +1,15 @@ +#include "motor_drive.h" + +void motor_init(motor_t* motor) { return; } +void motor_set_zero_point() { return; } +/** + * @brief 返回当前电机所在位置0->360 + * + * @return uint32_t + */ +uint32_t motor_get_position_degree() { return 0; } +/** + * @brief 电机转到多少度 + */ +void motor_run_to_postion(int potion) { return; } +void motor_reg_event_cb(motor_on_event_t onevent) { return; } diff --git a/main/motor_drive.h b/main/motor_drive.h new file mode 100644 index 0000000..55656fd --- /dev/null +++ b/main/motor_drive.h @@ -0,0 +1,25 @@ +#pragma once +#include + +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);