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

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

#include <nrfcxx/clock.hpp>

Static Public Member Functions

static bool hfxt_active ()
 Return true iff the high-frequency clock is being driven by a crystal oscillator. More...
 
static bool hfxt_configure (int on)
 Enable, disable, or query the state of application request for the high-frequency crystal. More...
 

Static Public Attributes

constexpr static unsigned int Frequency_Hz = 16'000'000
 The high-frequency clock always runs at nominal 16 MHz. More...
 

Static Protected Member Functions

static void constlat_request (const periph::TIMER &timer, bool enable)
 Set or clear timer-based requests for constant latency wakeups. More...
 

Friends

class periph::TIMER
 TIMER needs to request and release HFCLK constant latency.
 

Detailed Description

Functions and data related to the high-frequency clock.

The high-frequency clock is on when the system is in ON mode, but may be sourced from either crystal oscillator or an RC oscillator.

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

◆ constlat_request()

static void nrfcxx::clock::hfclk::constlat_request ( const periph::TIMER timer,
bool  enable 
)
staticprotected

Set or clear timer-based requests for constant latency wakeups.

See also
periph::TIMER::configure
Note
Although this supports nRF51 PAN 11 "HFCLK: Base current with HFCLK running is too high" by ensuring a running timer sets the power submode to force HFCLK active, it is independently useful to reduce latency when timer interrupts occur.

◆ hfxt_active()

static bool nrfcxx::clock::hfclk::hfxt_active ( )
inlinestatic

Return true iff the high-frequency clock is being driven by a crystal oscillator.

If false the clock uses the RC oscillator.

◆ hfxt_configure()

static bool nrfcxx::clock::hfclk::hfxt_configure ( int  on)
static

Enable, disable, or query the state of application request for the high-frequency crystal.

Parameters
ona positive value to enable the HFXT; zero to disable HFXT; a negative value to return the configured state without change.
Returns
true iff the configured state of the crystal is on.
Note
This controls whether the application requires the crystal as a source. hfxt_active() can be false when the crystal is configured enabled (e.g. while stabilizing), and can be true when the crystal is configured disabled (e.g. when calibrating a synthesized low-frequency clock).
Warning
On some nRF51 chips starting the HFXT may inhibit functional writes to nrf5::CLOCK->LFCLKSRC until the HFCLKSTARTED event is received. A reasonable workaround is to start the LFCLK first. See devzone for the anomaly report to Nordic.

Field Documentation

◆ Frequency_Hz

constexpr static unsigned int nrfcxx::clock::hfclk::Frequency_Hz = 16'000'000
staticconstexpr

The high-frequency clock always runs at nominal 16 MHz.

This is true for both nRF51 where system clock is at 16 MHz, and for nRF52 where system clock is at 64 MHz.


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