[][src]Struct esp32_hal::clock_control::ClockControl

pub struct ClockControl { /* fields omitted */ }

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

impl ClockControl[src]

pub unsafe fn park_core(&mut self, core: Core)[src]

pub fn unpark_core(&mut self, core: Core)[src]

pub fn start_app_core(&mut self, entry: fn() -> !) -> Result<(), Error>[src]

Start the APP (second) core

The second core will start running with the function entry.

impl<'a> ClockControl[src]

pub fn get_lock_count(&self) -> Locks[src]

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.

impl ClockControl[src]

pub fn pll_frequency(&self) -> Hertz[src]

Get PLL frequency

impl ClockControl[src]

pub fn new<T: Into<Hertz> + Copy>(
    rtc_control: RTCCNTL,
    apb_control: APB_CTRL,
    dport_control: ClockControl,
    xtal_frequency: T
) -> Result<Self, Error>
[src]

Create new ClockControl structure

pub fn freeze(self) -> Result<(ClockControlConfig, Watchdog), Error>[src]

Freeze clock settings and return ClockControlConfig

pub fn is_rtc8m_enabled(&self) -> bool[src]

Check if 8MHz oscillator is enabled

pub fn is_rtc8md256_enabled(&self) -> bool[src]

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
[src]

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).

pub fn ref_frequency(&self) -> Hertz[src]

Get Ref Tick frequency

This frequency is usually 1MHz, but cannot be maintained when the APB_CLK is < 10MHz

pub fn apb_frequency(&self) -> Hertz[src]

Get APB frequency

This gets the APB frequency from the scratch register, which is initialized during the clock calibration

pub fn slow_rtc_frequency(&self) -> Hertz[src]

Get Slow RTC frequency

pub fn slow_rtc_source(&self) -> Result<SlowRTCSource, Error>[src]

Get Slow RTC source

pub fn set_slow_rtc_source(&mut self, source: SlowRTCSource) -> &mut Self[src]

Set the Slow RTC clock source

pub fn fast_rtc_frequency(&self) -> Hertz[src]

Get Fast RTC frequency

pub fn fast_rtc_source(&self) -> FastRTCSource[src]

Get the Fast RTC clock source

pub fn set_fast_rtc_source(&mut self, source: FastRTCSource) -> &mut Self[src]

Set the Fast RTC clock source

pub fn xtal_frequency_from_scratch(&self) -> Result<Hertz, Error>[src]

Get Xtal frequency.

This gets the Xtal frequency from a scratch register, which is initialized during the clock calibration

pub fn rtc_tick_count(&self) -> TicksU64[src]

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.

pub fn rtc_nanoseconds(&self) -> NanoSecondsU64[src]

Get nanoseconds since boot based on RTC tick count

Trait Implementations

impl Debug for ClockControl[src]

Custom debug formatter

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.