pub struct Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,{ /* private fields */ }Expand description
Half of an UartPeripheral that is only capable of writing. Obtained by calling UartPeripheral::split()
Implementations§
Source§impl<D, P> Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Sourcepub fn write_raw<'d>(
&self,
data: &'d [u8],
) -> Result<&'d [u8], Error<Infallible>>
pub fn write_raw<'d>( &self, data: &'d [u8], ) -> Result<&'d [u8], Error<Infallible>>
Writes bytes to the UART.
This function writes as long as it can. As soon that the FIFO is full, if:
- 0 bytes were written, a WouldBlock Error is returned
- some bytes were written, it is deemed to be a success
Upon success, the remaining (unwritten) slice is returned.
Sourcepub fn write_full_blocking(&self, data: &[u8])
pub fn write_full_blocking(&self, data: &[u8])
Writes bytes to the UART.
This function blocks until the full buffer has been sent.
Sourcepub fn enable_tx_interrupt(&mut self)
pub fn enable_tx_interrupt(&mut self)
Enables the Transmit Interrupt.
The relevant UARTx IRQ will fire when there is space in the transmit FIFO.
Sourcepub fn disable_tx_interrupt(&mut self)
pub fn disable_tx_interrupt(&mut self)
Disables the Transmit Interrupt.
Sourcepub fn lowlevel_break_start(&mut self)
pub fn lowlevel_break_start(&mut self)
Initiates a break
If transmitting, this takes effect immediately after the current byte has completed.
For proper execution of the break command, this must be held for at least 2 complete frames
worth of time.
§Example
serial.lowlevel_break_start();
// at 115_200Bps on 8N1 configuration, 20bits takes (20*10⁶)/115200 = 173.611…μs.
timer.delay_us(175);
serial.lowlevel_break_stop();
}Sourcepub fn lowlevel_break_stop(&mut self)
pub fn lowlevel_break_stop(&mut self)
Terminates a break condition.
See lowlevel_break_start for more details.
Trait Implementations§
Source§impl<D, P> ErrorType for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> ErrorType for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Source§type Error = Infallible
type Error = Infallible
Source§impl<D, P> ErrorType for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> ErrorType for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Source§type Error = Infallible
type Error = Infallible
Source§impl<D, P> Write<u8> for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> Write<u8> for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Source§impl<D, P> Write for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> Write for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Source§impl<D, P> Write for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> Write for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Source§impl<D, P> Write for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> Write for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Source§fn write(
&mut self,
buf: &[u8],
) -> Result<usize, <Writer<D, P> as ErrorType>::Error>
fn write( &mut self, buf: &[u8], ) -> Result<usize, <Writer<D, P> as ErrorType>::Error>
Source§fn flush(&mut self) -> Result<(), <Writer<D, P> as ErrorType>::Error>
fn flush(&mut self) -> Result<(), <Writer<D, P> as ErrorType>::Error>
Source§impl<D, P> WriteReady for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> WriteReady for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Source§impl<D, P> WriteTarget for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
impl<D, P> WriteTarget for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Source§type TransmittedWord = u8
type TransmittedWord = u8
Source§fn tx_treq() -> Option<u8>
fn tx_treq() -> Option<u8>
None for memory buffers).Source§fn tx_address_count(&mut self) -> (u32, u32)
fn tx_address_count(&mut self) -> (u32, u32)
Source§fn tx_increment(&self) -> bool
fn tx_increment(&self) -> bool
impl<D, P> EndlessWriteTarget for Writer<D, P>where
D: UartDevice,
P: ValidUartPinout<D>,
Auto Trait Implementations§
impl<D, P> Freeze for Writer<D, P>where
D: Freeze,
impl<D, P> RefUnwindSafe for Writer<D, P>where
D: RefUnwindSafe,
P: RefUnwindSafe,
impl<D, P> Send for Writer<D, P>
impl<D, P> Sync for Writer<D, P>
impl<D, P> Unpin for Writer<D, P>
impl<D, P> UnwindSafe for Writer<D, P>where
D: UnwindSafe,
P: UnwindSafe,
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
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more