Skip to main content

Tb6612

Struct Tb6612 

Source
pub struct Tb6612<const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, Pwm> { /* private fields */ }

Implementations§

Source§

impl<const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, Pwm> Tb6612<IN1_P, IN1_N, IN2_P, IN2_N, Pwm>
where Pwm: _embedded_hal_PwmPin<Duty = u16>,

Source

pub fn new( in1: Pin<IN1_P, IN1_N, Output<PushPull>>, in2: Pin<IN2_P, IN2_N, Output<PushPull>>, pwm: Pwm, ) -> Self

Source

pub fn set_speed(&mut self, speed: f32)

Set motor speed from -1.0 (full reverse) to 1.0 (full forward). Values near zero (|speed| < 0.001) engage the brake.

Source

pub fn brake(&mut self)

Short-brake: both inputs high, full duty.

Source

pub fn coast(&mut self)

Coast: both inputs low, zero duty.

Auto Trait Implementations§

§

impl<const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, Pwm> Freeze for Tb6612<IN1_P, IN1_N, IN2_P, IN2_N, Pwm>
where Pwm: Freeze,

§

impl<const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, Pwm> RefUnwindSafe for Tb6612<IN1_P, IN1_N, IN2_P, IN2_N, Pwm>
where Pwm: RefUnwindSafe,

§

impl<const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, Pwm> Send for Tb6612<IN1_P, IN1_N, IN2_P, IN2_N, Pwm>
where Pwm: Send,

§

impl<const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, Pwm> Sync for Tb6612<IN1_P, IN1_N, IN2_P, IN2_N, Pwm>
where Pwm: Sync,

§

impl<const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, Pwm> Unpin for Tb6612<IN1_P, IN1_N, IN2_P, IN2_N, Pwm>
where Pwm: Unpin,

§

impl<const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, Pwm> UnsafeUnpin for Tb6612<IN1_P, IN1_N, IN2_P, IN2_N, Pwm>
where Pwm: UnsafeUnpin,

§

impl<const IN1_P: char, const IN1_N: u8, const IN2_P: char, const IN2_N: u8, Pwm> UnwindSafe for Tb6612<IN1_P, IN1_N, IN2_P, IN2_N, Pwm>
where Pwm: 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.