Skip to main content

MotorDriverBuilder

Struct MotorDriverBuilder 

Source
pub struct MotorDriverBuilder<E1, E2, P1, P2> { /* private fields */ }

Implementations§

Source§

impl<E1, E2, P1, P2> MotorDriverBuilder<E1, E2, P1, P2>

Source

pub fn new() -> Self

Create a new motor driver builder with default settings.

§Example
let builder = MotorDriverBuilder::new()
    .with_single_enable(enable_pin)
    .with_single_pwm(pwm_channel, 1000);
Source

pub fn with_single_enable(self, enable: E1) -> Self

Source

pub fn with_dual_enable(self, enable1: E1, enable2: E2) -> Self

Configure dual enable pins for H-bridge motor control.

§Arguments
  • enable1 - First enable pin for one side of H-bridge
  • enable2 - Second enable pin for other side of H-bridge
§Example
builder.with_dual_enable(enable_pin1, enable_pin2)
Source

pub fn with_single_pwm(self, pwm: P1) -> Self

Source

pub fn with_dual_pwm(self, pwm1: P1, pwm2: P2) -> Self

Source

pub fn with_enable_pins(self, pins: EnablePins<E1, E2>) -> Self

Source

pub fn with_pwm_channels(self, channels: PwmChannels<P1, P2>) -> Self

Source

pub fn with_max_duty(self, max_duty: u16) -> Self

Source

pub fn with_initial_speed(self, speed: i16) -> Self

Source

pub fn with_initial_direction(self, direction: MotorDirection) -> Self

Source

pub fn with_ppr(self, ppr: i16) -> Self

Source

pub fn build(self) -> MotorDriverWrapper<E1, E2, P1, P2>

Source

pub fn build_and_init( self, ) -> Result<MotorDriverWrapper<E1, E2, P1, P2>, MotorDriverError>
where E1: OutputPin, E2: OutputPin, P1: SetDutyCycle, P2: SetDutyCycle,

Trait Implementations§

Source§

impl<E1, E2, P1, P2> Default for MotorDriverBuilder<E1, E2, P1, P2>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<E1, E2, P1, P2> Freeze for MotorDriverBuilder<E1, E2, P1, P2>
where E1: Freeze, E2: Freeze, P1: Freeze, P2: Freeze,

§

impl<E1, E2, P1, P2> RefUnwindSafe for MotorDriverBuilder<E1, E2, P1, P2>

§

impl<E1, E2, P1, P2> Send for MotorDriverBuilder<E1, E2, P1, P2>
where E1: Send, E2: Send, P1: Send, P2: Send,

§

impl<E1, E2, P1, P2> Sync for MotorDriverBuilder<E1, E2, P1, P2>
where E1: Sync, E2: Sync, P1: Sync, P2: Sync,

§

impl<E1, E2, P1, P2> Unpin for MotorDriverBuilder<E1, E2, P1, P2>
where E1: Unpin, E2: Unpin, P1: Unpin, P2: Unpin,

§

impl<E1, E2, P1, P2> UnsafeUnpin for MotorDriverBuilder<E1, E2, P1, P2>

§

impl<E1, E2, P1, P2> UnwindSafe for MotorDriverBuilder<E1, E2, P1, P2>
where E1: UnwindSafe, E2: UnwindSafe, P1: UnwindSafe, P2: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.