pub struct Baud {
pub osr: u32,
pub sbr: u32,
pub bothedge: bool,
}
Expand description
Values specific to the baud rate.
To compute the values for a given baud rate,
use compute
. To understand
the actual baud rate, use value
.
Advanced users may choose to set the OSR, SBR, and BOTHEDGE values directly.
use imxrt_hal::lpuart::Baud;
// Assume UART clock is driven from the crystal
// oscillator...
const UART_CLOCK_HZ: u32 = 24_000_000;
const BAUD: Baud = Baud::compute(UART_CLOCK_HZ, 115200);
Fields§
§osr: u32
Oversampling rate.
This should be set between 4 and 32.
The driver clamps the osr
value within
this range.
sbr: u32
Baud rate modulo divisor.
The driver commits this value directly.
A value of zero is allowed, but will disable
baud rate generation in hardware. The max
value is (2^13) - 1
. The implementation
limits the max value.
bothedge: bool
Both edge sampling.
Should be set when the oversampling rate is between 4 and 7. Optional for higher sampling rates. The driver will commit this value directly.
Implementations§
Trait Implementations§
source§impl PartialEq for Baud
impl PartialEq for Baud
impl Copy for Baud
impl Eq for Baud
impl StructuralEq for Baud
impl StructuralPartialEq for Baud
Auto Trait Implementations§
impl RefUnwindSafe for Baud
impl Send for Baud
impl Sync for Baud
impl Unpin for Baud
impl UnwindSafe for Baud
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more