Max485

Struct Max485 

Source
pub struct Max485<RIDO, REDE, DELAY>
where RIDO: Read + Write, REDE: OutputPin,
{ /* private fields */ }
Expand description

Asynchronous driver for MAX485 RS-485 transceivers. Requires a serial port, a RE/DE pin, and a delay provider.

Implementations§

Source§

impl<RIDO, REDE, DELAY> Max485<RIDO, REDE, DELAY>
where RIDO: Read + Write, REDE: OutputPin,

Source

pub fn new(serial: RIDO, pin: REDE, delay: DELAY) -> Self

Source

pub fn into_parts(self) -> (RIDO, REDE, DELAY)

Source

pub fn inner_mut(&mut self) -> &mut RIDO

Source

pub async fn begin_transmission( &mut self, ) -> Result<(), <Self as ErrorType>::Error>

Begin the transmission by setting the RE/DE pin high. This is called automatically before any write operation.

Source

pub async fn end_transmission( &mut self, ) -> Result<(), <Self as ErrorType>::Error>
where DELAY: DelayNs,

End the transmission by flushing the serial port and setting the RE/DE pin low.

Trait Implementations§

Source§

impl<RIDO, REDE, DELAY> ErrorType for Max485<RIDO, REDE, DELAY>
where RIDO: Read + Write, REDE: OutputPin,

Source§

type Error = Error<<RIDO as ErrorType>::Error, <REDE as ErrorType>::Error>

Error type of all the IO operations on this type.
Source§

impl<RIDO, REDE, DELAY> Read for Max485<RIDO, REDE, DELAY>
where RIDO: Read + Write, REDE: OutputPin, DELAY: DelayNs,

Source§

async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>

Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§

async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>

Read the exact number of bytes required to fill buf. Read more
Source§

impl<RIDO, REDE, DELAY> ReadReady for Max485<RIDO, REDE, DELAY>
where RIDO: Read + Write + ReadReady, REDE: OutputPin,

Source§

fn read_ready(&mut self) -> Result<bool, Self::Error>

Get whether the reader is ready for immediately reading. Read more
Source§

impl<RIDO, REDE, DELAY> Write for Max485<RIDO, REDE, DELAY>
where RIDO: Read + Write, REDE: OutputPin, DELAY: DelayNs,

Source§

async fn write(&mut self, bytes: &[u8]) -> Result<usize, Self::Error>

Write a buffer into this writer, returning how many bytes were written. Read more
Source§

async fn flush(&mut self) -> Result<(), Self::Error>

Flush this output stream, ensuring that all intermediately buffered contents reach their destination.
Source§

async fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error>

Write an entire buffer into this writer. Read more
Source§

impl<RIDO, REDE, DELAY> WriteReady for Max485<RIDO, REDE, DELAY>
where RIDO: Read + Write + WriteReady, REDE: OutputPin,

Source§

fn write_ready(&mut self) -> Result<bool, Self::Error>

Get whether the writer is ready for immediately writing. Read more

Auto Trait Implementations§

§

impl<RIDO, REDE, DELAY> Freeze for Max485<RIDO, REDE, DELAY>
where RIDO: Freeze, REDE: Freeze, DELAY: Freeze,

§

impl<RIDO, REDE, DELAY> RefUnwindSafe for Max485<RIDO, REDE, DELAY>
where RIDO: RefUnwindSafe, REDE: RefUnwindSafe, DELAY: RefUnwindSafe,

§

impl<RIDO, REDE, DELAY> Send for Max485<RIDO, REDE, DELAY>
where RIDO: Send, REDE: Send, DELAY: Send,

§

impl<RIDO, REDE, DELAY> Sync for Max485<RIDO, REDE, DELAY>
where RIDO: Sync, REDE: Sync, DELAY: Sync,

§

impl<RIDO, REDE, DELAY> Unpin for Max485<RIDO, REDE, DELAY>
where RIDO: Unpin, REDE: Unpin, DELAY: Unpin,

§

impl<RIDO, REDE, DELAY> UnwindSafe for Max485<RIDO, REDE, DELAY>
where RIDO: UnwindSafe, REDE: UnwindSafe, DELAY: 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.