nrfx 3.3
Data Structures | Enumerations | Functions
LFRC HAL

Hardware access layer for managing the Low Frequency 32 KHz RC Oscillator (LFRC). More...

Data Structures

struct  nrf_lfrc_config_t
 LFRC override configuration. More...
 

Enumerations

enum  nrf_lfrc_task_t {
  NRF_LFRC_TASK_CAL = offsetof(NRF_LFRC_Type, TASKS_CAL) ,
  NRF_LFRC_TASK_CANCELCAL = offsetof(NRF_LFRC_Type, TASKS_CANCELCAL)
}
 LFRC tasks. More...
 
enum  nrf_lfrc_event_t {
  NRF_LFRC_EVENT_CALDONE = offsetof(NRF_LFRC_Type, EVENTS_CALDONE) ,
  NRF_LFRC_EVENT_TRIMDONE = offsetof(NRF_LFRC_Type, EVENTS_TRIMDONE) ,
  NRF_LFRC_EVENT_TRIMERROR = offsetof(NRF_LFRC_Type, EVENTS_TRIMERROR)
}
 LFRC events. More...
 
enum  nrf_lfrc_int_mask_t {
  NRF_LFRC_INT_CALDONE_MASK = LFRC_INTENSET_CALDONE_Msk ,
  NRF_LFRC_INT_TRIMDONE_MASK = LFRC_INTENSET_TRIMDONE_Msk ,
  NRF_LFRC_INT_TRIMERROR_MASK = LFRC_INTENSET_TRIMERROR_Msk
}
 LFRC interrupts. More...
 
enum  nrf_lfrc_cal_cycle_length_t {
  NRF_LFRC_CAL_CYCLE_LENGTH_64 = LFRC_CAL_LENGTH_LENGTH_N64 ,
  NRF_LFRC_CAL_CYCLE_LENGTH_128 = LFRC_CAL_LENGTH_LENGTH_N128 ,
  NRF_LFRC_CAL_CYCLE_LENGTH_256 = LFRC_CAL_LENGTH_LENGTH_N256 ,
  NRF_LFRC_CAL_CYCLE_LENGTH_512 = LFRC_CAL_LENGTH_LENGTH_N512
}
 Number of measurement cycles used during calibration. More...
 
enum  nrf_lfrc_power_control_t {
  NRF_LFRC_POWER_CONTROL_AUTO = LFRC_PWRUPCTRL_CTRL_Auto ,
  NRF_LFRC_POWER_CONTROL_POWER_UP = LFRC_PWRUPCTRL_CTRL_PowerUp ,
  NRF_LFRC_POWER_CONTROL_POWER_DOWN = LFRC_PWRUPCTRL_CTRL_PowerDown
}
 Power up control. More...
 

Functions

NRF_STATIC_INLINE uint32_t nrf_lfrc_task_address_get (NRF_LFRC_Type const *p_reg, nrf_lfrc_task_t task)
 Function for retrieving the address of the specified task.
 
NRF_STATIC_INLINE void nrf_lfrc_task_trigger (NRF_LFRC_Type *p_reg, nrf_lfrc_task_t task)
 Function for setting the specified task.
 
NRF_STATIC_INLINE uint32_t nrf_lfrc_event_address_get (NRF_LFRC_Type const *p_reg, nrf_lfrc_event_t event)
 Function for retrieving the address of the specified event.
 
NRF_STATIC_INLINE void nrf_lfrc_event_clear (NRF_LFRC_Type *p_reg, nrf_lfrc_event_t event)
 Function for clearing the specified event.
 
NRF_STATIC_INLINE bool nrf_lfrc_event_check (NRF_LFRC_Type const *p_reg, nrf_lfrc_event_t event)
 Function for retrieving the state of the specified event.
 
NRF_STATIC_INLINE void nrf_lfrc_int_enable (NRF_LFRC_Type *p_reg, uint32_t mask)
 Function for enabling the specified interrupt.
 
NRF_STATIC_INLINE void nrf_lfrc_int_disable (NRF_LFRC_Type *p_reg, uint32_t mask)
 Function for disabling the specified interrupt.
 
NRF_STATIC_INLINE uint32_t nrf_lfrc_int_enable_check (NRF_LFRC_Type const *p_reg, uint32_t mask)
 Function for checking if the specified interrupts are enabled.
 
NRF_STATIC_INLINE uint32_t nrf_lfrc_int_pending_get (NRF_LFRC_Type const *p_reg)
 Function for retrieving the state of pending interrupts.
 
NRF_STATIC_INLINE int32_t nrf_lfrc_trim_status_get (NRF_LFRC_Type const *p_reg)
 Function for getting current trimming value of the LFRCOSC.
 
NRF_STATIC_INLINE bool nrf_lfrc_statusana_ready_check (NRF_LFRC_Type const *p_reg)
 Function for checking status of analog module READY signal.
 
NRF_STATIC_INLINE bool nrf_lfrc_statusana_settled_check (NRF_LFRC_Type const *p_reg)
 Function for checking status of analog module SETTLED signal.
 
NRF_STATIC_INLINE void nrf_lfrc_config_set (NRF_LFRC_Type *p_reg, nrf_lfrc_config_t const *p_config)
 Function for override the configuration.
 
NRF_STATIC_INLINE void nrf_lfrc_cal_cycle_length_set (NRF_LFRC_Type *p_reg, nrf_lfrc_cal_cycle_length_t length)
 Function for setting measurement cycle count length used while calibration.
 
NRF_STATIC_INLINE void nrf_lfrc_cal_trim_limit_low_set (NRF_LFRC_Type *p_reg, uint32_t trimlimit)
 Function for setting lower trim limit.
 
NRF_STATIC_INLINE void nrf_lfrc_cal_trim_limit_high_set (NRF_LFRC_Type *p_reg, uint32_t trimlimit)
 Function for setting higher trim limit.
 
NRF_STATIC_INLINE uint32_t nrf_lfrc_cal_result_get (NRF_LFRC_Type const *p_reg, uint8_t number)
 Function for reading calibration results.
 
NRF_STATIC_INLINE uint16_t nrf_lfrc_cal_num_of_cycles_get (NRF_LFRC_Type const *p_reg)
 Function for reading number of cycles when the CAL signal is high.
 
NRF_STATIC_INLINE void nrf_lfrc_power_control_set (NRF_LFRC_Type *p_reg, nrf_lfrc_power_control_t pwrctrl)
 Function for power control set.
 

Detailed Description

Hardware access layer for managing the Low Frequency 32 KHz RC Oscillator (LFRC).

Enumeration Type Documentation

◆ nrf_lfrc_cal_cycle_length_t

Number of measurement cycles used during calibration.

Enumerator
NRF_LFRC_CAL_CYCLE_LENGTH_64 

64 cycles

NRF_LFRC_CAL_CYCLE_LENGTH_128 

128 cycles

NRF_LFRC_CAL_CYCLE_LENGTH_256 

256 cycles

NRF_LFRC_CAL_CYCLE_LENGTH_512 

512 cycles

◆ nrf_lfrc_event_t

LFRC events.

Enumerator
NRF_LFRC_EVENT_CALDONE 

LFRC calibration done.

NRF_LFRC_EVENT_TRIMDONE 

LFRC trim done.

NRF_LFRC_EVENT_TRIMERROR 

LFRC trim error.

◆ nrf_lfrc_int_mask_t

LFRC interrupts.

Enumerator
NRF_LFRC_INT_CALDONE_MASK 

Interrupt on CALDONE event.

NRF_LFRC_INT_TRIMDONE_MASK 

Interrupt on TRIMDONE event.

NRF_LFRC_INT_TRIMERROR_MASK 

Interrupt on TRIMERROR event.

◆ nrf_lfrc_power_control_t

Power up control.

Enumerator
NRF_LFRC_POWER_CONTROL_AUTO 

Automatically handled by the peripheral

NRF_LFRC_POWER_CONTROL_POWER_UP 

Power up

NRF_LFRC_POWER_CONTROL_POWER_DOWN 

Power down

◆ nrf_lfrc_task_t

LFRC tasks.

The NRF_LFRC_TASK_CANCELCAL task cannot be set when the calibration is not running.

Enumerator
NRF_LFRC_TASK_CAL 

Start LFRC calibration.

NRF_LFRC_TASK_CANCELCAL 

Cancel LFRC calibration.

Function Documentation

◆ nrf_lfrc_cal_cycle_length_set()

NRF_STATIC_INLINE void nrf_lfrc_cal_cycle_length_set ( NRF_LFRC_Type *  p_reg,
nrf_lfrc_cal_cycle_length_t  length 
)

Function for setting measurement cycle count length used while calibration.

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

◆ nrf_lfrc_cal_num_of_cycles_get()

NRF_STATIC_INLINE uint16_t nrf_lfrc_cal_num_of_cycles_get ( NRF_LFRC_Type const *  p_reg)

Function for reading number of cycles when the CAL signal is high.

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

◆ nrf_lfrc_cal_result_get()

NRF_STATIC_INLINE uint32_t nrf_lfrc_cal_result_get ( NRF_LFRC_Type const *  p_reg,
uint8_t  number 
)

Function for reading calibration results.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]numberResult number.
Returns
Result in 16 MHz clock cycles.

◆ nrf_lfrc_cal_trim_limit_high_set()

NRF_STATIC_INLINE void nrf_lfrc_cal_trim_limit_high_set ( NRF_LFRC_Type *  p_reg,
uint32_t  trimlimit 
)

Function for setting higher trim limit.

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

◆ nrf_lfrc_cal_trim_limit_low_set()

NRF_STATIC_INLINE void nrf_lfrc_cal_trim_limit_low_set ( NRF_LFRC_Type *  p_reg,
uint32_t  trimlimit 
)

Function for setting lower trim limit.

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

◆ nrf_lfrc_config_set()

NRF_STATIC_INLINE void nrf_lfrc_config_set ( NRF_LFRC_Type *  p_reg,
nrf_lfrc_config_t const *  p_config 
)

Function for override the configuration.

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

◆ nrf_lfrc_event_address_get()

NRF_STATIC_INLINE uint32_t nrf_lfrc_event_address_get ( NRF_LFRC_Type const *  p_reg,
nrf_lfrc_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]eventLFRC Event.
Returns
Address of the specified event register.

◆ nrf_lfrc_event_check()

NRF_STATIC_INLINE bool nrf_lfrc_event_check ( NRF_LFRC_Type const *  p_reg,
nrf_lfrc_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_lfrc_event_clear()

NRF_STATIC_INLINE void nrf_lfrc_event_clear ( NRF_LFRC_Type *  p_reg,
nrf_lfrc_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_lfrc_int_disable()

NRF_STATIC_INLINE void nrf_lfrc_int_disable ( NRF_LFRC_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_lfrc_int_mask_t values for bit masking.

◆ nrf_lfrc_int_enable()

NRF_STATIC_INLINE void nrf_lfrc_int_enable ( NRF_LFRC_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_lfrc_int_mask_t values for bit masking.

◆ nrf_lfrc_int_enable_check()

NRF_STATIC_INLINE uint32_t nrf_lfrc_int_enable_check ( NRF_LFRC_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_lfrc_int_mask_t values for bit masking.
Returns
Mask of enabled interrupts.

◆ nrf_lfrc_int_pending_get()

NRF_STATIC_INLINE uint32_t nrf_lfrc_int_pending_get ( NRF_LFRC_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_lfrc_int_mask_t values for bit masking.

◆ nrf_lfrc_power_control_set()

NRF_STATIC_INLINE void nrf_lfrc_power_control_set ( NRF_LFRC_Type *  p_reg,
nrf_lfrc_power_control_t  pwrctrl 
)

Function for power control set.

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

◆ nrf_lfrc_statusana_ready_check()

NRF_STATIC_INLINE bool nrf_lfrc_statusana_ready_check ( NRF_LFRC_Type const *  p_reg)

Function for checking status of analog module READY signal.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
trueThe signal is logic 1.
falseThe signal is logic 0.

◆ nrf_lfrc_statusana_settled_check()

NRF_STATIC_INLINE bool nrf_lfrc_statusana_settled_check ( NRF_LFRC_Type const *  p_reg)

Function for checking status of analog module SETTLED signal.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
trueThe signal is logic 1.
falseThe signal is logic 0.

◆ nrf_lfrc_task_address_get()

NRF_STATIC_INLINE uint32_t nrf_lfrc_task_address_get ( NRF_LFRC_Type const *  p_reg,
nrf_lfrc_task_t  task 
)

Function for retrieving the address of the specified task.

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

◆ nrf_lfrc_task_trigger()

NRF_STATIC_INLINE void nrf_lfrc_task_trigger ( NRF_LFRC_Type *  p_reg,
nrf_lfrc_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.

◆ nrf_lfrc_trim_status_get()

NRF_STATIC_INLINE int32_t nrf_lfrc_trim_status_get ( NRF_LFRC_Type const *  p_reg)

Function for getting current trimming value of the LFRCOSC.

Note
Returned value is in 2's complement format, 1.4% steps.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Trim value register contents.

Documentation feedback | Developer Zone | Subscribe | Updated