给函数和声明添加中文注释并将注释翻译成中文 A4988 - Stepper Motor Driver Driver Indexer mode only Copyright C2015 Laurentiu Badea This file may be redistributed under the terms of the MIT license A copy of this lice
/*
- A4988 - 步进电机驱动器
- 仅支持索引器模式。
- 版权所有(C)2015 Laurentiu Badea
- 本文件可以在MIT许可证的条款下重新分发。
- 在此发布的文件中已包含此许可证的副本。 */ #ifndef A4988_H #define A4988_H #include <Arduino.h> #include "BasicStepperDriver.h"
class A4988 : public BasicStepperDriver { protected: static const uint8_t MS_TABLE[]; // 微步表 short ms1_pin = PIN_UNCONNECTED; // MS1引脚 short ms2_pin = PIN_UNCONNECTED; // MS2引脚 short ms3_pin = PIN_UNCONNECTED; // MS3引脚 // tA STEP 最小值,高电平脉宽(1微秒) static const int step_high_min = 1; // tB STEP 最小值,低电平脉宽(1微秒) static const int step_low_min = 1; // 唤醒时间,nSLEEP 未激活到 STEP(1000微秒) static const int wakeup_time = 1000; // ENBL/DIR/MSx 改变和 STEP HIGH 之间也需要 200ns
// 获取微步表
virtual const uint8_t* getMicrostepTable();
virtual size_t getMicrostepTableSize();
// 获取设备支持的最大微步数
short getMaxMicrostep() override;
private: // 微步范围 (1, 16, 32 等) static const short MAX_MICROSTEP = 16;
public: /* * 基本连接: 只连接 DIR, STEP。 * 微步控制应硬连线。 */ A4988(short steps, short dir_pin, short step_pin); A4988(short steps, short dir_pin, short step_pin, short enable_pin);
void begin(float rpm=60, short microsteps=1); // 初始化
/*
* 完全连接。所有必要的 A4988 控制引脚都已连接。
*/
A4988(short steps, short dir_pin, short step_pin, short ms1_pin, short ms2_pin, short ms3_pin);
A4988(short steps, short dir_pin, short step_pin, short enable_pin, short ms1_pin, short ms2_pin, short ms3_pin);
short setMicrostep(short microsteps) override; // 设置微步数
}; #endif // A4988_
原文地址: https://www.cveoy.top/t/topic/hlSG 著作权归作者所有。请勿转载和采集!