pub struct FtdiPort<'dev, 'd, A, M = NoopRawMutex>where
A: UsbHostAllocator<'d>,
M: RawMutex,{ /* private fields */ }Expand description
FTDI UART port.
Implementations§
Source§impl<'dev, 'd, A, M> FtdiPort<'dev, 'd, A, M>where
A: UsbHostAllocator<'d>,
M: RawMutex,
impl<'dev, 'd, A, M> FtdiPort<'dev, 'd, A, M>where
A: UsbHostAllocator<'d>,
M: RawMutex,
Sourcepub async fn set_baudrate(&mut self, baud: u32) -> Result<(), FtdiError>
pub async fn set_baudrate(&mut self, baud: u32) -> Result<(), FtdiError>
Configure the UART baud rate.
Sourcepub async fn set_line_coding(
&mut self,
line: &LineCoding,
) -> Result<(), FtdiError>
pub async fn set_line_coding( &mut self, line: &LineCoding, ) -> Result<(), FtdiError>
Configure line parameters (data bits, stop bits, parity).
Sourcepub async fn set_control_line_state(
&mut self,
dtr: bool,
rts: bool,
) -> Result<(), FtdiError>
pub async fn set_control_line_state( &mut self, dtr: bool, rts: bool, ) -> Result<(), FtdiError>
Set modem control line states (DTR, RTS).
Sourcepub async fn set_flow_control(
&mut self,
flow: FlowControl,
) -> Result<(), FtdiError>
pub async fn set_flow_control( &mut self, flow: FlowControl, ) -> Result<(), FtdiError>
Configure hardware or software flow control.
Sourcepub async fn set_latency_timer(
&mut self,
latency_ms: u8,
) -> Result<(), FtdiError>
pub async fn set_latency_timer( &mut self, latency_ms: u8, ) -> Result<(), FtdiError>
Set latency timer in milliseconds (1 to 255 ms, default 16 ms).
Sourcepub async fn get_latency_timer(&mut self) -> Result<u8, FtdiError>
pub async fn get_latency_timer(&mut self) -> Result<u8, FtdiError>
Query the current latency timer value.
Sourcepub async fn get_modem_status(
&mut self,
) -> Result<(ModemStatus, LineStatus), FtdiError>
pub async fn get_modem_status( &mut self, ) -> Result<(ModemStatus, LineStatus), FtdiError>
Query current modem and line status.
Sourcepub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, FtdiError>
pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, FtdiError>
Read data from the UART, automatically stripping the 2-byte FTDI status header.
Sourcepub fn split(self) -> (Reader<'dev, 'd, A, M>, Writer<'dev, 'd, A, M>)
pub fn split(self) -> (Reader<'dev, 'd, A, M>, Writer<'dev, 'd, A, M>)
Split into independent reader and writer halves.
Sourcepub fn last_modem_status(&self) -> ModemStatus
pub fn last_modem_status(&self) -> ModemStatus
Last observed modem status from received packets.
Sourcepub fn last_line_status(&self) -> LineStatus
pub fn last_line_status(&self) -> LineStatus
Last observed line status from received packets.
Trait Implementations§
Source§impl<'dev, 'd, A, M> ErrorType for FtdiPort<'dev, 'd, A, M>where
A: UsbHostAllocator<'d>,
M: RawMutex,
Available on crate feature embedded-io only.
impl<'dev, 'd, A, M> ErrorType for FtdiPort<'dev, 'd, A, M>where
A: UsbHostAllocator<'d>,
M: RawMutex,
Available on crate feature
embedded-io only.Source§impl<'dev, 'd, A, M> Read for FtdiPort<'dev, 'd, A, M>where
A: UsbHostAllocator<'d>,
M: RawMutex,
Available on crate feature embedded-io only.
impl<'dev, 'd, A, M> Read for FtdiPort<'dev, 'd, A, M>where
A: UsbHostAllocator<'d>,
M: RawMutex,
Available on crate feature
embedded-io only.Source§async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
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>>
async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
Read the exact number of bytes required to fill
buf. Read moreSource§impl<'dev, 'd, A, M> Write for FtdiPort<'dev, 'd, A, M>where
A: UsbHostAllocator<'d>,
M: RawMutex,
Available on crate feature embedded-io only.
impl<'dev, 'd, A, M> Write for FtdiPort<'dev, 'd, A, M>where
A: UsbHostAllocator<'d>,
M: RawMutex,
Available on crate feature
embedded-io only.Source§async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Write a buffer into this writer, returning how many bytes were written. Read more
Auto Trait Implementations§
impl<'dev, 'd, A, M = NoopRawMutex> !RefUnwindSafe for FtdiPort<'dev, 'd, A, M>
impl<'dev, 'd, A, M = NoopRawMutex> !UnwindSafe for FtdiPort<'dev, 'd, A, M>
impl<'dev, 'd, A, M> Forget for FtdiPort<'dev, 'd, A, M>
impl<'dev, 'd, A, M> Freeze for FtdiPort<'dev, 'd, A, M>
impl<'dev, 'd, A, M> Move for FtdiPort<'dev, 'd, A, M>
impl<'dev, 'd, A, M> Send for FtdiPort<'dev, 'd, A, M>
impl<'dev, 'd, A, M> Sync for FtdiPort<'dev, 'd, A, M>
impl<'dev, 'd, A, M> Unpin for FtdiPort<'dev, 'd, A, M>
impl<'dev, 'd, A, M> UnsafeUnpin for FtdiPort<'dev, 'd, A, M>where
&'dev FtdiDevice<'d, A, M>: UnsafeUnpin,
Reader<'dev, 'd, A, M>: UnsafeUnpin,
Writer<'dev, 'd, A, M>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more