nrfx 4.5.0
Loading...
Searching...
No Matches
CLOCK driver

CLOCK peripheral driver. More...

Topics

 CLOCK peripheral driver configuration
 

Typedefs

typedef void(* nrfx_clock_event_handler_t) (nrfx_clock_evt_type_t event)
 Clock event handler.
 

Enumerations

enum  nrfx_clock_evt_type_t {
  NRFX_CLOCK_EVT_HFCLK_STARTED = NRFX_BITMASK_TO_BITPOS(NRF_CLOCK_INT_HF_STARTED_MASK) ,
  NRFX_CLOCK_EVT_PLL_STARTED = NRFX_CLOCK_XO_EVT_PLL_STARTED ,
  NRFX_CLOCK_EVT_LFCLK_STARTED = NRFX_CLOCK_LFCLK_EVT_LFCLK_STARTED ,
  NRFX_CLOCK_EVT_CTTO = NRFX_CLOCK_LFCLK_EVT_CTTO ,
  NRFX_CLOCK_EVT_CAL_DONE = NRFX_CLOCK_LFCLK_EVT_CAL_DONE ,
  NRFX_CLOCK_EVT_HFCLKAUDIO_STARTED = NRFX_BITMASK_TO_BITPOS(NRF_CLOCK_INT_HFAUDIO_STARTED_MASK) ,
  NRFX_CLOCK_EVT_HFCLK24M_STARTED = NRFX_BITMASK_TO_BITPOS(NRF_CLOCK_INT_HFCLK24M_STARTED_MASK) ,
  NRFX_CLOCK_EVT_HFCLK192M_STARTED = NRFX_BITMASK_TO_BITPOS(NRF_CLOCK_INT_HF192M_STARTED_MASK) ,
  NRFX_CLOCK_EVT_XO_TUNED = NRFX_CLOCK_XO_EVT_XO_TUNED ,
  NRFX_CLOCK_EVT_XO_TUNE_ERROR = NRFX_CLOCK_XO_EVT_XO_TUNE_ERROR ,
  NRFX_CLOCK_EVT_XO_TUNE_FAILED = NRFX_CLOCK_XO_EVT_XO_TUNE_FAILED
}
 Clock events. More...
 

Functions

int nrfx_clock_init (nrfx_clock_event_handler_t event_handler)
 Function for initializing internal structures in the nrfx_clock module.
 
void nrfx_clock_enable (void)
 Function for enabling interrupts in the clock module.
 
void nrfx_clock_disable (void)
 Function for disabling interrupts in the clock module.
 
void nrfx_clock_uninit (void)
 Function for uninitializing the clock module.
 
bool nrfx_clock_init_check (void)
 Function for checking if the clock driver is initialized.
 
void nrfx_clock_start (nrf_clock_domain_t domain)
 Function for starting the specified clock domain.
 
void nrfx_clock_stop (nrf_clock_domain_t domain)
 Function for stopping the specified clock domain.
 
NRFX_STATIC_INLINE bool nrfx_clock_is_running (nrf_clock_domain_t domain, void *p_clk_src)
 Function for checking the specified clock domain state.
 
int nrfx_clock_divider_set (nrf_clock_domain_t domain, nrf_clock_hfclk_div_t div)
 Function for setting the specified clock domain divider.
 
NRFX_STATIC_INLINE nrf_clock_hfclk_div_t nrfx_clock_divider_get (nrf_clock_domain_t domain)
 Function for getting the specified clock domain divider.
 
int nrfx_clock_calibration_start (void)
 Function for starting the calibration of internal LFCLK.
 
int nrfx_clock_is_calibrating (void)
 Function for checking if calibration is in progress.
 
void nrfx_clock_calibration_timer_start (uint8_t interval)
 Function for starting calibration timer.
 
void nrfx_clock_calibration_timer_stop (void)
 Function for stopping the calibration timer.
 
NRFX_STATIC_INLINE uint32_t nrfx_clock_task_address_get (nrf_clock_task_t task)
 Function for returning a requested task address for the clock driver module.
 
NRFX_STATIC_INLINE uint32_t nrfx_clock_event_address_get (nrf_clock_event_t event)
 Function for returning a requested event address for the clock driver module.
 

Detailed Description

CLOCK peripheral driver.

Typedef Documentation

◆ nrfx_clock_event_handler_t

typedef void(* nrfx_clock_event_handler_t) (nrfx_clock_evt_type_t event)

Clock event handler.

Parameters
[in]eventEvent.

Enumeration Type Documentation

◆ nrfx_clock_evt_type_t

Clock events.

Enumerator
NRFX_CLOCK_EVT_HFCLK_STARTED 

HFCLK has been started.

NRFX_CLOCK_EVT_PLL_STARTED 

PLL has been started.

NRFX_CLOCK_EVT_LFCLK_STARTED 

LFCLK has been started.

NRFX_CLOCK_EVT_CTTO 

Calibration timeout.

NRFX_CLOCK_EVT_CAL_DONE 

Calibration has been done.

NRFX_CLOCK_EVT_HFCLKAUDIO_STARTED 

HFCLKAUDIO has been started.

NRFX_CLOCK_EVT_HFCLK24M_STARTED 

HFCLK24M has been started.

NRFX_CLOCK_EVT_HFCLK192M_STARTED 

HFCLK192M has been started.

NRFX_CLOCK_EVT_XO_TUNED 

XO tune has been done.

NRFX_CLOCK_EVT_XO_TUNE_ERROR 

XO is not tuned.

NRFX_CLOCK_EVT_XO_TUNE_FAILED 

XO tune operation failed.

Function Documentation

◆ nrfx_clock_calibration_start()

int nrfx_clock_calibration_start ( void )

Function for starting the calibration of internal LFCLK.

This function starts the calibration process. The process cannot be aborted. LFCLK and HFCLK must be running before this function is called.

Return values
0The procedure is successful.
-EINPROGRESSThe low-frequency or high-frequency clock is off.
-EBUSYClock is in the calibration phase.

◆ nrfx_clock_calibration_timer_start()

void nrfx_clock_calibration_timer_start ( uint8_t interval)

Function for starting calibration timer.

Parameters
[in]intervalTime after which the CTTO event and interrupt will be generated (in 0.25 s units).

◆ nrfx_clock_divider_get()

NRFX_STATIC_INLINE nrf_clock_hfclk_div_t nrfx_clock_divider_get ( nrf_clock_domain_t domain)

Function for getting the specified clock domain divider.

Parameters
[in]domainClock domain.
Returns
Current divider for the specified clock domain.

◆ nrfx_clock_divider_set()

int nrfx_clock_divider_set ( nrf_clock_domain_t domain,
nrf_clock_hfclk_div_t div )

Function for setting the specified clock domain divider.

Parameters
[in]domainClock domain.
[in]divNew divider for the clock domain.
Return values
0Divider successfully set.
-ENOTSUPDomain does not support setting the divider.
-EINVALDivider not supported by the specified domain.

◆ nrfx_clock_event_address_get()

NRFX_STATIC_INLINE uint32_t nrfx_clock_event_address_get ( nrf_clock_event_t event)

Function for returning a requested event address for the clock driver module.

Parameters
[in]eventOne of the peripheral events.
Returns
Event address.

◆ nrfx_clock_init()

int nrfx_clock_init ( nrfx_clock_event_handler_t event_handler)

Function for initializing internal structures in the nrfx_clock module.

After initialization, the module is in power off state (clocks are not started).

Parameters
[in]event_handlerEvent handler provided by the user. If not provided, driver works in blocking mode.
Return values
0The procedure is successful.
-EALREADYThe driver is already initialized.

◆ nrfx_clock_init_check()

bool nrfx_clock_init_check ( void )

Function for checking if the clock driver is initialized.

Return values
trueDriver is already initialized.
falseDriver is not initialized.

◆ nrfx_clock_is_calibrating()

int nrfx_clock_is_calibrating ( void )

Function for checking if calibration is in progress.

This function indicates that the system is in calibration phase.

Return values
0The procedure is successful.
-EBUSYClock is in the calibration phase.

◆ nrfx_clock_is_running()

NRFX_STATIC_INLINE bool nrfx_clock_is_running ( nrf_clock_domain_t domain,
void * p_clk_src )

Function for checking the specified clock domain state.

XTAL source is assumed for domains with multiple sources.

Parameters
[in]domainClock domain.
[out]p_clk_srcPointer to a 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
trueThe clock domain is running.
falseThe clock domain is not running.

◆ nrfx_clock_start()

void nrfx_clock_start ( nrf_clock_domain_t domain)

Function for starting the specified clock domain.

Parameters
[in]domainClock domain.

◆ nrfx_clock_stop()

void nrfx_clock_stop ( nrf_clock_domain_t domain)

Function for stopping the specified clock domain.

Parameters
[in]domainClock domain.

◆ nrfx_clock_task_address_get()

NRFX_STATIC_INLINE uint32_t nrfx_clock_task_address_get ( nrf_clock_task_t task)

Function for returning a requested task address for the clock driver module.

Parameters
[in]taskOne of the peripheral tasks.
Returns
Task address.