Struct l298n::Motor[][src]

pub struct Motor<INF, INS, PWM> where
    INF: OutputPin,
    INS: OutputPin,
    PWM: PwmPin
{ /* fields omitted */ }
Expand description

Struct for single bridge

Implementations

impl<INF, INS, PWM> Motor<INF, INS, PWM> where
    INF: OutputPin,
    INS: OutputPin,
    PWM: PwmPin
[src]

pub fn new(in1: INF, in2: INS, pwm: PWM) -> Motor<INF, INS, PWM> where
    INF: OutputPin,
    INS: OutputPin,
    PWM: PwmPin
[src]

Creates a new single Motor controller

pub fn brake(&mut self) -> &mut Self[src]

Brakes the motor - Fast Motor Stop with Ven = H then C = D Fast Motor Stop

pub fn stop(&mut self) -> &mut Self[src]

Stops the motor - Free Running Motor Stop Ven = L then with C = X ; D = X

pub fn forward(&mut self) -> &mut Self[src]

Makes the motor forward direction with Ven = H then C = H ; D = L Forward

pub fn reverse(&mut self) -> &mut Self[src]

Makes the motor reverse direction with Ven = H then C = L ; D = H Reverse

pub fn get_max_duty(&self) -> PWM::Duty[src]

Returns the maximum

pub fn set_duty(&mut self, duty: PWM::Duty) -> &mut Self[src]

Changes the motor speed

pub fn get_current_duty(&self) -> PWM::Duty[src]

Get the actual motor speed

Trait Implementations

impl<INF: Debug, INS: Debug, PWM: Debug> Debug for Motor<INF, INS, PWM> where
    INF: OutputPin,
    INS: OutputPin,
    PWM: PwmPin
[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<INF, INS, PWM> Send for Motor<INF, INS, PWM> where
    INF: Send,
    INS: Send,
    PWM: Send

impl<INF, INS, PWM> Sync for Motor<INF, INS, PWM> where
    INF: Sync,
    INS: Sync,
    PWM: Sync

impl<INF, INS, PWM> Unpin for Motor<INF, INS, PWM> where
    INF: Unpin,
    INS: Unpin,
    PWM: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.