nrfx 2.5
Macros | Enumerations | Functions
Clock HAL

Hardware access layer for managing the CLOCK peripheral. More...

Macros

#define NRF_CLOCK_HAS_CALIBRATION   1
 Presence of the Low Frequency Clock calibration.
 
#define NRF_CLOCK_HAS_CALIBRATION_TIMER   1
 Presence of the Low Frequency Clock calibration timer.
 
#define NRF_CLOCK_HAS_HFCLK192M   1
 Presence of the 192 MHz clock.
 
#define NRF_CLOCK_HAS_HFCLKAUDIO   1
 Presence of the Audio clock.
 
#define NRF_CLOCK_HAS_ALWAYSRUN   1
 Presence of ALWAYSRUN registers.
 
#define NRF_CLOCK_HAS_HFCLKSRC   1
 Presence of HFCLKSRC register.
 

Enumerations

enum  nrf_clock_lfclk_t {
  NRF_CLOCK_LFCLK_LFULP = CLOCK_LFCLKSRC_SRC_LFULP,
  NRF_CLOCK_LFCLK_RC = CLOCK_LFCLKSRC_SRC_RC,
  NRF_CLOCK_LFCLK_Xtal = CLOCK_LFCLKSRC_SRC_Xtal,
  NRF_CLOCK_LFCLK_Synth = CLOCK_LFCLKSRC_SRC_Synth,
  NRF_CLOCK_LFCLK_Xtal_Low_Swing,
  NRF_CLOCK_LFCLK_Xtal_Full_Swing
}
 Low-frequency clock sources. More...
 
enum  nrf_clock_hfclk_t {
  NRF_CLOCK_HFCLK_LOW_ACCURACY = CLOCK_HFCLKSTAT_SRC_RC,
  NRF_CLOCK_HFCLK_HIGH_ACCURACY = CLOCK_HFCLKSTAT_SRC_Xtal
}
 High-frequency clock sources. More...
 
enum  nrf_clock_domain_t {
  NRF_CLOCK_DOMAIN_LFCLK,
  NRF_CLOCK_DOMAIN_HFCLK,
  NRF_CLOCK_DOMAIN_HFCLK192M,
  NRF_CLOCK_DOMAIN_HFCLKAUDIO
}
 Clock domains.
 
enum  nrf_clock_hfclk_div_t {
  NRF_CLOCK_HFCLK_DIV_1 = CLOCK_HFCLKCTRL_HCLK_Div1,
  NRF_CLOCK_HFCLK_DIV_2 = CLOCK_HFCLKCTRL_HCLK_Div2,
  NRF_CLOCK_HFCLK_DIV_4 = CLOCK_HFCLK192MCTRL_HCLK192M_Div4
}
 High-frequency clock frequency configuration. More...
 
enum  nrf_clock_start_task_status_t {
  NRF_CLOCK_START_TASK_NOT_TRIGGERED = CLOCK_LFCLKRUN_STATUS_NotTriggered,
  NRF_CLOCK_START_TASK_TRIGGERED = CLOCK_LFCLKRUN_STATUS_Triggered
}
 Trigger status of task LFCLKSTART/HFCLKSTART. More...
 
enum  nrf_clock_int_mask_t {
  NRF_CLOCK_INT_HF_STARTED_MASK = CLOCK_INTENSET_HFCLKSTARTED_Msk,
  NRF_CLOCK_INT_LF_STARTED_MASK = CLOCK_INTENSET_LFCLKSTARTED_Msk,
  NRF_CLOCK_INT_DONE_MASK = CLOCK_INTENSET_DONE_Msk,
  NRF_CLOCK_INT_CTTO_MASK = CLOCK_INTENSET_CTTO_Msk,
  NRF_CLOCK_INT_CTSTARTED_MASK = CLOCK_INTENSET_CTSTARTED_Msk,
  NRF_CLOCK_INT_CTSTOPPED_MASK,
  NRF_CLOCK_INT_HF192M_STARTED_MASK = CLOCK_INTENSET_HFCLK192MSTARTED_Msk
}
 Interrupts. More...
 
enum  nrf_clock_task_t {
  NRF_CLOCK_TASK_HFCLKSTART = offsetof(NRF_CLOCK_Type, TASKS_HFCLKSTART),
  NRF_CLOCK_TASK_HFCLKSTOP = offsetof(NRF_CLOCK_Type, TASKS_HFCLKSTOP),
  NRF_CLOCK_TASK_LFCLKSTART = offsetof(NRF_CLOCK_Type, TASKS_LFCLKSTART),
  NRF_CLOCK_TASK_LFCLKSTOP = offsetof(NRF_CLOCK_Type, TASKS_LFCLKSTOP),
  NRF_CLOCK_TASK_CAL = offsetof(NRF_CLOCK_Type, TASKS_CAL),
  NRF_CLOCK_TASK_CTSTART = offsetof(NRF_CLOCK_Type, TASKS_CTSTART),
  NRF_CLOCK_TASK_CTSTOP,
  NRF_CLOCK_TASK_HFCLKAUDIOSTOP = offsetof(NRF_CLOCK_Type, TASKS_HFCLKAUDIOSTOP),
  NRF_CLOCK_TASK_HFCLK192MSTART = offsetof(NRF_CLOCK_Type, TASKS_HFCLK192MSTART),
  NRF_CLOCK_TASK_HFCLK192MSTOP = offsetof(NRF_CLOCK_Type, TASKS_HFCLK192MSTOP)
}
 Tasks. More...
 
enum  nrf_clock_event_t {
  NRF_CLOCK_EVENT_HFCLKSTARTED = offsetof(NRF_CLOCK_Type, EVENTS_HFCLKSTARTED),
  NRF_CLOCK_EVENT_LFCLKSTARTED = offsetof(NRF_CLOCK_Type, EVENTS_LFCLKSTARTED),
  NRF_CLOCK_EVENT_DONE = offsetof(NRF_CLOCK_Type, EVENTS_DONE),
  NRF_CLOCK_EVENT_CTTO = offsetof(NRF_CLOCK_Type, EVENTS_CTTO),
  NRF_CLOCK_EVENT_CTSTARTED = offsetof(NRF_CLOCK_Type, EVENTS_CTSTARTED),
  NRF_CLOCK_EVENT_CTSTOPPED,
  NRF_CLOCK_EVENT_HFCLK192MSTARTED = offsetof(NRF_CLOCK_Type, EVENTS_HFCLK192MSTARTED)
}
 Events. More...
 

Functions

NRF_STATIC_INLINE void nrf_clock_int_enable (NRF_CLOCK_Type *p_reg, uint32_t mask)
 Function for enabling the specified interrupt. More...
 
NRF_STATIC_INLINE void nrf_clock_int_disable (NRF_CLOCK_Type *p_reg, uint32_t mask)
 Function for disabling the specified interrupt. More...
 
NRF_STATIC_INLINE uint32_t nrf_clock_int_enable_check (NRF_CLOCK_Type const *p_reg, uint32_t mask)
 Function for checking if the specified interrupts are enabled. More...
 
NRF_STATIC_INLINE uint32_t nrf_clock_task_address_get (NRF_CLOCK_Type const *p_reg, nrf_clock_task_t task)
 Function for retrieving the address of the specified task. More...
 
NRF_STATIC_INLINE void nrf_clock_task_trigger (NRF_CLOCK_Type *p_reg, nrf_clock_task_t task)
 Function for setting the specified task. More...
 
NRF_STATIC_INLINE uint32_t nrf_clock_event_address_get (NRF_CLOCK_Type const *p_reg, nrf_clock_event_t event)
 Function for retrieving the address of the specified event. More...
 
NRF_STATIC_INLINE void nrf_clock_event_clear (NRF_CLOCK_Type *p_reg, nrf_clock_event_t event)
 Function for clearing the specified event. More...
 
NRF_STATIC_INLINE bool nrf_clock_event_check (NRF_CLOCK_Type const *p_reg, nrf_clock_event_t event)
 Function for retrieving the state of the specified event. More...
 
NRF_STATIC_INLINE bool nrf_clock_start_task_check (NRF_CLOCK_Type const *p_reg, nrf_clock_domain_t domain)
 Function for retrieving the trigger status of the task START for given domain. More...
 
NRF_STATIC_INLINE bool nrf_clock_is_running (NRF_CLOCK_Type const *p_reg, nrf_clock_domain_t domain, void *p_clk_src)
 Function for retrieving the state of the clock. More...
 
NRF_STATIC_INLINE void nrf_clock_lf_src_set (NRF_CLOCK_Type *p_reg, nrf_clock_lfclk_t source)
 Function for changing the low-frequency clock source. More...
 
NRF_STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_src_get (NRF_CLOCK_Type const *p_reg)
 Function for retrieving the selected source for the low-frequency clock. More...
 
NRF_STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_actv_src_get (NRF_CLOCK_Type const *p_reg)
 Function for retrieving the active source of the low-frequency clock. More...
 
NRF_STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_srccopy_get (NRF_CLOCK_Type const *p_reg)
 Function for retrieving the clock source for the LFCLK clock when the task LKCLKSTART is triggered. More...
 
NRF_STATIC_INLINE bool nrf_clock_lf_is_running (NRF_CLOCK_Type const *p_reg)
 Function for retrieving the state of the LFCLK clock. More...
 
NRF_STATIC_INLINE nrf_clock_start_task_status_t nrf_clock_lf_start_task_status_get (NRF_CLOCK_Type const *p_reg)
 Function for retrieving the trigger status of the task LFCLKSTART. More...
 
NRF_STATIC_INLINE void nrf_clock_hf_src_set (NRF_CLOCK_Type *p_reg, nrf_clock_hfclk_t source)
 Function for changing the high-frequency clock source. More...
 
NRF_STATIC_INLINE nrf_clock_hfclk_t nrf_clock_hf_src_get (NRF_CLOCK_Type const *p_reg)
 Function for retrieving the selected source of the high-frequency clock. More...
 
NRF_STATIC_INLINE bool nrf_clock_hf_is_running (NRF_CLOCK_Type const *p_reg, nrf_clock_hfclk_t clk_src)
 Function for retrieving the state of the HFCLK clock. More...
 
NRF_STATIC_INLINE nrf_clock_start_task_status_t nrf_clock_hf_start_task_status_get (NRF_CLOCK_Type const *p_reg)
 Function for retrieving the trigger status of the task HFCLKSTART. More...
 
NRF_STATIC_INLINE void nrf_clock_hfclkaudio_config_set (NRF_CLOCK_Type *p_reg, uint16_t freq_value)
 Function for changing the Audio clock FREQ_VALUE. More...
 
NRF_STATIC_INLINE uint16_t nrf_clock_hfclkaudio_config_get (NRF_CLOCK_Type const *p_reg)
 Function for retrieving the Audio clock FREQ_VALUE. More...
 
NRF_STATIC_INLINE void nrf_clock_cal_timer_timeout_set (NRF_CLOCK_Type *p_reg, uint32_t interval)
 Function for changing the calibration timer interval. More...
 
NRF_STATIC_INLINE void nrf_clock_hfclk192m_div_set (NRF_CLOCK_Type *p_reg, nrf_clock_hfclk_div_t divider)
 Function for changing the HFCLK192M frequency divider. More...
 
NRF_STATIC_INLINE nrf_clock_hfclk_div_t nrf_clock_hfclk192m_div_get (NRF_CLOCK_Type const *p_reg)
 Function for retrieving the HFCLK192M frequency divider. More...
 
NRF_STATIC_INLINE void nrf_clock_hfclk192m_src_set (NRF_CLOCK_Type *p_reg, nrf_clock_hfclk_t source)
 Function for changing the HFCLK192M source. More...
 
NRF_STATIC_INLINE nrf_clock_hfclk_t nrf_clock_hfclk192m_src_get (NRF_CLOCK_Type const *p_reg)
 Function for retrieving the selected source of the HFCLK192M. More...
 
NRF_STATIC_INLINE void nrf_clock_alwaysrun_set (NRF_CLOCK_Type *p_reg, nrf_clock_domain_t domain, bool alwaysrun)
 Function for setting the clock domain to always run. More...
 
NRF_STATIC_INLINE bool nrf_clock_alwaysrun_get (NRF_CLOCK_Type const *p_reg, nrf_clock_domain_t domain)
 Function for checking if the clock domain is configured to always run. More...
 
NRF_STATIC_INLINE bool nrf_clock_alwaysrun_active_get (NRF_CLOCK_Type const *p_reg, nrf_clock_domain_t domain)
 Function for checking if the clock domain always run setting is active. More...
 
NRF_STATIC_INLINE void nrf_clock_subscribe_set (NRF_CLOCK_Type *p_reg, nrf_clock_task_t task, uint8_t channel)
 Function for setting the subscribe configuration for a given CLOCK task. More...
 
NRF_STATIC_INLINE void nrf_clock_subscribe_clear (NRF_CLOCK_Type *p_reg, nrf_clock_task_t task)
 Function for clearing the subscribe configuration for a given CLOCK task. More...
 
NRF_STATIC_INLINE void nrf_clock_publish_set (NRF_CLOCK_Type *p_reg, nrf_clock_event_t event, uint8_t channel)
 Function for setting the publish configuration for a given CLOCK event. More...
 
NRF_STATIC_INLINE void nrf_clock_publish_clear (NRF_CLOCK_Type *p_reg, nrf_clock_event_t event)
 Function for clearing the publish configuration for a given CLOCK event. More...
 

Detailed Description

Hardware access layer for managing the CLOCK peripheral.

This code can be used to manage low-frequency clock (LFCLK), high-frequency clock (HFCLK), high-frequency 192 MHz clock (HFCLK192M) and high-frequency audio clock (HFCLKAUDIO) settings.

Enumeration Type Documentation

◆ nrf_clock_event_t

Events.

Enumerator
NRF_CLOCK_EVENT_HFCLKSTARTED 

HFCLK oscillator started.

NRF_CLOCK_EVENT_LFCLKSTARTED 

LFCLK oscillator started.

NRF_CLOCK_EVENT_DONE 

Calibration of LFCLK RC oscillator completed.

NRF_CLOCK_EVENT_CTTO 

Calibration timer time-out.

NRF_CLOCK_EVENT_CTSTARTED 

Calibration timer started.

NRF_CLOCK_EVENT_CTSTOPPED 

Calibration timer stopped. HFCLKAUDIO oscillator started.

NRF_CLOCK_EVENT_HFCLK192MSTARTED 

HFCLK192M oscillator started.

◆ nrf_clock_hfclk_div_t

High-frequency clock frequency configuration.

Used by HFCLKCTRL and HFCLK192MCTRL registers.

Enumerator
NRF_CLOCK_HFCLK_DIV_1 

Divide HFCLK/HFCLK192M by 1

NRF_CLOCK_HFCLK_DIV_2 

Divide HFCLK/HFCLK192M by 2

NRF_CLOCK_HFCLK_DIV_4 

Divide HFCLK192M by 4

◆ nrf_clock_hfclk_t

High-frequency clock sources.

Used by HFCLKSTAT and HFCLK192MSTAT registers.

Enumerator
NRF_CLOCK_HFCLK_LOW_ACCURACY 

Internal 16 MHz RC oscillator.

NRF_CLOCK_HFCLK_HIGH_ACCURACY 

External 16 MHz/32 MHz crystal oscillator.

◆ nrf_clock_int_mask_t

Interrupts.

Enumerator
NRF_CLOCK_INT_HF_STARTED_MASK 

Interrupt on HFCLKSTARTED event.

NRF_CLOCK_INT_LF_STARTED_MASK 

Interrupt on LFCLKSTARTED event.

NRF_CLOCK_INT_DONE_MASK 

Interrupt on DONE event.

NRF_CLOCK_INT_CTTO_MASK 

Interrupt on CTTO event.

NRF_CLOCK_INT_CTSTARTED_MASK 

Interrupt on CTSTARTED event.

NRF_CLOCK_INT_CTSTOPPED_MASK 

Interrupt on CTSTOPPED event. Interrupt on HFCLKAUDIOSTARTED event.

NRF_CLOCK_INT_HF192M_STARTED_MASK 

Interrupt on HFCLK192MSTARTED event.

◆ nrf_clock_lfclk_t

Low-frequency clock sources.

Used by LFCLKSRC, LFCLKSTAT, and LFCLKSRCCOPY registers.

Enumerator
NRF_CLOCK_LFCLK_LFULP 

Internal 32 kHz Ultra-low power oscillator.

NRF_CLOCK_LFCLK_RC 

Internal 32 kHz RC oscillator.

NRF_CLOCK_LFCLK_Xtal 

External 32 kHz crystal.

NRF_CLOCK_LFCLK_Synth 

Internal 32 kHz synthesized from HFCLK system clock.

NRF_CLOCK_LFCLK_Xtal_Low_Swing 

External 32 kHz low swing signal. Used only with the LFCLKSRC register. For the others NRF_CLOCK_LFCLK_Xtal is returned for this setting.

NRF_CLOCK_LFCLK_Xtal_Full_Swing 

External 32 kHz full swing signal. Used only with the LFCLKSRC register. For the others NRF_CLOCK_LFCLK_Xtal is returned for this setting.

◆ nrf_clock_start_task_status_t

Trigger status of task LFCLKSTART/HFCLKSTART.

Note
This enum is deprecated.

Used by LFCLKRUN and HFCLKRUN registers.

Enumerator
NRF_CLOCK_START_TASK_NOT_TRIGGERED 

Task LFCLKSTART/HFCLKSTART has not been triggered.

NRF_CLOCK_START_TASK_TRIGGERED 

Task LFCLKSTART/HFCLKSTART has been triggered.

◆ nrf_clock_task_t

Tasks.

The NRF_CLOCK_TASK_LFCLKSTOP task cannot be set when the low-frequency clock is not running. The NRF_CLOCK_TASK_HFCLKSTOP task cannot be set when the high-frequency clock is not running.

Enumerator
NRF_CLOCK_TASK_HFCLKSTART 

Start HFCLK clock source.

NRF_CLOCK_TASK_HFCLKSTOP 

Stop HFCLK clock source.

NRF_CLOCK_TASK_LFCLKSTART 

Start LFCLK clock source.

NRF_CLOCK_TASK_LFCLKSTOP 

Stop LFCLK clock source.

NRF_CLOCK_TASK_CAL 

Start calibration of LFCLK RC oscillator.

NRF_CLOCK_TASK_CTSTART 

Start calibration timer.

NRF_CLOCK_TASK_CTSTOP 

Stop calibration timer. Start HFCLKAUDIO clock source.

NRF_CLOCK_TASK_HFCLKAUDIOSTOP 

Stop HFCLKAUDIO clock source.

NRF_CLOCK_TASK_HFCLK192MSTART 

Start HFCLK192M clock source.

NRF_CLOCK_TASK_HFCLK192MSTOP 

Stop HFCLK192M clock source.

Function Documentation

◆ nrf_clock_alwaysrun_active_get()

NRF_STATIC_INLINE bool nrf_clock_alwaysrun_active_get ( NRF_CLOCK_Type const *  p_reg,
nrf_clock_domain_t  domain 
)

Function for checking if the clock domain always run setting is active.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]domainClock domain.
Return values
trueThe clock domain always run setting is active.
falseThe clock domain always run setting is not active.

◆ nrf_clock_alwaysrun_get()

NRF_STATIC_INLINE bool nrf_clock_alwaysrun_get ( NRF_CLOCK_Type const *  p_reg,
nrf_clock_domain_t  domain 
)

Function for checking if the clock domain is configured to always run.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]domainClock domain.
Return values
trueThe clock domain is configured to always run.
falseThe clock domain is not configured to always run.

◆ nrf_clock_alwaysrun_set()

NRF_STATIC_INLINE void nrf_clock_alwaysrun_set ( NRF_CLOCK_Type *  p_reg,
nrf_clock_domain_t  domain,
bool  alwaysrun 
)

Function for setting the clock domain to always run.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]domainClock domain.
[in]alwaysrunEnsure the clock is always running.

◆ nrf_clock_cal_timer_timeout_set()

NRF_STATIC_INLINE void nrf_clock_cal_timer_timeout_set ( NRF_CLOCK_Type *  p_reg,
uint32_t  interval 
)

Function for changing the calibration timer interval.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]intervalNew calibration timer interval in 0.25 s resolution (range: 0.25 seconds to 31.75 seconds).

◆ nrf_clock_event_address_get()

NRF_STATIC_INLINE uint32_t nrf_clock_event_address_get ( NRF_CLOCK_Type const *  p_reg,
nrf_clock_event_t  event 
)

Function for retrieving the address of the specified event.

This function can be used by the PPI module.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventCLOCK Event.
Returns
Address of the specified event register.

◆ nrf_clock_event_check()

NRF_STATIC_INLINE bool nrf_clock_event_check ( NRF_CLOCK_Type const *  p_reg,
nrf_clock_event_t  event 
)

Function for retrieving the state of the specified event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent to be checked.
Return values
trueThe event has been generated.
falseThe event has not been generated.

◆ nrf_clock_event_clear()

NRF_STATIC_INLINE void nrf_clock_event_clear ( NRF_CLOCK_Type *  p_reg,
nrf_clock_event_t  event 
)

Function for clearing the specified event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent to clear.

◆ nrf_clock_hf_is_running()

NRF_STATIC_INLINE bool nrf_clock_hf_is_running ( NRF_CLOCK_Type const *  p_reg,
nrf_clock_hfclk_t  clk_src 
)

Function for retrieving the state of the HFCLK clock.

Note
This function is deprecated. Use nrf_clock_is_running instead.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]clk_srcClock source to be checked.
Return values
falseThe HFCLK clock is not running.
trueThe HFCLK clock is running.

◆ nrf_clock_hf_src_get()

NRF_STATIC_INLINE nrf_clock_hfclk_t nrf_clock_hf_src_get ( NRF_CLOCK_Type const *  p_reg)

Function for retrieving the selected source of the high-frequency clock.

For SoCs not featuring the HFCLKSRC register, this is always also the active source of the high-frequency clock.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
NRF_CLOCK_HFCLK_LOW_ACCURACYThe internal RC oscillator is the selected source of the high-frequency clock.
NRF_CLOCK_HFCLK_HIGH_ACCURACYAn external crystal oscillator is the selected source of the high-frequency clock.

◆ nrf_clock_hf_src_set()

NRF_STATIC_INLINE void nrf_clock_hf_src_set ( NRF_CLOCK_Type *  p_reg,
nrf_clock_hfclk_t  source 
)

Function for changing the high-frequency clock source.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]sourceNew high-frequency clock source.

◆ nrf_clock_hf_start_task_status_get()

NRF_STATIC_INLINE nrf_clock_start_task_status_t nrf_clock_hf_start_task_status_get ( NRF_CLOCK_Type const *  p_reg)

Function for retrieving the trigger status of the task HFCLKSTART.

Note
This function is deprecated. Use nrf_clock_start_task_check instead.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
NRF_CLOCK_START_TASK_NOT_TRIGGEREDThe task HFCLKSTART has not been triggered.
NRF_CLOCK_START_TASK_TRIGGEREDThe task HFCLKSTART has been triggered.

◆ nrf_clock_hfclk192m_div_get()

NRF_STATIC_INLINE nrf_clock_hfclk_div_t nrf_clock_hfclk192m_div_get ( NRF_CLOCK_Type const *  p_reg)

Function for retrieving the HFCLK192M frequency divider.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
HFCLK192M frequency divider.

◆ nrf_clock_hfclk192m_div_set()

NRF_STATIC_INLINE void nrf_clock_hfclk192m_div_set ( NRF_CLOCK_Type *  p_reg,
nrf_clock_hfclk_div_t  divider 
)

Function for changing the HFCLK192M frequency divider.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]dividerNew HFCLK192M divider.

◆ nrf_clock_hfclk192m_src_get()

NRF_STATIC_INLINE nrf_clock_hfclk_t nrf_clock_hfclk192m_src_get ( NRF_CLOCK_Type const *  p_reg)

Function for retrieving the selected source of the HFCLK192M.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
NRF_CLOCK_HFCLK_LOW_ACCURACYThe internal RC oscillator is the selected source of the HFCLK192M.
NRF_CLOCK_HFCLK_HIGH_ACCURACYAn external crystal oscillator is the selected source of the HFCLK192M.

◆ nrf_clock_hfclk192m_src_set()

NRF_STATIC_INLINE void nrf_clock_hfclk192m_src_set ( NRF_CLOCK_Type *  p_reg,
nrf_clock_hfclk_t  source 
)

Function for changing the HFCLK192M source.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]sourceNew HFCLK192M source.

◆ nrf_clock_hfclkaudio_config_get()

NRF_STATIC_INLINE uint16_t nrf_clock_hfclkaudio_config_get ( NRF_CLOCK_Type const *  p_reg)

Function for retrieving the Audio clock FREQ_VALUE.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.

The frequency of HFCLKAUDIO ranges from 10.666 MHz to 13.333 MHz in 40.7 Hz steps. To calculate frequency corresponding to the returned FREQ_VALUE, use the following equation: f_out = 32M * (4 + FREQ_VALUE * 2^(-16))/12

Returns
FREQ_VALUE of the Audio clock.

◆ nrf_clock_hfclkaudio_config_set()

NRF_STATIC_INLINE void nrf_clock_hfclkaudio_config_set ( NRF_CLOCK_Type *  p_reg,
uint16_t  freq_value 
)

Function for changing the Audio clock FREQ_VALUE.

The frequency of HFCLKAUDIO ranges from 10.666 MHz to 13.333 MHz in 40.7 Hz steps. To calculate freq_value corresponding to the chosen frequency, use the following equation: FREQ_VALUE = 2^16 * ((12 * f_out / 32M) - 4)

Warning
Chosen frequency must fit in 11.176 MHz - 11.402 MHz or 12.165 MHz - 12.411 MHz frequency bands.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]freq_valueNew FREQ_VALUE

◆ nrf_clock_int_disable()

NRF_STATIC_INLINE void nrf_clock_int_disable ( NRF_CLOCK_Type *  p_reg,
uint32_t  mask 
)

Function for disabling the specified interrupt.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be disabled.

◆ nrf_clock_int_enable()

NRF_STATIC_INLINE void nrf_clock_int_enable ( NRF_CLOCK_Type *  p_reg,
uint32_t  mask 
)

Function for enabling the specified interrupt.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be enabled.

◆ nrf_clock_int_enable_check()

NRF_STATIC_INLINE uint32_t nrf_clock_int_enable_check ( NRF_CLOCK_Type const *  p_reg,
uint32_t  mask 
)

Function for checking if the specified interrupts are enabled.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be checked.
Returns
Mask of enabled interrupts.

◆ nrf_clock_is_running()

NRF_STATIC_INLINE bool nrf_clock_is_running ( NRF_CLOCK_Type const *  p_reg,
nrf_clock_domain_t  domain,
void *  p_clk_src 
)

Function for retrieving the state of the clock.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]domainClock domain.
[out]p_clk_srcPointer to clock source that is running. Set to NULL if not needed. Ignored for HFCLKAUDIO domain. Variable pointed by p_clk_src must be of either nrf_clock_lfclk_t type for LFCLK or nrf_clock_hfclk_t type for HFCLK and HFCLK192M.
Return values
falseThe clock is not running.
trueThe clock is running.

◆ nrf_clock_lf_actv_src_get()

NRF_STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_actv_src_get ( NRF_CLOCK_Type const *  p_reg)

Function for retrieving the active source of the low-frequency clock.

Note
This function is deprecated. Use nrf_clock_is_running instead.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
NRF_CLOCK_LFCLK_RCThe internal 32 kHz RC oscillator is the active source of the low-frequency clock.
NRF_CLOCK_LFCLK_XtalAn external 32 kHz crystal oscillator is the active source of the low-frequency clock.
NRF_CLOCK_LFCLK_SynthThe internal 32 kHz synthesized from the HFCLK is the active source of the low-frequency clock.

◆ nrf_clock_lf_is_running()

NRF_STATIC_INLINE bool nrf_clock_lf_is_running ( NRF_CLOCK_Type const *  p_reg)

Function for retrieving the state of the LFCLK clock.

Note
This function is deprecated. Use nrf_clock_is_running instead.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
falseThe LFCLK clock is not running.
trueThe LFCLK clock is running.

◆ nrf_clock_lf_src_get()

NRF_STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_src_get ( NRF_CLOCK_Type const *  p_reg)

Function for retrieving the selected source for the low-frequency clock.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
NRF_CLOCK_LFCLK_RCThe internal 32 kHz RC oscillator is the selected source for the low-frequency clock.
NRF_CLOCK_LFCLK_XtalAn external 32 kHz crystal oscillator is the selected source for the low-frequency clock.
NRF_CLOCK_LFCLK_SynthThe internal 32 kHz synthesized from the HFCLK is the selected source for the low-frequency clock.

◆ nrf_clock_lf_src_set()

NRF_STATIC_INLINE void nrf_clock_lf_src_set ( NRF_CLOCK_Type *  p_reg,
nrf_clock_lfclk_t  source 
)

Function for changing the low-frequency clock source.

Check in Product Specification if this function can be called when the low-frequency clock is running.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]sourceNew low-frequency clock source.

◆ nrf_clock_lf_srccopy_get()

NRF_STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_srccopy_get ( NRF_CLOCK_Type const *  p_reg)

Function for retrieving the clock source for the LFCLK clock when the task LKCLKSTART is triggered.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
NRF_CLOCK_LFCLK_RCThe internal 32 kHz RC oscillator is running and generating the LFCLK clock.
NRF_CLOCK_LFCLK_XtalAn external 32 kHz crystal oscillator is running and generating the LFCLK clock.
NRF_CLOCK_LFCLK_SynthThe internal 32 kHz synthesized from the HFCLK is running and generating the LFCLK clock.

◆ nrf_clock_lf_start_task_status_get()

NRF_STATIC_INLINE nrf_clock_start_task_status_t nrf_clock_lf_start_task_status_get ( NRF_CLOCK_Type const *  p_reg)

Function for retrieving the trigger status of the task LFCLKSTART.

Note
This function is deprecated. Use nrf_clock_start_task_check instead.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
NRF_CLOCK_START_TASK_NOT_TRIGGEREDThe task LFCLKSTART has not been triggered.
NRF_CLOCK_START_TASK_TRIGGEREDThe task LFCLKSTART has been triggered.

◆ nrf_clock_publish_clear()

NRF_STATIC_INLINE void nrf_clock_publish_clear ( NRF_CLOCK_Type *  p_reg,
nrf_clock_event_t  event 
)

Function for clearing the publish configuration for a given CLOCK event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent for which to clear the configuration.

◆ nrf_clock_publish_set()

NRF_STATIC_INLINE void nrf_clock_publish_set ( NRF_CLOCK_Type *  p_reg,
nrf_clock_event_t  event,
uint8_t  channel 
)

Function for setting the publish configuration for a given CLOCK event.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent for which to set the configuration.
[in]channelChannel through which to publish the event.

◆ nrf_clock_start_task_check()

NRF_STATIC_INLINE bool nrf_clock_start_task_check ( NRF_CLOCK_Type const *  p_reg,
nrf_clock_domain_t  domain 
)

Function for retrieving the trigger status of the task START for given domain.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]domainClock domain.
Return values
falseThe task START for the given domain has not been triggered.
trueThe task START for the given domain has been triggered.

◆ nrf_clock_subscribe_clear()

NRF_STATIC_INLINE void nrf_clock_subscribe_clear ( NRF_CLOCK_Type *  p_reg,
nrf_clock_task_t  task 
)

Function for clearing the subscribe configuration for a given CLOCK task.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask for which to clear the configuration.

◆ nrf_clock_subscribe_set()

NRF_STATIC_INLINE void nrf_clock_subscribe_set ( NRF_CLOCK_Type *  p_reg,
nrf_clock_task_t  task,
uint8_t  channel 
)

Function for setting the subscribe configuration for a given CLOCK task.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask for which to set the configuration.
[in]channelChannel through which to subscribe events.

◆ nrf_clock_task_address_get()

NRF_STATIC_INLINE uint32_t nrf_clock_task_address_get ( NRF_CLOCK_Type const *  p_reg,
nrf_clock_task_t  task 
)

Function for retrieving the address of the specified task.

This function can be used by the PPI module.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskCLOCK Task.
Returns
Address of the requested task register.

◆ nrf_clock_task_trigger()

NRF_STATIC_INLINE void nrf_clock_task_trigger ( NRF_CLOCK_Type *  p_reg,
nrf_clock_task_t  task 
)

Function for setting the specified task.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask to be activated.

Documentation feedback | Developer Zone | Subscribe | Updated