pub struct Writer<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: UartDevice, P: ValidUartPinout<D>> Writer<D, P>
impl<D: UartDevice, P: ValidUartPinout<D>> Writer<D, P>
Sourcepub fn write_raw<'d>(&self, data: &'d [u8]) -> Result<&'d [u8], Infallible>
pub fn write_raw<'d>(&self, data: &'d [u8]) -> Result<&'d [u8], 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: UartDevice, P: ValidUartPinout<D>> ErrorType for Writer<D, P>
impl<D: UartDevice, P: ValidUartPinout<D>> ErrorType for Writer<D, P>
Source§type Error = Infallible
type Error = Infallible
Source§impl<D: UartDevice, P: ValidUartPinout<D>> ErrorType for Writer<D, P>
impl<D: UartDevice, P: ValidUartPinout<D>> ErrorType for Writer<D, P>
Source§type Error = Infallible
type Error = Infallible
Source§impl<D: UartDevice, P: ValidUartPinout<D>> Write for Writer<D, P>
impl<D: UartDevice, P: ValidUartPinout<D>> Write for Writer<D, P>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Source§fn flush(&mut self) -> Result<(), Self::Error>
fn flush(&mut self) -> Result<(), Self::Error>
Source§impl<D: UartDevice, P: ValidUartPinout<D>> Write for Writer<D, P>
impl<D: UartDevice, P: ValidUartPinout<D>> Write for Writer<D, P>
Source§impl<D: UartDevice, P: ValidUartPinout<D>> Write for Writer<D, P>
impl<D: UartDevice, P: ValidUartPinout<D>> Write for Writer<D, P>
Source§impl<D: UartDevice, P: ValidUartPinout<D>> WriteReady for Writer<D, P>
impl<D: UartDevice, P: ValidUartPinout<D>> WriteReady for Writer<D, P>
Source§impl<D: UartDevice, P: ValidUartPinout<D>> WriteTarget for Writer<D, P>
impl<D: UartDevice, P: ValidUartPinout<D>> WriteTarget for Writer<D, P>
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
Source§impl<D: UartDevice, P: ValidUartPinout<D>> Write<u8> for Writer<D, P>
impl<D: UartDevice, P: ValidUartPinout<D>> Write<u8> for Writer<D, P>
impl<D: UartDevice, P: ValidUartPinout<D>> EndlessWriteTarget for Writer<D, P>
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