Type Alias PwmParallelDriverType

Source
pub type PwmParallelDriverType<IN1, IN2, IN3, IN4, PWM, FAULT> = MotorDriver<PwmParallelDriver<IN1, IN2, IN3, IN4, Arc<Mutex<PWM>>>, Arc<Mutex<PWM>>, FAULT>;

Aliased Type§

pub struct PwmParallelDriverType<IN1, IN2, IN3, IN4, PWM, FAULT> { /* private fields */ }

Implementations§

Source§

impl<IN1, IN2, IN3, IN4, PWM, FAULT> PwmParallelDriverType<IN1, IN2, IN3, IN4, PWM, FAULT>
where IN1: OutputPin, IN2: OutputPin, IN3: OutputPin, IN4: OutputPin, FAULT: InputPin,

Source

pub fn new_pwm_parallel( in1: IN1, in2: IN2, in3: IN3, in4: IN4, pwm: PWM, fault: Option<FAULT>, ) -> PwmParallelDriverType<IN1, IN2, IN3, IN4, PWM, FAULT>
where IN1: OutputPin, IN2: OutputPin, IN3: OutputPin, IN4: OutputPin,

Creates a new MotorDriver instance with PWM parallel control mode.

In PWM parallel mode, a single PWM channel is used to control all four bridge inputs. This allows simultaneous control of all inputs. It’s useful for scenarios where a single motor needs increased current, achieved by connecting IN1 with IN3 and IN2 with IN4.

§Example
use drv8833_driver::driver::Motor;

let in1 = PinDriver::output(peripherals.pins.gpio5)?;
let in2 = PinDriver::output(peripherals.pins.gpio4)?;
let in3 = PinDriver::output(peripherals.pins.gpio18)?;
let in4 = PinDriver::output(peripherals.pins.gpio19)?;

let timer = LedcTimerDriver::new(peripherals.ledc.timer3, &TimerConfig::default())?;
let sleep = LedcDriver::new(peripherals.ledc.channel0, &timer, peripherals.pins.gpio3)?;

let mut motor = Motor::new_pwm_parallel(
    in1, in2, in3, in4, sleep, None::<PinDriver<AnyInputPin, Input>>,
);