pub struct Uart<'d, Dm: DriverMode> { /* private fields */ }Expand description
UART (Full-duplex)
§Examples
use esp_hal::uart::{Config, Uart};
let mut uart = Uart::new(peripherals.UART0, Config::default())?
.with_rx(peripherals.GPIO1)
.with_tx(peripherals.GPIO2);
uart.write(b"Hello world!")?;Implementations§
Source§impl<'d> Uart<'d, Blocking>
impl<'d> Uart<'d, Blocking>
Sourcepub fn new(
uart: impl Instance + 'd,
config: Config,
) -> Result<Self, ConfigError>
pub fn new( uart: impl Instance + 'd, config: Config, ) -> Result<Self, ConfigError>
Creates a new UART instance in Blocking mode.
§Examples
use esp_hal::uart::{Config, Uart};
let mut uart = Uart::new(peripherals.UART0, Config::default())?
.with_rx(peripherals.GPIO1)
.with_tx(peripherals.GPIO2);§Errors
ConfigError when the configuration is not supported by the hardware
Sourcepub fn into_async(self) -> Uart<'d, Async>
pub fn into_async(self) -> Uart<'d, Async>
Sourcepub fn set_interrupt_handler(&mut self, handler: InterruptHandler)
Available on crate feature unstable only.
pub fn set_interrupt_handler(&mut self, handler: InterruptHandler)
unstable only.Registers an interrupt handler for the peripheral.
Replaces any previously registered interrupt handlers.
The default/unhandled interrupt handler can be restored with crate::interrupt::DEFAULT_INTERRUPT_HANDLER
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn listen(&mut self, interrupts: impl Into<EnumSet<UartInterrupt>>)
Available on crate feature unstable only.
pub fn listen(&mut self, interrupts: impl Into<EnumSet<UartInterrupt>>)
unstable only.Listens for the given interrupts.
§Examples
Note: In practice a proper serial terminal should be used to connect to the board (espflash will not work)
use esp_hal::{
delay::Delay,
uart::{AtCmdConfig, Config, RxConfig, Uart, UartInterrupt},
};
uart.set_interrupt_handler(interrupt_handler);
critical_section::with(|cs| {
uart.set_at_cmd(AtCmdConfig::default().with_cmd_char(b'#'));
uart.listen(UartInterrupt::AtCmd | UartInterrupt::RxFifoFull);
SERIAL.borrow_ref_mut(cs).replace(uart);
});
loop {
println!("Send `#` character or >=30 characters");
delay.delay(Duration::from_secs(1));
}
use core::cell::RefCell;
use critical_section::Mutex;
use esp_hal::uart::Uart;
static SERIAL: Mutex<RefCell<Option<Uart<esp_hal::Blocking>>>> = Mutex::new(RefCell::new(None));
use core::fmt::Write;
use esp_hal::uart::UartInterrupt;
#[esp_hal::handler]
fn interrupt_handler() {
critical_section::with(|cs| {
let mut serial = SERIAL.borrow_ref_mut(cs);
if let Some(serial) = serial.as_mut() {
let mut buf = [0u8; 64];
if let Ok(cnt) = serial.read_buffered(&mut buf) {
println!("Read {} bytes", cnt);
}
let pending_interrupts = serial.interrupts();
println!(
"Interrupt AT-CMD: {} RX-FIFO-FULL: {}",
pending_interrupts.contains(UartInterrupt::AtCmd),
pending_interrupts.contains(UartInterrupt::RxFifoFull),
);
serial.clear_interrupts(UartInterrupt::AtCmd | UartInterrupt::RxFifoFull);
}
});
}§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn unlisten(&mut self, interrupts: impl Into<EnumSet<UartInterrupt>>)
Available on crate feature unstable only.
pub fn unlisten(&mut self, interrupts: impl Into<EnumSet<UartInterrupt>>)
unstable only.Unlistens from the given interrupts.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn interrupts(&mut self) -> EnumSet<UartInterrupt>
Available on crate feature unstable only.
pub fn interrupts(&mut self) -> EnumSet<UartInterrupt>
unstable only.Returns the asserted interrupts.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn clear_interrupts(&mut self, interrupts: EnumSet<UartInterrupt>)
Available on crate feature unstable only.
pub fn clear_interrupts(&mut self, interrupts: EnumSet<UartInterrupt>)
unstable only.Resets asserted interrupts.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn wait_for_break(&mut self)
Available on crate feature unstable only.
pub fn wait_for_break(&mut self)
unstable only.Waits for a break condition to be detected.
This is a blocking function that will continuously check for a break condition. After detection, the break interrupt flag is automatically cleared.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn wait_for_break_with_timeout(&mut self, timeout: Duration) -> bool
Available on crate feature unstable only.
pub fn wait_for_break_with_timeout(&mut self, timeout: Duration) -> bool
unstable only.Waits for a break condition to be detected with a timeout.
This is a blocking function that will check for a break condition up to the specified timeout. Returns whether a break was detected before the timeout expired. After successful detection, the break interrupt flag is automatically cleared.
§Arguments
timeout- Maximum time to wait for a break condition
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Source§impl<'d> Uart<'d, Async>
impl<'d> Uart<'d, Async>
Sourcepub fn into_blocking(self) -> Uart<'d, Blocking>
pub fn into_blocking(self) -> Uart<'d, Blocking>
Sourcepub async fn write_async(&mut self, words: &[u8]) -> Result<usize, TxError>
pub async fn write_async(&mut self, words: &[u8]) -> Result<usize, TxError>
Writes data into the TX buffer.
Writes the provided buffer bytes into the UART transmit buffer. If the
buffer is full, waits asynchronously for space in the buffer to become
available.
Returns the number of bytes written into the buffer. This may be less than the length of the buffer.
Upon an error, returns immediately and the contents of the internal FIFO are not modified.
§Examples
use esp_hal::uart::{Config, Uart};
let mut uart = Uart::new(peripherals.UART0, Config::default())?
.with_rx(peripherals.GPIO1)
.with_tx(peripherals.GPIO2)
.into_async();
const MESSAGE: &[u8] = b"Hello, world!";
uart.write_async(&MESSAGE).await?;§Cancellation Safety
Cancellation safe.
Sourcepub async fn flush_async(&mut self) -> Result<(), TxError>
pub async fn flush_async(&mut self) -> Result<(), TxError>
Asynchronously flushes the UART transmit buffer.
Ensures that all pending data in the transmit FIFO has been sent over the UART. If the FIFO contains data, waits for the transmission to complete before returning.
§Examples
use esp_hal::uart::{Config, Uart};
let mut uart = Uart::new(peripherals.UART0, Config::default())?
.with_rx(peripherals.GPIO1)
.with_tx(peripherals.GPIO2)
.into_async();
const MESSAGE: &[u8] = b"Hello, world!";
uart.write_async(&MESSAGE).await?;
uart.flush_async().await?;§Cancellation Safety
Cancellation safe.
Sourcepub async fn read_async(&mut self, buf: &mut [u8]) -> Result<usize, RxError>
pub async fn read_async(&mut self, buf: &mut [u8]) -> Result<usize, RxError>
Reads data asynchronously.
Reads data from the UART receive buffer into the provided buffer. If the buffer is empty, waits asynchronously for data to become available, or for an error to occur.
Returns the number of bytes read into the buffer. This may be less than the length of the buffer.
May ignore the rx_fifo_full_threshold setting to ensure that it does not
wait for more data than the buffer can hold.
Upon an error, returns immediately and the contents of the internal FIFO are not modified.
§Examples
use esp_hal::uart::{Config, Uart};
let mut uart = Uart::new(peripherals.UART0, Config::default())?
.with_rx(peripherals.GPIO1)
.with_tx(peripherals.GPIO2)
.into_async();
const MESSAGE: &[u8] = b"Hello, world!";
uart.write_async(&MESSAGE).await?;
uart.flush_async().await?;
let mut buf = [0u8; MESSAGE.len()];
uart.read_async(&mut buf[..]).await?;§Cancellation Safety
Cancellation safe.
Sourcepub async fn read_exact_async(&mut self, buf: &mut [u8]) -> Result<(), RxError>
Available on crate feature unstable only.
pub async fn read_exact_async(&mut self, buf: &mut [u8]) -> Result<(), RxError>
unstable only.Fills buffer asynchronously.
Reads data from the UART receive buffer into the provided buffer. If the buffer is empty, waits asynchronously for data to become available, or for an error to occur.
May ignore the rx_fifo_full_threshold setting to ensure that it does not
wait for more data than the buffer can hold.
§Cancellation Safety
Not cancellation safe. If the future is dropped before it resolves, or if an error occurs during the read operation, previously read data may be lost.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub async fn wait_for_break_async(&mut self)
Available on crate feature unstable only.
pub async fn wait_for_break_async(&mut self)
unstable only.Waits for a break condition to be detected asynchronously.
This is an async function that will await until a break condition is detected on the RX line. After detection, the break interrupt flag is automatically cleared.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub async fn send_break_async<D: DelayNs>(&mut self, delay: &mut D, bits: u32)
Available on crate feature unstable only.
pub async fn send_break_async<D: DelayNs>(&mut self, delay: &mut D, bits: u32)
unstable only.Sends a break signal for a specified duration in bit time.
Duration is in bits, the time it takes to transfer one bit at the current baud rate.
Restores the original TX line state after the break signal is sent, even if the future is cancelled.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Source§impl<'d, Dm> Uart<'d, Dm>where
Dm: DriverMode,
impl<'d, Dm> Uart<'d, Dm>where
Dm: DriverMode,
Sourcepub fn with_rx(self, rx: impl PeripheralInput<'d>) -> Self
pub fn with_rx(self, rx: impl PeripheralInput<'d>) -> Self
Assigns the RX pin for UART instance.
Sets the specified pin to input and connects it to the UART RX signal.
When listening for the output of the UART peripheral, configure the driver side (the TX pin), or ensure that the line is initially high, to avoid receiving a non-data byte caused by an initial low signal level.
§Examples
use esp_hal::uart::{Config, Uart};
let uart = Uart::new(peripherals.UART0, Config::default())?.with_rx(peripherals.GPIO1);
Sourcepub fn with_tx(self, tx: impl PeripheralOutput<'d>) -> Self
pub fn with_tx(self, tx: impl PeripheralOutput<'d>) -> Self
Assigns the TX pin for UART instance.
Sets the specified pin to push-pull output and connects it to the UART TX signal.
§Examples
use esp_hal::uart::{Config, Uart};
let uart = Uart::new(peripherals.UART0, Config::default())?.with_tx(peripherals.GPIO2);
Sourcepub fn with_cts(self, cts: impl PeripheralInput<'d>) -> Self
pub fn with_cts(self, cts: impl PeripheralInput<'d>) -> Self
Configures CTS pin.
§Examples
use esp_hal::uart::{Config, Uart};
let uart = Uart::new(peripherals.UART0, Config::default())?
.with_rx(peripherals.GPIO1)
.with_cts(peripherals.GPIO3);
Sourcepub fn with_rts(self, rts: impl PeripheralOutput<'d>) -> Self
pub fn with_rts(self, rts: impl PeripheralOutput<'d>) -> Self
Configures RTS pin.
§Examples
use esp_hal::uart::{Config, Uart};
let uart = Uart::new(peripherals.UART0, Config::default())?
.with_tx(peripherals.GPIO2)
.with_rts(peripherals.GPIO3);
Sourcepub fn write_ready(&self) -> bool
pub fn write_ready(&self) -> bool
Returns whether the UART TX buffer is ready to accept more data.
If this function returns true, Self::write and Self::write_async
will not block. Otherwise, the functions will not return until the buffer is
ready.
§Examples
use esp_hal::uart::{Config, Uart};
let mut uart = Uart::new(peripherals.UART0, Config::default())?;
if uart.write_ready() {
// Because write_ready has returned true, the following call will immediately
// copy some bytes into the FIFO and return a non-zero value.
let written = uart.write(b"Hello")?;
// ... handle written bytes
} else {
// Calling write would have blocked, but here we can do something useful
// instead of waiting for the buffer to become ready.
}Sourcepub fn write(&mut self, data: &[u8]) -> Result<usize, TxError>
pub fn write(&mut self, data: &[u8]) -> Result<usize, TxError>
Writes bytes.
Writes data to the internal TX FIFO of the UART peripheral. The data is then transmitted over the UART TX line.
Returns the number of bytes written to the FIFO. This may be less than the length of the provided data. Returns 0 only if the provided data is empty.
§Examples
use esp_hal::uart::{Config, Uart};
let mut uart = Uart::new(peripherals.UART0, Config::default())?;
const MESSAGE: &[u8] = b"Hello, world!";
uart.write(&MESSAGE)?;§Errors
TxError when an error occurred during the write operation
Sourcepub fn flush(&mut self) -> Result<(), TxError>
pub fn flush(&mut self) -> Result<(), TxError>
Flushes the transmit buffer of the UART.
§Examples
use esp_hal::uart::{Config, Uart};
let mut uart = Uart::new(peripherals.UART0, Config::default())?;
const MESSAGE: &[u8] = b"Hello, world!";
uart.write(&MESSAGE)?;
uart.flush()?;Sourcepub fn send_break(&mut self, bits: u32)
Available on crate feature unstable only.
pub fn send_break(&mut self, bits: u32)
unstable only.Sends a break signal for a specified duration.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn read_ready(&self) -> bool
pub fn read_ready(&self) -> bool
Returns whether the UART receive buffer has at least one byte of data.
If this function returns true, Self::read and Self::read_async
will not block. Otherwise, they will not return until data is available.
Data that does not get stored due to an error will be lost and does not count towards the number of bytes in the receive buffer.
§Examples
use esp_hal::uart::{Config, Uart};
let mut uart = Uart::new(peripherals.UART0, Config::default())?;
while !uart.read_ready() {
// Do something else while waiting for data to be available.
}
let mut buf = [0u8; 32];
uart.read(&mut buf[..])?;
Sourcepub fn is_break_detected(&self) -> bool
Available on crate feature unstable only.
pub fn is_break_detected(&self) -> bool
unstable only.Returns whether a break condition has been detected.
The returned status is sticky and remains set until
Self::clear_break_detected is called, or until one of the
wait_for_break methods observes and clears it.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn clear_break_detected(&mut self)
Available on crate feature unstable only.
pub fn clear_break_detected(&mut self)
unstable only.Clears the break-detection status.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn read(&mut self, buf: &mut [u8]) -> Result<usize, RxError>
pub fn read(&mut self, buf: &mut [u8]) -> Result<usize, RxError>
Reads received bytes.
The UART hardware continuously receives bytes and stores them in the RX
FIFO. Reads the bytes from the RX FIFO and returns them in the provided
buffer. If the hardware buffer is empty, blocks until data is available.
Self::read_ready can be used to check if data is available without
blocking.
Returns the number of bytes read into the buffer. This may be less than the length of the buffer. Returns 0 only if the provided buffer is empty.
§Examples
use esp_hal::uart::{Config, Uart};
let mut uart = Uart::new(peripherals.UART0, Config::default())?;
const MESSAGE: &[u8] = b"Hello, world!";
uart.write(&MESSAGE)?;
uart.flush()?;
let mut buf = [0u8; MESSAGE.len()];
uart.read(&mut buf[..])?;
§Errors
RxError when a reported error occurred since
the last check for errors.
If the error occurred before this function was called, the contents of the FIFO are not modified.
Sourcepub fn apply_config(&mut self, config: &Config) -> Result<(), ConfigError>
pub fn apply_config(&mut self, config: &Config) -> Result<(), ConfigError>
Changes the configuration.
Do not call this function while a transmission is in progress. The function discards
the data that the transmitter did not send yet, and the TX line goes low for a short
time. A receiver reports that pulse as an error. Call Self::flush first, to let
the transmitter send the remaining data.
§Examples
use esp_hal::uart::{Config, Uart};
let mut uart = Uart::new(peripherals.UART0, Config::default())?;
uart.apply_config(&Config::default().with_baudrate(19_200))?;§Errors
ConfigError when the configuration is not supported by the hardware
Sourcepub fn enable_wakeup(
&mut self,
config: &WakeupConfig,
) -> Result<(), WakeConfigError>
Available on crate feature unstable only.
pub fn enable_wakeup( &mut self, config: &WakeupConfig, ) -> Result<(), WakeConfigError>
unstable only.Lets activity on the RX line wake the chip from light sleep.
§Errors
WakeConfigError::NotAWakeupSource when this UART instance cannot wake the chip,
and WakeConfigError::EdgeCountUnsupported when the hardware cannot count the requested
number of edges.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn disable_wakeup(&mut self)
Available on crate feature unstable only.
pub fn disable_wakeup(&mut self)
unstable only.Stops the UART from waking the chip.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn split(self) -> (UartRx<'d, Dm>, UartTx<'d, Dm>)
Available on crate feature unstable only.
pub fn split(self) -> (UartRx<'d, Dm>, UartTx<'d, Dm>)
unstable only.Splits the UART into a transmitter and receiver.
This is particularly useful when having two tasks correlating to transmitting and receiving.
§Examples
use esp_hal::uart::{Config, Uart};
let mut uart = Uart::new(peripherals.UART0, Config::default())?
.with_rx(peripherals.GPIO1)
.with_tx(peripherals.GPIO2);
// The UART can be split into separate Transmit and Receive components:
let (mut rx, mut tx) = uart.split();
// Each component can be used individually to interact with the UART:
tx.write(&[42u8])?;
let mut byte = [0u8; 1];
rx.read(&mut byte);§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn split_mut(&mut self) -> (&mut UartRx<'d, Dm>, &mut UartTx<'d, Dm>)
Available on crate feature unstable only.
pub fn split_mut(&mut self) -> (&mut UartRx<'d, Dm>, &mut UartTx<'d, Dm>)
unstable only.Borrows the UART as separate transmitter and receiver halves.
Unlike [split], this method does not consume the UART. The returned
transmitter and receiver are borrowed from the original UART, which can
be used again after those borrows end.
This is particularly useful when running separate transmit and receive futures concurrently.
§Examples
use esp_hal::uart::{Config, Uart};
let mut uart = Uart::new(peripherals.UART0, Config::default())?
.with_rx(peripherals.GPIO1)
.with_tx(peripherals.GPIO2);
loop {
// The UART can be split into separate Transmit and Receive components:
let (rx, tx) = uart.split_mut();
// Each component can be used individually to interact with the UART:
tx.write(&[42u8])?;
let mut byte = [0u8; 1];
rx.read(&mut byte);
}§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn check_for_rx_errors(&mut self) -> Result<(), RxError>
Available on crate feature unstable only.
pub fn check_for_rx_errors(&mut self) -> Result<(), RxError>
unstable only.Reads and clears RX error conditions set by received data.
Only errors enabled in RxConfig::with_reported_errors are returned;
disabled errors are cleared and ignored.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn read_buffered(&mut self, buf: &mut [u8]) -> Result<usize, RxError>
Available on crate feature unstable only.
pub fn read_buffered(&mut self, buf: &mut [u8]) -> Result<usize, RxError>
unstable only.Reads already received bytes.
Reads the already received bytes from the FIFO into the provided buffer. Does not wait for the FIFO to actually contain any bytes.
Returns the number of bytes read into the buffer. This may be less than the length of the buffer, and it may also be 0.
§Errors
RxError when a reported error occurred since
the last check for errors.
If the error occurred before this function was called, the contents of the FIFO are not modified.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn set_at_cmd(&mut self, config: AtCmdConfig)
Available on crate feature unstable only.
pub fn set_at_cmd(&mut self, config: AtCmdConfig)
unstable only.Configures the AT-CMD detection settings.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Trait Implementations§
Source§impl<Dm: DriverMode> ErrorType for Uart<'_, Dm>
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl<Dm: DriverMode> ErrorType for Uart<'_, Dm>
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Source§impl<Dm: DriverMode> ErrorType for Uart<'_, Dm>
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl<Dm: DriverMode> ErrorType for Uart<'_, Dm>
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Source§impl InterruptConfigurable for Uart<'_, Blocking>
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl InterruptConfigurable for Uart<'_, Blocking>
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Source§fn set_interrupt_handler(&mut self, handler: InterruptHandler)
fn set_interrupt_handler(&mut self, handler: InterruptHandler)
Source§impl<Dm> Read for Uart<'_, Dm>where
Dm: DriverMode,
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl<Dm> Read for Uart<'_, Dm>where
Dm: DriverMode,
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Source§fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf. Read moreSource§impl<Dm> Read for Uart<'_, Dm>where
Dm: DriverMode,
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl<Dm> Read for Uart<'_, Dm>where
Dm: DriverMode,
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Source§fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf. Read moreSource§impl Read for Uart<'_, Async>
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl Read for Uart<'_, Async>
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
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>
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>>
buf. Read moreSource§impl Read for Uart<'_, Async>
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl Read for Uart<'_, Async>
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
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>
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>>
buf. Read moreSource§impl<Dm> ReadReady for Uart<'_, Dm>where
Dm: DriverMode,
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl<Dm> ReadReady for Uart<'_, Dm>where
Dm: DriverMode,
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Source§impl<Dm> ReadReady for Uart<'_, Dm>where
Dm: DriverMode,
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl<Dm> ReadReady for Uart<'_, Dm>where
Dm: DriverMode,
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Source§impl<Dm> SetConfig for Uart<'_, Dm>where
Dm: DriverMode,
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl<Dm> SetConfig for Uart<'_, Dm>where
Dm: DriverMode,
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Source§type ConfigError = ConfigError
type ConfigError = ConfigError
set_config fails.Source§fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>
fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>
Source§impl<Dm> Write for Uart<'_, Dm>where
Dm: DriverMode,
impl<Dm> Write for Uart<'_, Dm>where
Dm: DriverMode,
Source§impl<Dm> Write for Uart<'_, Dm>where
Dm: DriverMode,
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl<Dm> Write for Uart<'_, Dm>where
Dm: DriverMode,
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
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<Dm> Write for Uart<'_, Dm>where
Dm: DriverMode,
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl<Dm> Write for Uart<'_, Dm>where
Dm: DriverMode,
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
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 Write for Uart<'_, Async>
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl Write for Uart<'_, Async>
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Source§async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Source§impl Write for Uart<'_, Async>
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl Write for Uart<'_, Async>
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Source§async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Source§impl<Dm> WriteReady for Uart<'_, Dm>where
Dm: DriverMode,
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl<Dm> WriteReady for Uart<'_, Dm>where
Dm: DriverMode,
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Source§impl<Dm> WriteReady for Uart<'_, Dm>where
Dm: DriverMode,
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl<Dm> WriteReady for Uart<'_, Dm>where
Dm: DriverMode,
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Source§impl<Dm> uWrite for Uart<'_, Dm>where
Dm: DriverMode,
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl<Dm> uWrite for Uart<'_, Dm>where
Dm: DriverMode,
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.