28 lines
841 B
C++
28 lines
841 B
C++
#ifndef MOTOR_H
|
||
#define MOTOR_H
|
||
|
||
#include "ti_msp_dl_config.h"
|
||
|
||
class Motor {
|
||
public:
|
||
static void init(); // 模块初始化
|
||
static void inject(); // 数据注入(串口、I2C回调函数注入数据)
|
||
static void setLeftSpeed(int left_speed);
|
||
static void setRightSpeed(int right_speed);
|
||
static void setSpeed(int left_speed, int right_speed);
|
||
static void stopLeft();
|
||
static void stopRight();
|
||
static void stop();
|
||
|
||
private:
|
||
static uint8_t _inited;
|
||
static uint8_t _data[];
|
||
static uint8_t motor_init; // 电机初始化标志
|
||
static void setLeftDirection(uint8_t direction);
|
||
static void setRightDirection(uint8_t direction);
|
||
static void setDirection(uint8_t left_direction, uint8_t right_direction);
|
||
static int Abs(int num); // 取绝对值函数
|
||
};
|
||
|
||
#endif //MOTOR_H
|