Struct esp32_hal::clock_control::ClockControl [−][src]
pub struct ClockControl { /* fields omitted */ }
Expand description
Clock Control for initialization. Once initialization is done, call the freeze function to lock the clock configuration. This will return a ClockControlConfig, which can be copied for e.g. use in multiple peripherals.
Implementations
Start the APP (second) core
The second core will start running with the function entry
.
Get the current count of the PCU, APB, Awake and PLL/2 locks
Note that this function cannot be used form within a callback as it tries to lock the mutex, leading to a dead-lock.
Get PLL frequency
Create new ClockControl structure
Freeze clock settings and return ClockControlConfig
Check if 8MHz oscillator is enabled
Check if 8MHz oscillator is enabled
pub fn set_cpu_frequencies<T1, T2, T3>(
&mut self,
cpu_source_default: CPUSource,
cpu_frequency_default: T1,
cpu_source_locked: CPUSource,
cpu_frequency_locked: T2,
cpu_source_apb_locked: CPUSource,
cpu_frequency_apb_locked: T3
) -> Result<&mut Self, Error> where
T1: Into<Hertz> + Copy + PartialOrd,
T2: Into<Hertz> + Copy + PartialOrd,
T3: Into<Hertz> + Copy + PartialOrd,
pub fn set_cpu_frequencies<T1, T2, T3>(
&mut self,
cpu_source_default: CPUSource,
cpu_frequency_default: T1,
cpu_source_locked: CPUSource,
cpu_frequency_locked: T2,
cpu_source_apb_locked: CPUSource,
cpu_frequency_apb_locked: T3
) -> Result<&mut Self, Error> where
T1: Into<Hertz> + Copy + PartialOrd,
T2: Into<Hertz> + Copy + PartialOrd,
T3: Into<Hertz> + Copy + PartialOrd,
Set CPU default, locked and apb frequencies for Dynamic Frequency Switching.
The default source and frequency are used when no locks are acquired. (Typically this would be) the lowest frequency.)
The cpu_locked source & frequency are used when the cpu frequency is locked, unless an apb lock is acquired and the apb_locked frequency is higher then the cpu_locked frequency.
The apb_locked source & frequency is used when peripherals request a locked apb frequency.
This function switches to the default source & frequency (locks can not have been acquired yet as this can only be done from ClockControlConfig).
Get Ref Tick frequency
This frequency is usually 1MHz, but cannot be maintained when the APB_CLK is < 10MHz
Get APB frequency
This gets the APB frequency from the scratch register, which is initialized during the clock calibration
Get Slow RTC frequency
Get Slow RTC source
Set the Slow RTC clock source
Get Fast RTC frequency
Get the Fast RTC clock source
Set the Fast RTC clock source
Get Xtal frequency.
This gets the Xtal frequency from a scratch register, which is initialized during the clock calibration
Get RTC tick count since boot
This function can usually take up to one RTC clock cycle (~300us).
In exceptional circumstances it could take up to two RTC clock cycles. This can happen when an interrupt routine or the other core calls this function exactly in between the loop checking for the valid bit and entering the critical section.
Interrupts are only blocked during the actual reading of the clock register, not during the wait for valid data.
Get nanoseconds since boot based on RTC tick count