pub struct Ch34xPort<'dev, 'd, A, M = NoopRawMutex>where
A: UsbHostAllocator<'d>,
M: RawMutex,{ /* private fields */ }Expand description
An open CH34x UART port.
Implementations§
Source§impl<'dev, 'd, A, M> Ch34xPort<'dev, 'd, A, M>where
A: UsbHostAllocator<'d>,
M: RawMutex,
impl<'dev, 'd, A, M> Ch34xPort<'dev, 'd, A, M>where
A: UsbHostAllocator<'d>,
M: RawMutex,
Sourcepub async fn enable(&mut self) -> Result<(), Ch34xError>
pub async fn enable(&mut self) -> Result<(), Ch34xError>
Enable and initialize the CH34x chip.
Sourcepub async fn set_baud_rate(&mut self, baud: u32) -> Result<(), Ch34xError>
pub async fn set_baud_rate(&mut self, baud: u32) -> Result<(), Ch34xError>
Set baud rate in bauds per second.
Sourcepub async fn set_line_coding(
&mut self,
coding: &LineCoding,
) -> Result<(), Ch34xError>
pub async fn set_line_coding( &mut self, coding: &LineCoding, ) -> Result<(), Ch34xError>
Set line coding (baud rate, data bits, stop bits, parity).
Sourcepub async fn set_control_line_state(
&mut self,
dtr: bool,
rts: bool,
) -> Result<(), Ch34xError>
pub async fn set_control_line_state( &mut self, dtr: bool, rts: bool, ) -> Result<(), Ch34xError>
Set DTR and RTS control line states.
Sourcepub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Ch34xError>
pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Ch34xError>
Read bytes from UART receive stream.
Trait Implementations§
Source§impl<'dev, 'd, A, M> ErrorType for Ch34xPort<'dev, 'd, A, M>where
A: UsbHostAllocator<'d>,
M: RawMutex,
Available on crate feature embedded-io only.
impl<'dev, 'd, A, M> ErrorType for Ch34xPort<'dev, 'd, A, M>where
A: UsbHostAllocator<'d>,
M: RawMutex,
Available on crate feature
embedded-io only.Source§type Error = Ch34xError
type Error = Ch34xError
Error type of all the IO operations on this type.
Source§impl<'dev, 'd, A, M> Read for Ch34xPort<'dev, 'd, A, M>where
A: UsbHostAllocator<'d>,
M: RawMutex,
Available on crate feature embedded-io only.
impl<'dev, 'd, A, M> Read for Ch34xPort<'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 Ch34xPort<'dev, 'd, A, M>where
A: UsbHostAllocator<'d>,
M: RawMutex,
Available on crate feature embedded-io only.
impl<'dev, 'd, A, M> Write for Ch34xPort<'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 Ch34xPort<'dev, 'd, A, M>
impl<'dev, 'd, A, M = NoopRawMutex> !UnwindSafe for Ch34xPort<'dev, 'd, A, M>
impl<'dev, 'd, A, M> Forget for Ch34xPort<'dev, 'd, A, M>
impl<'dev, 'd, A, M> Freeze for Ch34xPort<'dev, 'd, A, M>where
&'dev Ch34xDevice<'d, A, M>: Freeze,
<A as UsbHostAllocator<'d>>::Pipe<Bulk, In>: Freeze,
<A as UsbHostAllocator<'d>>::Pipe<Bulk, Out>: Freeze,
impl<'dev, 'd, A, M> Move for Ch34xPort<'dev, 'd, A, M>
impl<'dev, 'd, A, M> Send for Ch34xPort<'dev, 'd, A, M>where
&'dev Ch34xDevice<'d, A, M>: Send,
<A as UsbHostAllocator<'d>>::Pipe<Bulk, In>: Send,
<A as UsbHostAllocator<'d>>::Pipe<Bulk, Out>: Send,
impl<'dev, 'd, A, M> Sync for Ch34xPort<'dev, 'd, A, M>where
&'dev Ch34xDevice<'d, A, M>: Sync,
<A as UsbHostAllocator<'d>>::Pipe<Bulk, In>: Sync,
<A as UsbHostAllocator<'d>>::Pipe<Bulk, Out>: Sync,
impl<'dev, 'd, A, M> Unpin for Ch34xPort<'dev, 'd, A, M>where
&'dev Ch34xDevice<'d, A, M>: Unpin,
<A as UsbHostAllocator<'d>>::Pipe<Bulk, In>: Unpin,
<A as UsbHostAllocator<'d>>::Pipe<Bulk, Out>: Unpin,
impl<'dev, 'd, A, M> UnsafeUnpin for Ch34xPort<'dev, 'd, A, M>where
&'dev Ch34xDevice<'d, A, M>: UnsafeUnpin,
<A as UsbHostAllocator<'d>>::Pipe<Bulk, In>: UnsafeUnpin,
<A as UsbHostAllocator<'d>>::Pipe<Bulk, Out>: 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