nrfx 3.3
Macros | Enumerations | Functions
Clock HAL

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

Macros

#define NRF_CLOCK_HAS_CALIBRATION   1
 Symbol indicating whether the Low Frequency Clock calibration is present.
 
#define NRF_CLOCK_HAS_CALIBRATION_TIMER   1
 Symbol indicating whether the Low Frequency Clock calibration timer is present.
 
#define NRF_CLOCK_HAS_HFCLK192M   1
 Symbol indicating whether the 192 MHz clock is present.
 
#define NRF_CLOCK_HAS_HFCLKAUDIO   1
 Symbol indicating whether the Audio clock is present.
 
#define NRF_CLOCK_HAS_HFCLK_DIV   1
 Symbol indicating whether the HFCLK frequency configuration is present.
 
#define NRF_CLOCK_HAS_LFCLK_ALWAYSRUN   1
 Symbol indicating whether the ALWAYSRUN register is present for LFCLK.
 
#define NRF_CLOCK_HAS_HFCLK_ALWAYSRUN   1
 Symbol indicating whether the ALWAYSRUN register is present for HFCLK.
 
#define NRF_CLOCK_HAS_HFCLKSRC   1
 Symbol indicating whether the HFCLKSRC register is present.
 
#define NRF_CLOCK_HAS_PLL   1
 Symbol indicating whether the PLL section is present.
 
#define NRF_CLOCK_HAS_XO   1
 Symbol indicating whether XO registers are present.
 
#define NRF_CLOCK_HAS_LFCLK_TYPE   1
 Symbol indicating whether the CLOCK type contains LFCLK subtype.
 
#define NRF_CLOCK_LFCLKRUN_STATUS_NotTriggered   CLOCK_LFCLK_RUN_STATUS_NotTriggered
 
#define NRF_CLOCK_LFCLKRUN_STATUS_Triggered   CLOCK_LFCLK_RUN_STATUS_Triggered
 
#define NRF_CLOCK_INTENSET_LFCLKSTARTED_Msk   CLOCK_INTENSET_LFCLKSTARTED_Msk
 
#define NRF_LFCLKSRCCOPY   LFCLK.SRCCOPY
 
#define NRF_LFCLKRUN   LFCLK.RUN
 
#define NRF_LFCLKSTAT   LFCLK.STAT
 
#define NRF_LFCLKSRC   LFCLK.SRC
 
#define NRF_LFCLKALWAYSRUN   LFCLK.ALWAYSRUN
 
#define NRF_CLOCK_LFCLKSRCCOPY_SRC_Msk   CLOCK_LFCLK_SRCCOPY_SRC_Msk
 
#define NRF_CLOCK_LFCLKSRCCOPY_SRC_Pos   CLOCK_LFCLK_SRCCOPY_SRC_Pos
 
#define NRF_CLOCK_LFCLKRUN_STATUS_Msk   CLOCK_LFCLK_RUN_STATUS_Msk
 
#define NRF_CLOCK_LFCLKRUN_STATUS_Pos   CLOCK_LFCLK_RUN_STATUS_Pos
 
#define NRF_CLOCK_LFCLKSTAT_SRC_Msk   CLOCK_LFCLK_STAT_SRC_Msk
 
#define NRF_CLOCK_LFCLKSTAT_SRC_Pos   CLOCK_LFCLK_STAT_SRC_Pos
 
#define NRF_CLOCK_LFCLKSTAT_STATE_Msk   CLOCK_LFCLK_STAT_STATE_Msk
 
#define NRF_CLOCK_LFCLKSTAT_STATE_Pos   CLOCK_LFCLK_STAT_STATE_Pos
 
#define NRF_CLOCK_LFCLKSTAT_ALWAYSRUNNING_Msk   CLOCK_LFCLK_STAT_ALWAYSRUNNING_Msk
 
#define NRF_CLOCK_LFCLKSTAT_ALWAYSRUNNING_Pos   CLOCK_LFCLK_STAT_ALWAYSRUNNING_Pos
 
#define NRF_CLOCK_LFCLKALWAYSRUN_ALWAYSRUN_Msk   CLOCK_LFCLK_ALWAYSRUN_ALWAYSRUN_Msk
 
#define NRF_CLOCK_LFCLKALWAYSRUN_ALWAYSRUN_Pos   CLOCK_LFCLK_ALWAYSRUN_ALWAYSRUN_Pos
 
#define NRF_CLOCK_INTENSET_HFCLKSTARTED_Msk   CLOCK_INTEN_XOSTARTED_Msk
 
#define NRF_TASKS_HFCLKSTART   TASKS_XOSTART
 
#define NRF_TASKS_HFCLKSTOP   TASKS_XOSTOP
 
#define NRF_EVENTS_HFCLKSTARTED   EVENTS_XOSTARTED
 
#define NRF_HFCLKRUN   XO.RUN
 
#define NRF_HFCLKSTAT   XO.STAT
 
#define NRF_CLOCK_HFCLKRUN_STATUS_Msk   CLOCK_XO_RUN_STATUS_Msk
 
#define NRF_CLOCK_HFCLKRUN_STATUS_Pos   CLOCK_XO_RUN_STATUS_Pos
 
#define NRF_CLOCK_HFCLKSTAT_STATE_Msk   CLOCK_XO_STAT_STATE_Msk
 
#define NRF_CLOCK_HFCLKSTAT_STATE_Pos   CLOCK_XO_STAT_STATE_Pos
 

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_HIGH_ACCURACY = CLOCK_HFCLKSTAT_SRC_Xtal ,
  NRF_CLOCK_HFCLK_LOW_ACCURACY = CLOCK_HFCLKSTAT_SRC_RC
}
 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_LFCLK_RUN_STATUS_NotTriggered ,
  NRF_CLOCK_START_TASK_TRIGGERED = CLOCK_LFCLK_RUN_STATUS_Triggered
}
 Trigger status of task LFCLKSTART/HFCLKSTART. More...
 
enum  nrf_clock_int_mask_t {
  NRF_CLOCK_INT_HF_STARTED_MASK = CLOCK_INTEN_XOSTARTED_Msk ,
  NRF_CLOCK_INT_LF_STARTED_MASK = CLOCK_INTENSET_LFCLKSTARTED_Msk ,
  NRFX_CLOCK_INT_PLL_STARTED_MASK = CLOCK_INTENSET_PLLSTARTED_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_XOSTART) ,
  NRF_CLOCK_TASK_HFCLKSTOP = offsetof(NRF_CLOCK_Type, TASKS_XOSTOP) ,
  NRF_CLOCK_TASK_PLLSTART = offsetof(NRF_CLOCK_Type, TASKS_PLLSTART) ,
  NRF_CLOCK_TASK_PLLSTOP = offsetof(NRF_CLOCK_Type, TASKS_PLLSTOP) ,
  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_XOSTARTED) ,
  NRF_CLOCK_EVENT_PLLSTARTED = offsetof(NRF_CLOCK_Type, EVENTS_PLLSTARTED) ,
  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.
 
NRF_STATIC_INLINE void nrf_clock_int_disable (NRF_CLOCK_Type *p_reg, uint32_t mask)
 Function for disabling the specified interrupt.
 
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.
 
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.
 
NRF_STATIC_INLINE void nrf_clock_task_trigger (NRF_CLOCK_Type *p_reg, nrf_clock_task_t task)
 Function for setting the specified task.
 
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.
 
NRF_STATIC_INLINE void nrf_clock_event_clear (NRF_CLOCK_Type *p_reg, nrf_clock_event_t event)
 Function for clearing the specified event.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
NRF_STATIC_INLINE bool nrf_clock_lf_is_running (NRF_CLOCK_Type const *p_reg)
 Function for retrieving the state of the LFCLK clock.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
NRF_STATIC_INLINE uint16_t nrf_clock_hfclkaudio_config_get (NRF_CLOCK_Type const *p_reg)
 Function for retrieving the Audio clock FREQ_VALUE.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 

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.

Macro Definition Documentation

◆ NRF_CLOCK_HFCLKRUN_STATUS_Msk

#define NRF_CLOCK_HFCLKRUN_STATUS_Msk   CLOCK_XO_RUN_STATUS_Msk

HF clock RUN status mask definition.

◆ NRF_CLOCK_HFCLKRUN_STATUS_Pos

#define NRF_CLOCK_HFCLKRUN_STATUS_Pos   CLOCK_XO_RUN_STATUS_Pos

HF clock RUN status position definition.

◆ NRF_CLOCK_HFCLKSTAT_STATE_Msk

#define NRF_CLOCK_HFCLKSTAT_STATE_Msk   CLOCK_XO_STAT_STATE_Msk

HF clock STAT state mask definition.

◆ NRF_CLOCK_HFCLKSTAT_STATE_Pos

#define NRF_CLOCK_HFCLKSTAT_STATE_Pos   CLOCK_XO_STAT_STATE_Pos

HF clock STAT state position definition.

◆ NRF_CLOCK_INTENSET_HFCLKSTARTED_Msk

#define NRF_CLOCK_INTENSET_HFCLKSTARTED_Msk   CLOCK_INTEN_XOSTARTED_Msk

HF clock bit mask in interrupt register.

◆ NRF_CLOCK_INTENSET_LFCLKSTARTED_Msk

#define NRF_CLOCK_INTENSET_LFCLKSTARTED_Msk   CLOCK_INTENSET_LFCLKSTARTED_Msk

Interrupt on LFCLKSTARTED event mask definition.

◆ NRF_CLOCK_LFCLKALWAYSRUN_ALWAYSRUN_Msk

#define NRF_CLOCK_LFCLKALWAYSRUN_ALWAYSRUN_Msk   CLOCK_LFCLK_ALWAYSRUN_ALWAYSRUN_Msk

LF clock ALWAYSRUN position definition.

◆ NRF_CLOCK_LFCLKALWAYSRUN_ALWAYSRUN_Pos

#define NRF_CLOCK_LFCLKALWAYSRUN_ALWAYSRUN_Pos   CLOCK_LFCLK_ALWAYSRUN_ALWAYSRUN_Pos

LF clock ALWAYSRUN mask definition.

◆ NRF_CLOCK_LFCLKRUN_STATUS_Msk

#define NRF_CLOCK_LFCLKRUN_STATUS_Msk   CLOCK_LFCLK_RUN_STATUS_Msk

LF clock RUN status mask definition.

◆ NRF_CLOCK_LFCLKRUN_STATUS_NotTriggered

#define NRF_CLOCK_LFCLKRUN_STATUS_NotTriggered   CLOCK_LFCLK_RUN_STATUS_NotTriggered

Task LFCLKSTART/HFCLKSTART has not been triggered definiton.

◆ NRF_CLOCK_LFCLKRUN_STATUS_Pos

#define NRF_CLOCK_LFCLKRUN_STATUS_Pos   CLOCK_LFCLK_RUN_STATUS_Pos

LF clock RUN status position definition.

◆ NRF_CLOCK_LFCLKRUN_STATUS_Triggered

#define NRF_CLOCK_LFCLKRUN_STATUS_Triggered   CLOCK_LFCLK_RUN_STATUS_Triggered

Task LFCLKSTART/HFCLKSTART has been triggered.

◆ NRF_CLOCK_LFCLKSRCCOPY_SRC_Msk

#define NRF_CLOCK_LFCLKSRCCOPY_SRC_Msk   CLOCK_LFCLK_SRCCOPY_SRC_Msk

LF clock SRCCOPY status mask definition.

◆ NRF_CLOCK_LFCLKSRCCOPY_SRC_Pos

#define NRF_CLOCK_LFCLKSRCCOPY_SRC_Pos   CLOCK_LFCLK_SRCCOPY_SRC_Pos

LF clock SRCCOPY status position definition.

◆ NRF_CLOCK_LFCLKSTAT_ALWAYSRUNNING_Msk

#define NRF_CLOCK_LFCLKSTAT_ALWAYSRUNNING_Msk   CLOCK_LFCLK_STAT_ALWAYSRUNNING_Msk

LF clock STAT alwaysrunning position definition.

◆ NRF_CLOCK_LFCLKSTAT_ALWAYSRUNNING_Pos

#define NRF_CLOCK_LFCLKSTAT_ALWAYSRUNNING_Pos   CLOCK_LFCLK_STAT_ALWAYSRUNNING_Pos

LF clock STAT alwaysrunning mask definition.

◆ NRF_CLOCK_LFCLKSTAT_SRC_Msk

#define NRF_CLOCK_LFCLKSTAT_SRC_Msk   CLOCK_LFCLK_STAT_SRC_Msk

LF clock STAT source mask definition.

◆ NRF_CLOCK_LFCLKSTAT_SRC_Pos

#define NRF_CLOCK_LFCLKSTAT_SRC_Pos   CLOCK_LFCLK_STAT_SRC_Pos

LF clock STAT source position definition.

◆ NRF_CLOCK_LFCLKSTAT_STATE_Msk

#define NRF_CLOCK_LFCLKSTAT_STATE_Msk   CLOCK_LFCLK_STAT_STATE_Msk

LF clock STAT state mask definition.

◆ NRF_CLOCK_LFCLKSTAT_STATE_Pos

#define NRF_CLOCK_LFCLKSTAT_STATE_Pos   CLOCK_LFCLK_STAT_STATE_Pos

LF clock STAT state position definition.

◆ NRF_EVENTS_HFCLKSTARTED

#define NRF_EVENTS_HFCLKSTARTED   EVENTS_XOSTARTED

Event HF clock startrd definition.

◆ NRF_HFCLKRUN

#define NRF_HFCLKRUN   XO.RUN

HF clock RUN register definition.

◆ NRF_HFCLKSTAT

#define NRF_HFCLKSTAT   XO.STAT

HF clock STAT register definition.

◆ NRF_LFCLKALWAYSRUN

#define NRF_LFCLKALWAYSRUN   LFCLK.ALWAYSRUN

LF clock ALWAYSRUN register definition.

◆ NRF_LFCLKRUN

#define NRF_LFCLKRUN   LFCLK.RUN

LF clock RUN register definition.

◆ NRF_LFCLKSRC

#define NRF_LFCLKSRC   LFCLK.SRC

LF clock SRC register definition.

◆ NRF_LFCLKSRCCOPY

#define NRF_LFCLKSRCCOPY   LFCLK.SRCCOPY

LF clock SRCCOPY register definition.

◆ NRF_LFCLKSTAT

#define NRF_LFCLKSTAT   LFCLK.STAT

LF clock STAT register definition.

◆ NRF_TASKS_HFCLKSTART

#define NRF_TASKS_HFCLKSTART   TASKS_XOSTART

Task HF clock start definition.

◆ NRF_TASKS_HFCLKSTOP

#define NRF_TASKS_HFCLKSTOP   TASKS_XOSTOP

Task HF clock stop definition.

Enumeration Type Documentation

◆ nrf_clock_event_t

Events.

Enumerator
NRF_CLOCK_EVENT_HFCLKSTARTED 

HFCLK oscillator started.

NRF_CLOCK_EVENT_PLLSTARTED 

PLL 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_HIGH_ACCURACY 

External 16 MHz/32 MHz crystal oscillator.

NRF_CLOCK_HFCLK_LOW_ACCURACY 

Internal 16 MHz RC oscillator.

◆ nrf_clock_int_mask_t

Interrupts.

Enumerator
NRF_CLOCK_INT_HF_STARTED_MASK 

HF clock bit mask in interrupt register. Interrupt on HFCLKSTARTED event.

NRF_CLOCK_INT_LF_STARTED_MASK 

Interrupt on LFCLKSTARTED event mask definition. Interrupt on LFCLKSTARTED event.

NRFX_CLOCK_INT_PLL_STARTED_MASK 

Interrupt on PLLSTARTED 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 definiton. Task LFCLKSTART/HFCLKSTART has not been triggered.

NRF_CLOCK_START_TASK_TRIGGERED 

Task LFCLKSTART/HFCLKSTART has been 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_PLLSTART 

Start PLL and keep it running, regardless of the automatic clock requests.

NRF_CLOCK_TASK_PLLSTOP 

Stop PLL.

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.

< LF clock STAT register definition.

< LF clock STAT alwaysrunning position definition.

< LF clock STAT alwaysrunning mask definition.

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

< LF clock ALWAYSRUN register definition.

< LF clock ALWAYSRUN position definition.

< LF clock ALWAYSRUN mask definition.

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

< LF clock ALWAYSRUN register definition.

< LF clock ALWAYSRUN mask definition.

< LF clock ALWAYSRUN position definition.

◆ 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. Use nrf_clock_int_mask_t values for bit masking.

◆ 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. Use nrf_clock_int_mask_t values for bit masking.

◆ 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. Use nrf_clock_int_mask_t values for bit masking.
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.

< LF clock STAT register definition.

< LF clock STAT state mask definition.

< LF clock STAT register definition.

< LF clock STAT source mask definition.

< LF clock STAT source position definition.

< HF clock STAT register definition.

< HF clock STAT state mask definition.

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

< LF clock SRC register definition.

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

< LF clock SRC register definition.

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

< LF clock SRCCOPY register definition.

< LF clock SRCCOPY status mask definition.

< LF clock SRCCOPY status position definition.

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

< LF clock RUN register definition.

< LF clock RUN status mask definition.

< LF clock RUN status position definition.

< HF clock RUN register definition.

< HF clock RUN status mask definition.

< HF clock RUN status position definition.

◆ 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