embassy-mcxa

Crates

git

Versions

mcx-a256

Flavors

enable_and_reset

Function enable_and_reset 

Source
pub unsafe fn enable_and_reset<G: Gate>(
    cfg: &G::MrccPeriphConfig,
) -> Result<u32, ClockError>
Expand description

This is the primary helper method HAL drivers are expected to call when creating an instance of the peripheral.

This method:

  1. Enables the MRCC clock gate for this peripheral
  2. Calls the G::MrccPeriphConfig::post_enable_config() method, returning an error and re-disabling the peripheral if this fails.
  3. Pulses the MRCC reset line, to reset the peripheral to the default state
  4. Returns the frequency, in Hz that is fed into the peripheral, taking into account the selected upstream clock, as well as any division specified by cfg.

NOTE: if a clock is disabled, sourced from an “ambient” clock source, this method may return Ok(0). In the future, this might be updated to return the correct “ambient” clock, e.g. the AHB/APB frequency.

§SAFETY

This peripheral must not yet be in use prior to calling enable_and_reset.