opentitanlib::transport::common::uart

Struct SoftwareFlowControl

Source
pub struct SoftwareFlowControl<T> { /* private fields */ }
Expand description

Add software flow control to a UART device.

Flow control is performed using XON/XOFF bytes.

Implementations§

Source§

impl<T: Uart> SoftwareFlowControl<T>

Source

pub fn new(inner: T) -> Self

Open the given serial device, such as /dev/ttyUSB0.

Trait Implementations§

Source§

impl<T: Uart> Uart for SoftwareFlowControl<T>

Source§

fn set_baudrate(&self, baudrate: u32) -> Result<()>

Sets the UART baudrate. May do nothing for virtual UARTs.

Source§

fn write(&self, buf: &[u8]) -> Result<()>

Writes data from buf to the UART.

Source§

fn clear_rx_buffer(&self) -> Result<()>

Clears the UART RX buffer.

Source§

fn get_baudrate(&self) -> Result<u32>

Returns the UART baudrate. May return zero for virtual UARTs.
Source§

fn get_flow_control(&self) -> Result<FlowControl>

Source§

fn set_flow_control(&self, flow_control: bool) -> Result<()>

Enables software flow control for writes.
Source§

fn get_device_path(&self) -> Result<String>

Returns "/dev/ttyUSBn" or similar OS device path usable by external programs for directly accessing the serial port.
Source§

fn poll_read(&self, cx: &mut Context<'_>, buf: &mut [u8]) -> Poll<Result<usize>>

Reads UART receive data into buf, returning the number of bytes read. Read more
Source§

fn set_break(&self, enable: bool) -> Result<()>

Source§

fn set_parity(&self, parity: Parity) -> Result<()>

Source§

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

Reads UART receive data into buf, returning the number of bytes read. This function is blocking.
Source§

fn read_timeout(&self, buf: &mut [u8], timeout: Duration) -> Result<usize>

Reads UART receive data into buf, returning the number of bytes read. The timeout may be used to specify a duration to wait for data. If timeout expires without any data arriving Ok(0) will be returned, never Err(_).
Source§

fn get_parity(&self) -> Result<Parity>

Auto Trait Implementations§

§

impl<T> !Freeze for SoftwareFlowControl<T>

§

impl<T> !RefUnwindSafe for SoftwareFlowControl<T>

§

impl<T> Send for SoftwareFlowControl<T>
where T: Send,

§

impl<T> !Sync for SoftwareFlowControl<T>

§

impl<T> Unpin for SoftwareFlowControl<T>
where T: Unpin,

§

impl<T> UnwindSafe for SoftwareFlowControl<T>
where T: 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> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V