pub trait FrameSerial {
    type SerError;

    // Required methods
    async fn send_frame(
        &mut self,
        data: &[u8]
    ) -> Result<(), Error<Self::SerError>>;
    async fn recv<'a>(
        &mut self,
        frame: &'a mut [u8]
    ) -> Result<TimedFrame<'a>, Error<Self::SerError>>;
}
Expand description

A trait representing the communication interface of the RS-485 bus

Required Associated Types§

source

type SerError

The error type of the underlying serial port

Required Methods§

source

async fn send_frame(&mut self, data: &[u8]) -> Result<(), Error<Self::SerError>>

Send a single frame.

The hardware should begin sending the data as soon as possible, and the future MUST not return until the data is completely done sending, e.g. all data is “flushed”.

This function is responsible for activating the “send mode” of the transceiver on entry (e.g. asserting DE), and disabling it on exit (e.g. deasserting DE).

This function MUST be cancellation safe, including the de-assertion of the “send mode”.

source

async fn recv<'a>( &mut self, frame: &'a mut [u8] ) -> Result<TimedFrame<'a>, Error<Self::SerError>>

Receive a single frame, waiting until a Line Break occurs, signalling the end of a frame

Object Safety§

This trait is not object safe.

Implementors§