nrfx 3.3
Data Structures | Macros | Enumerations | Functions
HFXO HAL

Hardware access layer for managing the High Frequency Crystal Oscillator (HFXO). More...

Data Structures

struct  nrf_hfxo_status_t
 HFXO status. More...
 

Macros

#define NRF_HFXO_IDAC_HAS_MAX_SETTLETIME_40US   1
 Symbol indicating whether IDAC maximum settling time is equal to 40us.
 

Enumerations

enum  nrf_hfxo_event_t {
  NRF_HFXO_EVENT_MODECHANGED = offsetof(NRF_HFXO_Type, EVENTS_MODECHANGED) ,
  NRF_HFXO_EVENT_ERRORPIERCE = offsetof(NRF_HFXO_Type, EVENTS_ERRORPIERCE) ,
  NRF_HFXO_EVENT_ERRORRUNNING = offsetof(NRF_HFXO_Type, EVENTS_ERRORRUNNING)
}
 HFXO events. More...
 
enum  nrf_hfxo_int_mask_t {
  NRF_HFXO_INT_MODECHANGED_MASK = HFXO_INTENSET_MODECHANGED_Msk ,
  NRF_HFXO_INT_ERRORPIERCE_MASK = HFXO_INTENSET_ERRORPIERCE_Msk ,
  NRF_HFXO_INT_ERRORRUNNING_MASK = HFXO_INTENSET_ERRORRUNNING_Msk
}
 HFXO interrupts. More...
 
enum  nrf_hfxo_status_mode_t {
  NRF_HFXO_STATUS_MODE_PIERCE = HFXO_STATUS_MODE_Pierce ,
  NRF_HFXO_STATUS_MODE_PIXO = HFXO_STATUS_MODE_Pixo ,
  NRF_HFXO_STATUS_MODE_EXT_SINE = HFXO_STATUS_MODE_ExternalSine ,
  NRF_HFXO_STATUS_MODE_EXT_SQUARE = HFXO_STATUS_MODE_ExternalSquare
}
 HFXO status modes. More...
 
enum  nrf_hfxo_mode_t {
  NRF_HFXO_MODE_AUTO = HFXO_MODE_MODE_Auto ,
  NRF_HFXO_MODE_PIERCE = HFXO_MODE_MODE_Pierce ,
  NRF_HFXO_MODE_PIXO = HFXO_MODE_MODE_Pixo ,
  NRF_HFXO_MODE_EXT_SINE = HFXO_MODE_MODE_ExternalSine ,
  NRF_HFXO_MODE_EXT_SQUARE = HFXO_MODE_MODE_ExternalSquare
}
 HFXO modes. More...
 
enum  nrf_hfxo_power_control_t {
  NRF_HFXO_POWER_CONTROL_AUTO = HFXO_PWRUPCTRL_CTRL_Auto ,
  NRF_HFXO_POWER_CONTROL_POWER_UP = HFXO_PWRUPCTRL_CTRL_PowerUp ,
  NRF_HFXO_POWER_CONTROL_POWER_DOWN = HFXO_PWRUPCTRL_CTRL_PowerDown
}
 Power up control modes. More...
 
enum  nrf_hfxo_idac_period_t {
  NRF_HFXO_IDAC_PERIOD_31US = HFXO_IDAC_CHECKPERIOD_VAL_val31us ,
  NRF_HFXO_IDAC_PERIOD_61US = HFXO_IDAC_CHECKPERIOD_VAL_val61us ,
  NRF_HFXO_IDAC_PERIOD_122US = HFXO_IDAC_CHECKPERIOD_VAL_val122us ,
  NRF_HFXO_IDAC_PERIOD_244US = HFXO_IDAC_CHECKPERIOD_VAL_val244us ,
  NRF_HFXO_IDAC_PERIOD_488US = HFXO_IDAC_CHECKPERIOD_VAL_val488us ,
  NRF_HFXO_IDAC_PERIOD_977US = HFXO_IDAC_CHECKPERIOD_VAL_val977us ,
  NRF_HFXO_IDAC_PERIOD_1953US = HFXO_IDAC_CHECKPERIOD_VAL_val1953us ,
  NRF_HFXO_IDAC_PERIOD_3906US = HFXO_IDAC_CHECKPERIOD_VAL_val3906us
}
 Period value for the IDAC check. More...
 
enum  nrf_hfxo_idac_settle_time_t {
  NRF_HFXO_IDAC_SETTLE_TIME_5US = HFXO_IDAC_SETTLETIME_VAL_val5us ,
  NRF_HFXO_IDAC_SETTLE_TIME_10US = HFXO_IDAC_SETTLETIME_VAL_val10us ,
  NRF_HFXO_IDAC_SETTLE_TIME_15US = HFXO_IDAC_SETTLETIME_VAL_val15us ,
  NRF_HFXO_IDAC_SETTLE_TIME_20US = HFXO_IDAC_SETTLETIME_VAL_val20us ,
  NRF_HFXO_IDAC_SETTLE_TIME_25US = HFXO_IDAC_SETTLETIME_VAL_val25us ,
  NRF_HFXO_IDAC_SETTLE_TIME_30US = HFXO_IDAC_SETTLETIME_VAL_val30us ,
  NRF_HFXO_IDAC_SETTLE_TIME_35US = HFXO_IDAC_SETTLETIME_VAL_val35us ,
  NRF_HFXO_IDAC_SETTLE_TIME_40US = HFXO_IDAC_SETTLETIME_VAL_val40us
}
 Period value for the IDAC check. More...
 

Functions

NRF_STATIC_INLINE uint32_t nrf_hfxo_event_address_get (NRF_HFXO_Type const *p_reg, nrf_hfxo_event_t event)
 Function for retrieving the address of the specified event.
 
NRF_STATIC_INLINE void nrf_hfxo_event_clear (NRF_HFXO_Type *p_reg, nrf_hfxo_event_t event)
 Function for clearing the specified event.
 
NRF_STATIC_INLINE bool nrf_hfxo_event_check (NRF_HFXO_Type const *p_reg, nrf_hfxo_event_t event)
 Function for retrieving the state of the specified event.
 
NRF_STATIC_INLINE void nrf_hfxo_int_enable (NRF_HFXO_Type *p_reg, uint32_t mask)
 Function for enabling the specified interrupt.
 
NRF_STATIC_INLINE void nrf_hfxo_int_disable (NRF_HFXO_Type *p_reg, uint32_t mask)
 Function for disabling the specified interrupt.
 
NRF_STATIC_INLINE uint32_t nrf_hfxo_int_enable_check (NRF_HFXO_Type const *p_reg, uint32_t mask)
 Function for checking if the specified interrupts are enabled.
 
NRF_STATIC_INLINE uint32_t nrf_hfxo_int_pending_get (NRF_HFXO_Type const *p_reg)
 Function for retrieving the state of pending interrupts.
 
NRF_STATIC_INLINE void nrf_hfxo_status_get (NRF_HFXO_Type const *p_reg, nrf_hfxo_status_t *p_status)
 Function for getting HFXO status.
 
NRF_STATIC_INLINE uint8_t nrf_hfxo_cload_get (NRF_HFXO_Type const *p_reg)
 Function for getting internal capacitive load value.
 
NRF_STATIC_INLINE void nrf_hfxo_cload_set (NRF_HFXO_Type *p_reg, uint8_t cap)
 Function for setting internal capacitive load value.
 
NRF_STATIC_INLINE uint8_t nrf_hfxo_amplitude_control_get (NRF_HFXO_Type const *p_reg)
 Function for getting amplitude control configuration.
 
NRF_STATIC_INLINE void nrf_hfxo_amplitude_control_set (NRF_HFXO_Type *p_reg, uint8_t amplitude)
 Function for setting amplitude control configuration.
 
NRF_STATIC_INLINE void nrf_hfxo_power_control_set (NRF_HFXO_Type *p_reg, nrf_hfxo_power_control_t pwrctrl, bool bypass_0V8, bool bypass_1V5)
 Function for setting the power control configuration.
 
NRF_STATIC_INLINE void nrf_hfxo_mode_set (NRF_HFXO_Type *p_reg, nrf_hfxo_mode_t oscmode)
 Function for setting HFXO mode.
 
NRF_STATIC_INLINE uint8_t nrf_hfxo_peak_det_thr_get (NRF_HFXO_Type const *p_reg)
 Function for getting the peak detector threshold value.
 
NRF_STATIC_INLINE void nrf_hfxo_peak_det_thr_set (NRF_HFXO_Type *p_reg, uint8_t thr)
 Function for setting the peak detector threshold value.
 
NRF_STATIC_INLINE uint16_t nrf_hfxo_startup_pulses_get (NRF_HFXO_Type const *p_reg)
 Function for getting the number of injected pulses during HFXO startup.
 
NRF_STATIC_INLINE void nrf_hfxo_startup_pulses_set (NRF_HFXO_Type *p_reg, uint16_t pulses)
 Function for setting the number of injected pulses during HFXO startup.
 
NRF_STATIC_INLINE void nrf_hfxo_idac_init_value_set (NRF_HFXO_Type *p_reg, uint8_t init_val)
 Function for setting the initial IDAC code for the Pierce oscillator.
 
NRF_STATIC_INLINE void nrf_hfxo_idac_ratio_set (NRF_HFXO_Type *p_reg, uint8_t ratio)
 Function for setting the ratio between IDAC and AREG in the Pierce AREG mode.
 
NRF_STATIC_INLINE void nrf_hfxo_idac_check_set (NRF_HFXO_Type *p_reg, nrf_hfxo_idac_period_t period, bool enable)
 Function for setting the period for the IDAC check in Pierce mode.
 
NRF_STATIC_INLINE void nrf_hfxo_idac_settling_time_set (NRF_HFXO_Type *p_reg, nrf_hfxo_idac_settle_time_t time)
 Function for setting the settling time for IDAC current changes.
 

Detailed Description

Hardware access layer for managing the High Frequency Crystal Oscillator (HFXO).

Enumeration Type Documentation

◆ nrf_hfxo_event_t

HFXO events.

Enumerator
NRF_HFXO_EVENT_MODECHANGED 

HFXO mode changed.

NRF_HFXO_EVENT_ERRORPIERCE 

Error while starting the HFXO in PIERCE mode.

NRF_HFXO_EVENT_ERRORRUNNING 

Error detected while HFXO was running.

◆ nrf_hfxo_idac_period_t

Period value for the IDAC check.

Enumerator
NRF_HFXO_IDAC_PERIOD_31US 

IDAC period is 31us.

NRF_HFXO_IDAC_PERIOD_61US 

IDAC period is 61us.

NRF_HFXO_IDAC_PERIOD_122US 

IDAC period is 122us.

NRF_HFXO_IDAC_PERIOD_244US 

IDAC period is 244us.

NRF_HFXO_IDAC_PERIOD_488US 

IDAC period is 488us.

NRF_HFXO_IDAC_PERIOD_977US 

IDAC period is 977us.

NRF_HFXO_IDAC_PERIOD_1953US 

IDAC period is 1953us.

NRF_HFXO_IDAC_PERIOD_3906US 

IDAC period is 3906us.

◆ nrf_hfxo_idac_settle_time_t

Period value for the IDAC check.

Enumerator
NRF_HFXO_IDAC_SETTLE_TIME_5US 

Settling time is 5us.

NRF_HFXO_IDAC_SETTLE_TIME_10US 

Settling time is 10us.

NRF_HFXO_IDAC_SETTLE_TIME_15US 

Settling time is 15us.

NRF_HFXO_IDAC_SETTLE_TIME_20US 

Settling time is 20us.

NRF_HFXO_IDAC_SETTLE_TIME_25US 

Settling time is 25us.

NRF_HFXO_IDAC_SETTLE_TIME_30US 

Settling time is 30us.

NRF_HFXO_IDAC_SETTLE_TIME_35US 

Settling time is 35us.

NRF_HFXO_IDAC_SETTLE_TIME_40US 

Settling time is 40us.

◆ nrf_hfxo_int_mask_t

HFXO interrupts.

Enumerator
NRF_HFXO_INT_MODECHANGED_MASK 

Interrupt on MODECHANGED event.

NRF_HFXO_INT_ERRORPIERCE_MASK 

Interrupt on ERRORPIERCE event.

NRF_HFXO_INT_ERRORRUNNING_MASK 

Interrupt on ERRORRUNNING event.

◆ nrf_hfxo_mode_t

HFXO modes.

Enumerator
NRF_HFXO_MODE_AUTO 

Mode automatically handled by the peripheral.

NRF_HFXO_MODE_PIERCE 

Pierce mode.

NRF_HFXO_MODE_PIXO 

PIXO mode.

NRF_HFXO_MODE_EXT_SINE 

External sine wave clock.

NRF_HFXO_MODE_EXT_SQUARE 

External square wave clock.

◆ nrf_hfxo_power_control_t

Power up control modes.

Enumerator
NRF_HFXO_POWER_CONTROL_AUTO 

Automatically handled by the peripheral.

NRF_HFXO_POWER_CONTROL_POWER_UP 

Power up.

NRF_HFXO_POWER_CONTROL_POWER_DOWN 

Power down.

◆ nrf_hfxo_status_mode_t

HFXO status modes.

Enumerator
NRF_HFXO_STATUS_MODE_PIERCE 

Pierce mode.

NRF_HFXO_STATUS_MODE_PIXO 

PIXO mode.

NRF_HFXO_STATUS_MODE_EXT_SINE 

External sine wave clock.

NRF_HFXO_STATUS_MODE_EXT_SQUARE 

External square wave clock.

Function Documentation

◆ nrf_hfxo_amplitude_control_get()

NRF_STATIC_INLINE uint8_t nrf_hfxo_amplitude_control_get ( NRF_HFXO_Type const *  p_reg)

Function for getting amplitude control configuration.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Voltage amplitude setting for Pierce AREG mode (range 0 to 7, where 0 is 244 mV, up to 7 which is 470 mV).

◆ nrf_hfxo_amplitude_control_set()

NRF_STATIC_INLINE void nrf_hfxo_amplitude_control_set ( NRF_HFXO_Type *  p_reg,
uint8_t  amplitude 
)

Function for setting amplitude control configuration.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]amplitudeVoltage amplitude setting for Pierce AREG mode (range 0 to 7, where 0 is 244 mV, up to 7 which is 470 mV).

◆ nrf_hfxo_cload_get()

NRF_STATIC_INLINE uint8_t nrf_hfxo_cload_get ( NRF_HFXO_Type const *  p_reg)

Function for getting internal capacitive load value.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Total capacitance in pF.

◆ nrf_hfxo_cload_set()

NRF_STATIC_INLINE void nrf_hfxo_cload_set ( NRF_HFXO_Type *  p_reg,
uint8_t  cap 
)

Function for setting internal capacitive load value.

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

◆ nrf_hfxo_event_address_get()

NRF_STATIC_INLINE uint32_t nrf_hfxo_event_address_get ( NRF_HFXO_Type const *  p_reg,
nrf_hfxo_event_t  event 
)

Function for retrieving the address of the specified event.

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

◆ nrf_hfxo_event_check()

NRF_STATIC_INLINE bool nrf_hfxo_event_check ( NRF_HFXO_Type const *  p_reg,
nrf_hfxo_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_hfxo_event_clear()

NRF_STATIC_INLINE void nrf_hfxo_event_clear ( NRF_HFXO_Type *  p_reg,
nrf_hfxo_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_hfxo_idac_check_set()

NRF_STATIC_INLINE void nrf_hfxo_idac_check_set ( NRF_HFXO_Type *  p_reg,
nrf_hfxo_idac_period_t  period,
bool  enable 
)

Function for setting the period for the IDAC check in Pierce mode.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]periodPeriod value for the IDAC check.
[in]enableEnable IDAC check.

◆ nrf_hfxo_idac_init_value_set()

NRF_STATIC_INLINE void nrf_hfxo_idac_init_value_set ( NRF_HFXO_Type *  p_reg,
uint8_t  init_val 
)

Function for setting the initial IDAC code for the Pierce oscillator.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]init_valInitial IDAC code for the Pierce oscillator.

◆ nrf_hfxo_idac_ratio_set()

NRF_STATIC_INLINE void nrf_hfxo_idac_ratio_set ( NRF_HFXO_Type *  p_reg,
uint8_t  ratio 
)

Function for setting the ratio between IDAC and AREG in the Pierce AREG mode.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]ratioRatio between IDAC and AREG.

◆ nrf_hfxo_idac_settling_time_set()

NRF_STATIC_INLINE void nrf_hfxo_idac_settling_time_set ( NRF_HFXO_Type *  p_reg,
nrf_hfxo_idac_settle_time_t  time 
)

Function for setting the settling time for IDAC current changes.

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

◆ nrf_hfxo_int_disable()

NRF_STATIC_INLINE void nrf_hfxo_int_disable ( NRF_HFXO_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_hfxo_int_mask_t values for bit masking.

◆ nrf_hfxo_int_enable()

NRF_STATIC_INLINE void nrf_hfxo_int_enable ( NRF_HFXO_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_hfxo_int_mask_t values for bit masking.

◆ nrf_hfxo_int_enable_check()

NRF_STATIC_INLINE uint32_t nrf_hfxo_int_enable_check ( NRF_HFXO_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_hfxo_int_mask_t values for bit masking.
Returns
Mask of enabled interrupts.

◆ nrf_hfxo_int_pending_get()

NRF_STATIC_INLINE uint32_t nrf_hfxo_int_pending_get ( NRF_HFXO_Type const *  p_reg)

Function for retrieving the state of pending interrupts.

States of pending interrupt are saved as a bitmask. One set at particular position means that interrupt for event is pending.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Bitmask with information about pending interrupts. Use nrf_hfxo_int_mask_t values for bit masking.

◆ nrf_hfxo_mode_set()

NRF_STATIC_INLINE void nrf_hfxo_mode_set ( NRF_HFXO_Type *  p_reg,
nrf_hfxo_mode_t  oscmode 
)

Function for setting HFXO mode.

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

◆ nrf_hfxo_peak_det_thr_get()

NRF_STATIC_INLINE uint8_t nrf_hfxo_peak_det_thr_get ( NRF_HFXO_Type const *  p_reg)

Function for getting the peak detector threshold value.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Peak detector threshold value.

◆ nrf_hfxo_peak_det_thr_set()

NRF_STATIC_INLINE void nrf_hfxo_peak_det_thr_set ( NRF_HFXO_Type *  p_reg,
uint8_t  thr 
)

Function for setting the peak detector threshold value.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]thrPeak detector threshold value.

◆ nrf_hfxo_power_control_set()

NRF_STATIC_INLINE void nrf_hfxo_power_control_set ( NRF_HFXO_Type *  p_reg,
nrf_hfxo_power_control_t  pwrctrl,
bool  bypass_0V8,
bool  bypass_1V5 
)

Function for setting the power control configuration.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]pwrctrlPower up control mode.
[in]bypass_0V8Enable bypass 0.8 V voltage regulator.
[in]bypass_1V5Enable bypass 1.5 V voltage regulator.

◆ nrf_hfxo_startup_pulses_get()

NRF_STATIC_INLINE uint16_t nrf_hfxo_startup_pulses_get ( NRF_HFXO_Type const *  p_reg)

Function for getting the number of injected pulses during HFXO startup.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Number of injected 16 MHz pulses.

◆ nrf_hfxo_startup_pulses_set()

NRF_STATIC_INLINE void nrf_hfxo_startup_pulses_set ( NRF_HFXO_Type *  p_reg,
uint16_t  pulses 
)

Function for setting the number of injected pulses during HFXO startup.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]pulsesNumber of 16MHz clock pulses injected in Pierce mode during HFXO startup.

◆ nrf_hfxo_status_get()

NRF_STATIC_INLINE void nrf_hfxo_status_get ( NRF_HFXO_Type const *  p_reg,
nrf_hfxo_status_t p_status 
)

Function for getting HFXO status.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[out]p_statusPointer to the structure to be filled with HFXO status.

Documentation feedback | Developer Zone | Subscribe | Updated