ShiftRegister

Struct ShiftRegister 

Source
pub struct ShiftRegister<SPI, OE, CLR, LATCH, D> { /* private fields */ }
Expand description

A 74hc595 (compatible) shift register.

Implementations§

Source§

impl<SPI, OE, CLR, LATCH, D> ShiftRegister<SPI, OE, CLR, LATCH, D>
where SPI: SpiBus, OE: OutputPin, CLR: OutputPin, LATCH: OutputPin, D: DelayNs,

Source

pub fn new(spi: SPI, not_oe: OE, not_clr: CLR, latch: LATCH, delay: D) -> Self

Creates a new ShiftRegister.

Source

pub fn output_enable(&mut self, enable: bool) -> Result<(), OE::Error>

Enables or disables the shift register output drivers.

Source

pub async fn clear(&mut self) -> Result<(), CLR::Error>

Clears the shift register.

This does not change the value of the output latches. Use Self::latch() after clearing if you want the outputs to be reset.

Source

pub async fn latch(&mut self) -> Result<(), LATCH::Error>

Latches the current values in the shift register into the output latches.

Source

pub async fn load(&mut self, data: &[u8]) -> Result<(), SPI::Error>

Loads data into the shift register.

Source

pub async fn transfer( &mut self, read: &mut [u8], write: &[u8], ) -> Result<(), SPI::Error>

Loads write into the shift register and writes the data shifted out of the shift register into read.

Auto Trait Implementations§

§

impl<SPI, OE, CLR, LATCH, D> Freeze for ShiftRegister<SPI, OE, CLR, LATCH, D>
where SPI: Freeze, OE: Freeze, CLR: Freeze, LATCH: Freeze, D: Freeze,

§

impl<SPI, OE, CLR, LATCH, D> RefUnwindSafe for ShiftRegister<SPI, OE, CLR, LATCH, D>

§

impl<SPI, OE, CLR, LATCH, D> Send for ShiftRegister<SPI, OE, CLR, LATCH, D>
where SPI: Send, OE: Send, CLR: Send, LATCH: Send, D: Send,

§

impl<SPI, OE, CLR, LATCH, D> Sync for ShiftRegister<SPI, OE, CLR, LATCH, D>
where SPI: Sync, OE: Sync, CLR: Sync, LATCH: Sync, D: Sync,

§

impl<SPI, OE, CLR, LATCH, D> Unpin for ShiftRegister<SPI, OE, CLR, LATCH, D>
where SPI: Unpin, OE: Unpin, CLR: Unpin, LATCH: Unpin, D: Unpin,

§

impl<SPI, OE, CLR, LATCH, D> UnwindSafe for ShiftRegister<SPI, OE, CLR, LATCH, D>
where SPI: UnwindSafe, OE: UnwindSafe, CLR: UnwindSafe, LATCH: UnwindSafe, D: 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.