pub struct Usart<R> {
    pub regs: R,
    /* private fields */
}
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.

Transmit data using DMA. (L44 RM, section 38.5.15) Note that the channel argument is only used on F3 and L4.

Receive data using DMA. (L44 RM, section 38.5.15; G4 RM section 37.5.19. Note that the channel argument is only used on F3 and L4.

Flush the transmit buffer.

Enable a specific type of interrupt.

Clears the interrupt pending flag for a specific type of interrupt.

Trait Implementations

Read error

Reads a single word from the serial interface

Write error

Writes a single word to the serial interface

Ensures that none of the previously written words are still buffered

The type of error that can occur when writing

Writes a slice, blocking until everything has been written Read more

Block until the serial interface has sent all buffered words

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.