2 #ifndef libpropeller_vnh2sp30_h__ 3 #define libpropeller_vnh2sp30_h__ 5 #include "libpropeller/pwm32/pwm32.h" 6 #include "libpropeller/pwm2/pwm2.h" 8 #include "libpropeller/pin/pin.h" 61 waitcnt(CLKFREQ / 10 + CNT);
117 const int inApin,
const int inBpin) {
130 channel = new_channel;
134 }
else if (channel == Y) {
148 void Set(
const int power){
177 }
else if (power > 100) {
180 adjustedSpeed = power;
185 SetSpeedPwm32(adjustedSpeed);
186 }
else if (pwm2 != NULL) {
187 SetSpeedPwm2(adjustedSpeed);
197 if (direction == FORWARD) {
214 static const int kFrequency = 1000;
217 static const int kResolution = 10;
218 static const int kScale = 2147483647 / (1 << (kResolution - 1));
220 void SetSpeedPwm2(
const int speed) {
224 }
else if (channel == Y) {
229 void SetSpeedPwm32(
const int speed) {
230 pwm32->
Duty(pwmPin.
getPin(), speed, 1000000 / kFrequency);
236 #endif // libpropeller_vnh2sp30_h__
void SetPinY(const int pinY)
void SetFrequency(const int frequency)
void SetPinX(const int pinX)
void SetDutyY(const int percent)
void Duty(int pin, int duty_cycle, int period)
void Init(libpropeller::PWM32 *new_pwm, const int new_pwmPin, const int inApin, const int inBpin)
void SetPower(const int power)
void Set(const int power)
void SetDirection(const Direction direction)
void Init(libpropeller::PWM2 *new_pwm, const PwmChannel new_channel, const int new_pwmPin, const int inApin, const int inBpin)
void SetDutyX(const int percent)
void Set(const Direction direction, const int power)