Struct stm32_hal2::usart::Usart [−][src]
pub struct Usart<U> { pub baud: u32, pub config: UsartConfig, // some fields omitted }
Expand description
Represents the USART peripheral, for serial communications.
Fields
baud: u32
config: UsartConfig
Implementations
impl<U> Usart<U> where
U: Deref<Target = RegisterBlock>,
[src]
impl<U> Usart<U> where
U: Deref<Target = RegisterBlock>,
[src]pub fn new<C: ClockCfg>(
regs: U,
device: UsartDevice,
baud: u32,
config: UsartConfig,
clock_cfg: &C,
rcc: &mut RCC
) -> Self
[src]
regs: U,
device: UsartDevice,
baud: u32,
config: UsartConfig,
clock_cfg: &C,
rcc: &mut RCC
) -> Self
pub fn set_baud<C: ClockCfg>(&mut self, baud: u32, clock_cfg: &C)
[src]
pub fn set_baud<C: ClockCfg>(&mut self, baud: u32, clock_cfg: &C)
[src]Set the BAUD rate. Called during init, and can be called later to change BAUD during program execution.
pub fn write(&mut self, data: &[u8])
[src]
pub fn write(&mut self, data: &[u8])
[src]Transmit data, as a sequence of u8.. See L44 RM, section 38.5.2: “Character transmission procedure”
pub fn read(&mut self, buf: &mut [u8])
[src]
pub fn read(&mut self, buf: &mut [u8])
[src]Receive data into a u8 buffer. See L44 RM, section 38.5.3: “Character reception procedure”
pub fn read_one(&mut self) -> u8
[src]
pub fn read_one(&mut self) -> u8
[src]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 fn enable_dma<D>(&mut self, dma: &mut Dma<D>) where
D: Deref<Target = RegisterBlock>,
[src]
pub fn enable_dma<D>(&mut self, dma: &mut Dma<D>) where
D: Deref<Target = RegisterBlock>,
[src]Enable use of DMA transmission for U[s]ART: (L44 RM, section 38.5.15)
pub fn write_dma<D>(
&mut self,
buf: &[u8],
channel: DmaChannel,
dma: &mut Dma<D>
) where
D: Deref<Target = RegisterBlock>,
[src]
pub fn write_dma<D>(
&mut self,
buf: &[u8],
channel: DmaChannel,
dma: &mut Dma<D>
) where
D: Deref<Target = RegisterBlock>,
[src]Transmit data using DMA. (L44 RM, section 38.5.15)
Note that the channel
argument is only used on F3 and L4.
pub fn read_dma<D>(
&mut self,
buf: &mut [u8],
channel: DmaChannel,
dma: &mut Dma<D>
) where
D: Deref<Target = RegisterBlock>,
[src]
pub fn read_dma<D>(
&mut self,
buf: &mut [u8],
channel: DmaChannel,
dma: &mut Dma<D>
) where
D: Deref<Target = RegisterBlock>,
[src]Receive data using DMA. (L44 RM, section 38.5.15)
Note that the channel
argument is only used on F3 and L4.
pub fn enable_interrupt(&mut self, interrupt: UsartInterrupt)
[src]
pub fn enable_interrupt(&mut self, interrupt: UsartInterrupt)
[src]Enable a specific type of interrupt.
pub fn clear_interrupt(&mut self, interrupt: UsartInterrupt)
[src]
pub fn clear_interrupt(&mut self, interrupt: UsartInterrupt)
[src]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>,
[src]
impl<U> Read<u8> for Usart<U> where
U: Deref<Target = RegisterBlock>,
[src]impl<U> Write<u8> for Usart<U> where
U: Deref<Target = RegisterBlock>,
[src]
impl<U> Write<u8> for Usart<U> where
U: Deref<Target = RegisterBlock>,
[src]fn bwrite_all(&mut self, buffer: &[u8]) -> Result<(), Error>
[src]
fn bwrite_all(&mut self, buffer: &[u8]) -> Result<(), Error>
[src]Writes a slice, blocking until everything has been written Read more
impl<U> Write<u8> for Usart<U> where
U: Deref<Target = RegisterBlock>,
[src]
impl<U> Write<u8> for Usart<U> where
U: Deref<Target = RegisterBlock>,
[src]Auto Trait Implementations
impl<U> Send for Usart<U> where
U: Send,
U: Send,
impl<U> Sync for Usart<U> where
U: Sync,
U: Sync,
impl<U> Unpin for Usart<U> where
U: Unpin,
U: Unpin,