pub struct Clock<T, Mode> { /* private fields */ }Expand description
Defines the clock configuration for a USART instance
This struct has two type arguments:
Tspecifies the clock used to power the USART clock. This clock will be selected when the USART instance is enabled.Modespecifies the USART mode. A distinction between synchronous and asynchronous mode has to be made, as OSRVAL has no meaning in synchronous mode.
Implementations§
Source§impl Clock<IOSC, AsyncMode>
impl Clock<IOSC, AsyncMode>
Sourcepub fn new_with_baudrate(baudrate: u32) -> Self
pub fn new_with_baudrate(baudrate: u32) -> Self
Create a new configuration with a specified baudrate
Searches for configuration values that lead to a baud rate that is within 5% accuracy of the desired baudrate. Panics, if it can’t find such parameters.
Chooses the highest possibly oversampling value that will still give the desired accuracy. Please note that if the oversampling value gets too low, this can result in framing and noise errors when receiving data.
Due to the aforementioned limitations, and because this methods is
relatively computationally expensive, it is recommended to only use
it during initialization, with known baud rates. If you need more
control, please use Clock::new in combination with an FRG.
Assumes the internal oscillator runs at 12 MHz.