Skip to main content

UartTx

Struct UartTx 

Source
pub struct UartTx<'d, T: Instance, M: Mode> { /* private fields */ }
Expand description

Tx-only UART Driver.

Implementations§

Source§

impl<'d, T: Instance, M: Mode> UartTx<'d, T, M>

Source

pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>

Reconfigure the driver

Source

pub fn blocking_write(&mut self, buffer: &[u8]) -> Result<(), Error>

Perform a blocking UART write

Source

pub fn blocking_flush(&mut self) -> Result<(), Error>

Block until transmission complete

Source§

impl<'d, T: Instance> UartTx<'d, T, Async>

Source

pub fn new<const REMAP: u8>( peri: Peri<'d, T>, tx: Peri<'d, impl TxPin<T, REMAP>>, tx_dma: Peri<'d, impl TxDma<T>>, config: Config, ) -> Result<Self, ConfigError>

Useful if you only want Uart Tx. It saves 1 pin and consumes a little less power.

Source

pub fn new_with_cts<const REMAP: u8>( peri: Peri<'d, T>, tx: Peri<'d, impl TxPin<T, REMAP>>, cts: Peri<'d, impl CtsPin<T, REMAP>>, tx_dma: Peri<'d, impl TxDma<T>>, config: Config, ) -> Result<Self, ConfigError>

Create a new tx-only UART with a clear-to-send pin

Source

pub async fn write(&mut self, buffer: &[u8]) -> Result<(), Error>

Initiate an asynchronous UART write

Source

pub async fn flush(&mut self) -> Result<(), Error>

Wait until transmission complete

Source§

impl<'d, T: Instance> UartTx<'d, T, Blocking>

Source

pub fn new_blocking<const REMAP: u8>( peri: Peri<'d, T>, tx: Peri<'d, impl TxPin<T, REMAP>>, config: Config, ) -> Result<Self, ConfigError>

Create a new blocking tx-only UART with no hardware flow control.

Useful if you only want Uart Tx. It saves 1 pin and consumes a little less power.

Source

pub fn new_blocking_with_cts<const REMAP: u8>( peri: Peri<'d, T>, tx: Peri<'d, impl TxPin<T, REMAP>>, cts: Peri<'d, impl CtsPin<T, REMAP>>, config: Config, ) -> Result<Self, ConfigError>

Create a new blocking tx-only UART with a clear-to-send pin

Trait Implementations§

Source§

impl<'d, T: Instance, M: Mode> Drop for UartTx<'d, T, M>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<'d, T: Instance> Write for UartTx<'d, T, Blocking>

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a [char] into this writer, returning whether the write succeeded. Read more
1.0.0§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the [write!] macro with implementors of this trait. Read more

Auto Trait Implementations§

§

impl<'d, T, M> !UnwindSafe for UartTx<'d, T, M>

§

impl<'d, T, M> Freeze for UartTx<'d, T, M>

§

impl<'d, T, M> RefUnwindSafe for UartTx<'d, T, M>
where T: RefUnwindSafe, M: RefUnwindSafe,

§

impl<'d, T, M> Send for UartTx<'d, T, M>
where M: Send,

§

impl<'d, T, M> Sync for UartTx<'d, T, M>
where T: Sync, M: Sync,

§

impl<'d, T, M> Unpin for UartTx<'d, T, M>
where T: Unpin, M: Unpin,

§

impl<'d, T, M> UnsafeUnpin for UartTx<'d, T, M>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.