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:
- Enables the MRCC clock gate for this peripheral
- Calls the
G::MrccPeriphConfig::post_enable_config()method, returning an error and re-disabling the peripheral if this fails. - Pulses the MRCC reset line, to reset the peripheral to the default state
- 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.