初始提交:龙芯2K0300智能车卖家Demo完整代码

This commit is contained in:
spdis
2026-05-28 15:24:33 +08:00
commit b6b631cef3
80 changed files with 7153 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
/*
* @Author: ilikara 3435193369@qq.com
* @Date: 2024-10-10 14:36:47
* @LastEditors: ilikara 3435193369@qq.com
* @LastEditTime: 2025-03-21 10:42:00
* @FilePath: /smartcar/lib/MotorController.h
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
#ifndef MOTOR_CONTROLLER_H
#define MOTOR_CONTROLLER_H
#include "PwmController.h"
#include "PIDController.h"
#include "GPIO.h"
#include "encoder.h"
class MotorController
{
public:
MotorController(int pwmchip, int pwmnum, int gpioNum, unsigned int period_ns,
double kp, double ki, double kd, double targetSpeed,
int encoder_pwmNum, int encoder_gpioNum, int encoder_dir_);
~MotorController(void);
void updateSpeed(void);
void updateTarget(int speed);
void updateduty(double dutyCycle);
PIDController pidController;
private:
PwmController pwmController;
ENCODER encoder;
GPIO directionGPIO;
int encoder_dir;
};
#endif // MOTOR_CONTROLLER_H