Struct stm32_hal2::usart::Usart [−][src]
pub struct Usart<R> {
pub regs: R,
// some fields omitted
}
Expand description
Represents the USART peripheral, for serial communications.
Fields
regs: R
Implementations
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.