pub trait SPConfHelper {
// Required method
fn post_enable_config(&self, clocks: &Clocks) -> Result<u32, ClockError>;
}Expand description
Sealed Peripheral Configuration Helper
NOTE: the name “sealed” doesn’t totally make sense because its not sealed yet in the embassy-mcxa project, but it derives from embassy-imxrt where it is. We should fix the name, or actually do the sealing of peripherals.
This trait serves to act as a per-peripheral customization for clocking behavior.
This trait should be implemented on a configuration type for a given peripheral, and
provide the methods that will be called by the higher level operations like
embassy_mcxa::clocks::enable_and_reset().
Required Methods§
Sourcefn post_enable_config(&self, clocks: &Clocks) -> Result<u32, ClockError>
fn post_enable_config(&self, clocks: &Clocks) -> Result<u32, ClockError>
This method is called AFTER a given MRCC peripheral has been enabled (e.g. un-gated), but BEFORE the peripheral reset line is reset.
This function should check that any relevant upstream clocks are enabled, are in a
reasonable power state, and that the requested configuration can be made. If any of
these checks fail, an Err(ClockError) should be returned, likely ClockError::BadConfig.
This function SHOULD NOT make any changes to the system clock configuration, even unsafely, as this should remain static for the duration of the program.
This function WILL be called in a critical section, care should be taken not to delay for an unreasonable amount of time.
On success, this function MUST return an Ok(freq), where freq is the frequency
fed into the peripheral, taking into account the selected source clock, as well as
any pre-divisors.