Boen_Shi 8be2866433 feat(base): 初始化 MSPM0 开发环境
- 添加头文件和配置文件支持
- 更新.gitignore忽略编译和IDE相关文件
- 添加基础的bsp代码
2026-07-16 14:45:26 +08:00

28 lines
841 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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