pub struct Div4(/* private fields */);Expand description
This type represents a divider in the range 1..=16.
At a hardware level, this is an 8-bit register from 0..=15, which adds one.
While the clock domain seems to use 8-bit dividers, the peripheral domain seems to use 4 bit dividers!
Implementations§
Source§impl Div4
impl Div4
Sourcepub const fn from_raw(n: u8) -> Option<Self>
pub const fn from_raw(n: u8) -> Option<Self>
Store a “raw” divisor value that will divide the source by
(n + 1), e.g. Div4::from_raw(0) will divide the source
by 1, and Div4::from_raw(15) will divide the source by
16.
Sourcepub const fn from_divisor(n: u8) -> Option<Self>
pub const fn from_divisor(n: u8) -> Option<Self>
Store a specific divisor value that will divide the source
by n. e.g. Div4::from_divisor(1) will divide the source
by 1, and Div4::from_divisor(16) will divide the source
by 16.
Will return None if n is not in the range 1..=16.
Consider Self::from_raw for an infallible version.
Sourcepub const fn into_divisor(self) -> u32
pub const fn into_divisor(self) -> u32
Convert into “divisor” form, as a u32 for convenient frequency math
Trait Implementations§
impl Copy for Div4
impl Eq for Div4
impl StructuralPartialEq for Div4
Auto Trait Implementations§
impl Freeze for Div4
impl RefUnwindSafe for Div4
impl Send for Div4
impl Sync for Div4
impl Unpin for Div4
impl UnwindSafe for Div4
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