114d93cec7
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
27 lines
585 B
C++
27 lines
585 B
C++
/*
|
|
* MotorController — 直流电机控制器
|
|
*
|
|
* 封装 PWM 调速 + GPIO 方向控制,开环占空比直驱。
|
|
* 不包含编码器反馈和 PID 闭环(开环巡线够用)。
|
|
*/
|
|
#ifndef MOTOR_CONTROLLER_H
|
|
#define MOTOR_CONTROLLER_H
|
|
|
|
#include "PwmController.h"
|
|
#include "GPIO.h"
|
|
|
|
class MotorController
|
|
{
|
|
public:
|
|
MotorController(int pwmchip, int pwmnum, int gpioNum, unsigned int period_ns);
|
|
~MotorController(void);
|
|
|
|
void updateduty(double dutyCycle); // dutyCycle: -100.0 ~ 100.0
|
|
|
|
private:
|
|
PwmController pwmController;
|
|
GPIO directionGPIO;
|
|
};
|
|
|
|
#endif
|