Struct atsamd_hal::clock::v2::xosc32k::Xosc32kBase    
source · [−]pub struct Xosc32kBase<M: Mode> { /* private fields */ }Expand description
XOSC32K base clock, which feeds the Xosc1k and Xosc32k clocks
The XOSC32K peripheral has two possible clock outputs, one at 32 kHz and
another at 1 kHz. This structure is represented in the type system as a set
of three clocks forming a small clock tree. The Xosc32kBase clock
represents the configurable base oscillator that feeds the optional
Xosc1k and Xosc32k output clocks. See the
module-level documentation for details and examples.
Implementations
sourceimpl Xosc32kBase<ClockMode>
 
impl Xosc32kBase<ClockMode>
sourcepub fn from_clock(token: Xosc32kBaseToken, xin32: impl Into<XIn32>) -> Self
 
pub fn from_clock(token: Xosc32kBaseToken, xin32: impl Into<XIn32>) -> Self
Create the Xosc32kBase clock from an external clock, taking
ownership of the XIn32 Pin
Creating an Xosc32kBase clock does not modify any of the hardware
registers. It only creates a struct to track the configuration. The
configuration data is stored until the user calls enable. At that
point, all of the registers are written according to the initialization
procedures specified in the datasheet, and an EnabledXosc32kBase
clock is returned. The Xosc32kBase clock is not active or useful until
that point.
sourcepub fn free(self) -> (Xosc32kBaseToken, XIn32)
 
pub fn free(self) -> (Xosc32kBaseToken, XIn32)
Consume the Xosc32kBase and release the Xosc32kBaseToken and
XIn32 Pin
sourceimpl Xosc32kBase<CrystalMode>
 
impl Xosc32kBase<CrystalMode>
sourcepub fn from_crystal(
    token: Xosc32kBaseToken,
    xin32: impl Into<XIn32>,
    xout32: impl Into<XOut32>
) -> Self
 
pub fn from_crystal(
    token: Xosc32kBaseToken,
    xin32: impl Into<XIn32>,
    xout32: impl Into<XOut32>
) -> Self
Create the Xosc32kBase clock from an external crystal oscillator,
taking ownership of the XIn32 and XOut32 Pins.
Creating an Xosc32kBase clock does not modify any of the hardware
registers. It only creates a struct to track the configuration. The
configuration data is stored until the user calls enable. At that
point, all of the registers are written according to the initialization
procedures specified in the datasheet, and an EnabledXosc32kBase
clock is returned. The Xosc32kBase is not active or useful until that
point.
sourcepub fn free(self) -> (Xosc32kBaseToken, XIn32, XOut32)
 
pub fn free(self) -> (Xosc32kBaseToken, XIn32, XOut32)
Consume the Xosc32kBase and release the Xosc32kBaseToken,
XIn32 and XOut32 Pins
sourcepub fn control_gain_mode(self, cgm: ControlGainMode) -> Self
 
pub fn control_gain_mode(self, cgm: ControlGainMode) -> Self
Set the crystal oscillator ControlGainMode
sourceimpl<M: Mode> Xosc32kBase<M>
 
impl<M: Mode> Xosc32kBase<M>
sourcepub fn start_up_delay(self, delay: StartUpDelay) -> Self
 
pub fn start_up_delay(self, delay: StartUpDelay) -> Self
Set the start up delay before the Xosc32kBase clock is unmasked and
continuously monitored
During the start up period, the Xosc32kBase clock is masked to
prevent clock instability from propagating to the digital logic. During
this time, clock failure detection is disabled.
sourcepub fn on_demand(self, on_demand: bool) -> Self
 
pub fn on_demand(self, on_demand: bool) -> Self
Control the XOSC32K on-demand behavior
When the on-demand is enabled, the XOSC32K clocks will only run in Idle or Standby sleep modes if it is requested by a peripheral. Otherwise, its behavior is dependent on the run-standby setting.
sourcepub fn run_standby(self, run_standby: bool) -> Self
 
pub fn run_standby(self, run_standby: bool) -> Self
Control the XOSC32K behavior in Standby sleep mode
When RUNSTDBY is disabled, the XOSC32K clocks will never run in
Standby sleep mode unless ONDEMAND is enabled and a clock is requested
by a peripheral.
When RUNSTDBY is enabled, the Xosc will run in Standby sleep mode,
but it can still be disabled if ONDEMAND is enabled and a clock is not
requested.
sourcepub fn write_lock(self)
 
pub fn write_lock(self)
Freeze the XOSC32K configuration until power-on reset
This function sets the write-lock bit, which freezes the XOSC32K
configuration at the hardware level until power-on reset. At the API
level, it also consumes and drops the Xosc32kBase, which prevents
any further modifications.
NOTE: Because the Xosc32kBase is not yet enabled, calling this
method will lock both the Xosc1k and Xosc32k in their disabled
state.
sourcepub fn enable(self) -> EnabledXosc32kBase<M>
 
pub fn enable(self) -> EnabledXosc32kBase<M>
Enable the Xosc32kBase clock, so that it can be used as a clock
Source for the Xosc1k and Xosc32k clocks
As mentioned when creating a new Xosc32kBase, no hardware registers
are actually modified until this call. Rather, the desired configuration
is stored internally, and the Xosc32kBase is initialized and
configured here according to the datasheet.
The returned value is an EnabledXosc32kBase that can be used as a
clock Source for the Xosc1k and Xosc32k clocks.