nrfcxx  0.1.0
C++-17 Framework for Nordic nRF5 Devices
Static Public Member Functions | Static Public Attributes
nrfcxx::clock::lfclk Class Reference

Functions and data related to the low-frequency clock. More...

#include <nrfcxx/clock.hpp>

Static Public Member Functions

static bool active ()
 Return true iff the low-frequency clock is active.
 
static int configure (int on)
 Enable, disable, or query the state of the low-frequency clock. More...
 
static uint32_t source ()
 Return the actual source for the low-frequency clock.
 
static int source_configure (int src, unsigned cal_interval_qs=DefaultRCOCalInterval_qs)
 Enable, disable, or query the source of the low-frequency crystal. More...
 

Static Public Attributes

constexpr static unsigned int Frequency_Hz = 32768U
 The low-frequency clock always runs at nominal 32 KiHz.
 
constexpr static unsigned int DefaultRCOCalInterval_qs = 4 * 4
 The default RC oscillator calibration interval, in quarter-seconds. More...
 

Detailed Description

Functions and data related to the low-frequency clock.

The low-frequency clock must be explicitly enabled and may be sourced from a crystal oscillator, an RC oscillator, or synthesized from the high frequency crystal.

Note
This is a data type for visibility management only; all members are static and it is not possible to create or manipulate instances of the type.

Member Function Documentation

◆ configure()

static int nrfcxx::clock::lfclk::configure ( int  on)
static

Enable, disable, or query the state of the low-frequency clock.

Parameters
ona positive value to enable the clock; zero to disable it; a negative value to return the configured state without change.
Returns
A positive if the clock was configured on prior to this call, zero if the clock was configured off, a negative value if a configuration change could not be executed.
Note
The default state of the clock on power-up is disabled, but initialize() will always enable it.
source_configure() may be used to select the desired clock source, but it will not take effect until the next time the clock changes from disabled to enabled.
This function will fail if calibration is being performed when disabling LFCLK sourced from #CLOCK_LFCLKSRC_SRC_RC. Retry after about 16 ms.

◆ source_configure()

static int nrfcxx::clock::lfclk::source_configure ( int  src,
unsigned  cal_interval_qs = DefaultRCOCalInterval_qs 
)
static

Enable, disable, or query the source of the low-frequency crystal.

Parameters
srcone of #CLOCK_LFCLKSRC_SRC_RC, #CLOCK_LFCLKSRC_SRC_Xtal, or #CLOCK_LFCLKSRC_SRC_Synth, or a negative value to return the configured source without change.
cal_interval_qsthe clock calibration interval when configured to use #CLOCK_LFCLKSRC_SRC_RC. Pass zero to disable repeated calibration. Ignored for other configuration options.
Returns
one of #CLOCK_LFCLKSRC_SRC_RC, #CLOCK_LFCLKSRC_SRC_Xtal, or #CLOCK_LFCLKSRC_SRC_Synth, or a negative value on an attempt to change the clock source while active() is true.
Note
The power-up default source is #CLOCK_LFCLKSRC_SRC_RC, but clock::initialize() may change that to a crystal if the board provides one.
Although passing zero disables repeated calibration when src is #CLOCK_LFCLKSRC_SRC_RC the system will unconditionally execute one calibration as soon as the clock has started with this source.

Field Documentation

◆ DefaultRCOCalInterval_qs

constexpr static unsigned int nrfcxx::clock::lfclk::DefaultRCOCalInterval_qs = 4 * 4
staticconstexpr

The default RC oscillator calibration interval, in quarter-seconds.

A 4 s interval is expected to maintain 250 ppm accuracy in varying temperature environments.


The documentation for this class was generated from the following file: