MakeBlock Drive Updated Updated library for MakeBlock Ranger

Loading...
Searching...
No Matches
MeMegaPiProESCMotor.h
Go to the documentation of this file.
1
41#ifndef MeMegaPiProESCMotor_H
42#define MeMegaPiProESCMotor_H
43
44#include <stdint.h>
45#include <stdbool.h>
46#include <Arduino.h>
47#include "MeConfig.h"
48#ifdef ME_PORT_DEFINED
49#include "MePort.h"
50#endif // ME_PORT_DEFINED
51
52 typedef struct
53{
54 uint8_t pwm_pin; //PWM
55} megapipro_esc_type;
56
57 extern megapipro_esc_type megapi_esc_Port[5]; // megapipro_esc_Port[0] is nonsense
58
59#define THROTTLE_OFFSET 137
60
61#define THROTTLE_MIN 137//0.55ms~0.95ms throttle scale,970hz,1.024ms.
62 //255 * (0.55/1.024) = 137
63#define THROTTLE_MAX 237//255 * (0.95/1.024) = 237
69class MeMegaPiProESCMotor
70{
71 public:
72#ifdef ME_PORT_DEFINED
79 MeMegaPiProESCMotor(void);
80
86 MeMegaPiProESCMotor(uint8_t port);
87#else
94 MeMegaPiProESCMotorPWMpin(uint8_t pwm_pin);
95#endif
110 void reset(uint8_t port);
111
126 void setpin(uint8_t pwm_pin);
139 void init(void);
154 void run(int16_t speed);
155
168 void stop(void);
169 private:
170 volatile uint8_t _esc_pwm_pin;
171 volatile int16_t last_speed;
172};
173
174#endif //MeMegaPiProESCMotor_H
175
MeConfig.h
Configuration file of library.
MePort.h
Header for MePort.cpp module.
MeMegaPiProESCMotor
Driver for Me Megapipro ESC motor device.
Definition MeMegaPiProESCMotor.h:70
megapipro_esc_type
Definition MeMegaPiProESCMotor.h:53