Struct stm32_hal2::usart::Usart [−][src]
pub struct Usart<R> {
pub baud: u32,
pub config: UsartConfig,
// some fields omitted
}Expand description
Represents the USART peripheral, for serial communications.
Fields
baud: u32config: UsartConfigImplementations
pub fn new(
regs: R,
device: UsartDevice,
baud: u32,
config: UsartConfig,
clock_cfg: &Clocks
) -> Self
pub fn new(
regs: R,
device: UsartDevice,
baud: u32,
config: UsartConfig,
clock_cfg: &Clocks
) -> Self
Initialize a U[s]ART peripheral, including configuration register writes, and enabling and
resetting its RCC peripheral clock. baud is the baud rate, in bytes-per-second.
Set the BAUD rate. Called during init, and can be called later to change BAUD during program execution.
Transmit data, as a sequence of u8. See L44 RM, section 38.5.2: “Character transmission procedure”
Receive data into a u8 buffer. See L44 RM, section 38.5.3: “Character reception procedure”
Read a single word, without confirming if it’s ready. This is useful in async concepts, when you know word is ready to be read.
pub unsafe fn write_dma<D>(
&mut self,
buf: &[u8],
channel: DmaChannel,
dma: &mut Dma<D>
) where
D: Deref<Target = RegisterBlock>,
pub unsafe fn write_dma<D>(
&mut self,
buf: &[u8],
channel: DmaChannel,
dma: &mut Dma<D>
) where
D: Deref<Target = RegisterBlock>,
Transmit data using DMA. (L44 RM, section 38.5.15)
Note that the channel argument is only used on F3 and L4.
pub unsafe fn read_dma<D>(
&mut self,
buf: &mut [u8],
channel: DmaChannel,
dma: &mut Dma<D>
) where
D: Deref<Target = RegisterBlock>,
pub unsafe fn read_dma<D>(
&mut self,
buf: &mut [u8],
channel: DmaChannel,
dma: &mut Dma<D>
) where
D: Deref<Target = RegisterBlock>,
Receive data using DMA. (L44 RM, section 38.5.15)
Note that the channel argument is only used on F3 and L4.
Enable a specific type of interrupt.
Clears the interrupt pending flag for a specific type of interrupt.
Trait Implementations
impl<U> Read<u8> for Usart<U> where
U: Deref<Target = RegisterBlock>,
This is supported on crate feature embedded-hal only.
impl<U> Read<u8> for Usart<U> where
U: Deref<Target = RegisterBlock>,
embedded-hal only.impl<R> Write<u8> for Usart<R> where
R: Deref<Target = RegisterBlock>,
This is supported on crate feature embedded-hal only.
impl<R> Write<u8> for Usart<R> where
R: Deref<Target = RegisterBlock>,
embedded-hal only.Writes a slice, blocking until everything has been written Read more
impl<R> Write<u8> for Usart<R> where
R: Deref<Target = RegisterBlock>,
This is supported on crate feature embedded-hal only.
impl<R> Write<u8> for Usart<R> where
R: Deref<Target = RegisterBlock>,
embedded-hal only.