Ai
1 Star 0 Fork 0

DFRobot/DFRobot_ESP32_Servo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
DFRobot_ESP32_servo.h 1.16 KB
一键复制 编辑 原始数据 按行查看 历史
wenyi 提交于 2017-09-13 14:28 +08:00 . push
#ifndef _DFRobot_ESP32_Servo_h
#define _DFRobot_ESP32_Servo_h
#include "pins_arduino.h"
#include "Arduino.h"
#include "esp32-hal-timer.h"
#include "freertos/FreeRTOS.h"
#include "freertos/xtensa_api.h"
#include "freertos/task.h"
#include "rom/ets_sys.h"
#include "soc/timer_group_struct.h"
#include "soc/dport_reg.h"
#include "esp_attr.h"
#include "esp_intr.h"
#define SERVO_VERSION 1
#define SERVO_NUM_MAX 32
#define SERVO_ANGLE_MAX 180
#define SERVO_PULSE_MAX 2400
#define SERVO_PULSE_MIN 544
#define INVALID_SERVO 255
#define SERVO_CYCLE 20000
typedef struct {
uint8_t nbr; //servos num 0 - 39
uint8_t isActive; //servo status
} servoPinDef;
typedef struct {
servoPinDef Pin; //servo pin
volatile unsigned int ticks; //servo pulse to high
} servoDef;
class DFRobot_ESP32_Servo {
public:
DFRobot_ESP32_Servo(void);
uint8_t attach(int pin);
uint8_t attach(int pin, int pulseMin, int pulseMax);
void detach(void);
void write(int value);
void writeMicroseconds(int value);
int read(void);
int readMicroseconds(void);
bool attached(void);
private:
uint8_t servoIndex;
int lastWriteValue;
int pulseMax;
int pulseMin;
};
#endif
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/dfrobot/DFRobot_ESP32_Servo.git
git@gitee.com:dfrobot/DFRobot_ESP32_Servo.git
dfrobot
DFRobot_ESP32_Servo
DFRobot_ESP32_Servo
master

搜索帮助