pub struct CkoutDivider(/* private fields */);Expand description
CKOUT divider register value.
0 = CKOUT stopped; 1..=255 = enabled (actual divider = value + 1, range 2..=256).
The CKOUT output runs at 0 to 20 MHz. Stop CKOUT (divider 0) and wait for the clock to settle before changing the CKOUT source, or the output can glitch. Stopping takes 4 system-clock cycles for the system source, or 1 system clock plus 3 audio-clock cycles for the audio source.
Implementations§
Source§impl CkoutDivider
impl CkoutDivider
Sourcepub fn new(divider: u16) -> Self
pub fn new(divider: u16) -> Self
Create from the actual divider value (2..=256).
Panics if out of range.
For a non-panicking variant, use CkoutDivider::try_from.
Sourcepub fn from_frequency<T: Instance>(
source: Hertz,
ckout_rate: Hertz,
) -> Result<Self, Error>
pub fn from_frequency<T: Instance>( source: Hertz, ckout_rate: Hertz, ) -> Result<Self, Error>
Compute the divider to get a wanted CKOUT output frequency from the CKOUT source clock.
source is the CKOUT input clock (selected by CkoutSource);
ckout_rate is the wanted CKOUT frequency. The divider is rounded
up so the actual CKOUT frequency never exceeds ckout_rate.
The DFSDM kernel clock (crate::rcc::frequency::<T>()) must be at
least 4x ckout_rate (SPI coding, RM0455); this is enforced here.
§Errors
Returns Error::InvalidConfig if the wanted frequency is zero, too
high relative to the kernel clock, or unreachable with the 2..=256
divider range.
§Panics
Panics if the clock is not active.
Sourcepub fn for_manchester<T: Instance>(
source: Hertz,
manchester_rate: Hertz,
) -> Result<Self, Error>
pub fn for_manchester<T: Instance>( source: Hertz, manchester_rate: Hertz, ) -> Result<Self, Error>
Compute the divider for a Manchester data rate.
manchester_rate is the expected Manchester data rate, i.e. the
recovered clock frequency (RM0455: 0 to 10 MHz and < fDFSDMCLK/6). The
divider is chosen so the Manchester period satisfies
(CKOUTDIV + 1) x T_source < T_manchester < 2 x CKOUTDIV x T_source
(RM0455), which puts the CKOUT output at ~1.5x the Manchester rate,
inside the valid window.
The DFSDM kernel clock (crate::rcc::frequency::<T>()) must be at
least 6x the Manchester rate; this is enforced here.
§Errors
Returns Error::InvalidConfig if the rate is above 10 MHz, above
fDFSDMCLK/6, or unreachable with the 2..=256 divider range.
§Panics
Panics if the clock is not active.
Trait Implementations§
Source§impl Clone for CkoutDivider
impl Clone for CkoutDivider
Source§fn clone(&self) -> CkoutDivider
fn clone(&self) -> CkoutDivider
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more