nRF51 SDK - S110 SoftDevice
|
Hardware abstraction layer for managing the low-frequency clock (LFCLK) and the high-frequency clock (HFCLK). More...
Macros | |
#define | NRF_CLOCK_TASK_SET (1UL) |
#define | NRF_CLOCK_EVENT_CLEAR (0UL) |
Enumerations | |
enum | nrf_clock_lf_src_t { NRF_CLOCK_LF_SRC_RC = CLOCK_LFCLKSRC_SRC_RC, NRF_CLOCK_LF_SRC_Xtal = CLOCK_LFCLKSRC_SRC_Xtal, NRF_CLOCK_LF_SRC_Synth = CLOCK_LFCLKSRC_SRC_Synth } |
Low-frequency clock sources. More... | |
enum | nrf_clock_hf_src_t { NRF_CLOCK_HF_SRC_RC = CLOCK_HFCLKSTAT_SRC_RC, NRF_CLOCK_HF_SRC_Xtal = CLOCK_HFCLKSTAT_SRC_Xtal } |
High-frequency clock sources. 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_xtalfreq_t { NRF_CLOCK_XTALFREQ_16MHz = CLOCK_XTALFREQ_XTALFREQ_16MHz, NRF_CLOCK_XTALFREQ_32MHz = CLOCK_XTALFREQ_XTALFREQ_32MHz } |
Crystal frequency selection. 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 } |
Interrupts. More... | |
enum | nrf_clock_tasks_t { NRF_CLOCK_TASKS_HFCLKSTART = offsetof(NRF_CLOCK_Type, TASKS_HFCLKSTART), NRF_CLOCK_TASKS_HFCLKSTOP = offsetof(NRF_CLOCK_Type, TASKS_HFCLKSTOP), NRF_CLOCK_TASKS_LFCLKSTART = offsetof(NRF_CLOCK_Type, TASKS_LFCLKSTART), NRF_CLOCK_TASKS_LFCLKSTOP = offsetof(NRF_CLOCK_Type, TASKS_LFCLKSTOP), NRF_CLOCK_TASKS_CAL = offsetof(NRF_CLOCK_Type, TASKS_CAL), NRF_CLOCK_TASKS_CTSTART = offsetof(NRF_CLOCK_Type, TASKS_CTSTART), NRF_CLOCK_TASKS_CTSTOP = offsetof(NRF_CLOCK_Type, TASKS_CTSTOP) } |
Tasks. More... | |
enum | nrf_clock_events_t { NRF_CLOCK_EVENTS_HFCLKSTARTED = offsetof(NRF_CLOCK_Type, EVENTS_HFCLKSTARTED), NRF_CLOCK_EVENTS_LFCLKSTARTED = offsetof(NRF_CLOCK_Type, EVENTS_LFCLKSTARTED), NRF_CLOCK_EVENTS_DONE = offsetof(NRF_CLOCK_Type, EVENTS_DONE), NRF_CLOCK_EVENTS_CTTO = offsetof(NRF_CLOCK_Type, EVENTS_CTTO) } |
Events. More... | |
Functions | |
__STATIC_INLINE void | nrf_clock_int_enable (uint32_t int_mask) |
Function for enabling a specific interrupt. More... | |
__STATIC_INLINE void | nrf_clock_int_disable (uint32_t int_mask) |
Function for disabling a specific interrupt. More... | |
__STATIC_INLINE bool | nrf_clock_int_enable_check (nrf_clock_int_mask_t int_mask) |
Function for retrieving the state of a specific interrupt. More... | |
__STATIC_INLINE uint32_t | nrf_clock_task_address_get (nrf_clock_tasks_t task) |
Function for retrieving the address of a specific task. More... | |
__STATIC_INLINE void | nrf_clock_task_set (nrf_clock_tasks_t task) |
Function for setting a specific task. More... | |
__STATIC_INLINE uint32_t | nrf_clock_event_address_get (nrf_clock_events_t event) |
Function for retrieving the address of a specific event. More... | |
__STATIC_INLINE void | nrf_clock_event_clear (nrf_clock_events_t event) |
Function for clearing a specific event. More... | |
__STATIC_INLINE bool | nrf_clock_event_check (nrf_clock_events_t event) |
Function for retrieving the state of a specific event. More... | |
__STATIC_INLINE void | nrf_clock_lf_src_set (nrf_clock_lf_src_t source) |
Function for changing the low-frequency clock source. More... | |
__STATIC_INLINE nrf_clock_lf_src_t | nrf_clock_lf_src_get (void) |
Function for retrieving the selected source for the low-frequency clock. More... | |
__STATIC_INLINE nrf_clock_lf_src_t | nrf_clock_lf_actv_src_get (void) |
Function for retrieving the active source of the low-frequency clock. More... | |
__STATIC_INLINE nrf_clock_lf_src_t | nrf_clock_lf_srccopy_get (void) |
Function for retrieving the clock source for the LFCLK clock when the task LKCLKSTART is triggered. More... | |
__STATIC_INLINE bool | nrf_clock_lf_is_running (void) |
Function for retrieving the state of the LFCLK clock. More... | |
__STATIC_INLINE nrf_clock_start_task_status_t | nrf_clock_lf_start_task_status_get (void) |
Function for retrieving the trigger status of the task LFCLKSTART. More... | |
__STATIC_INLINE nrf_clock_hf_src_t | nrf_clock_hf_src_get (void) |
Function for retrieving the active source of the high-frequency clock. More... | |
__STATIC_INLINE bool | nrf_clock_hf_is_running (void) |
Function for retrieving the state of the HFCLK clock. More... | |
__STATIC_INLINE nrf_clock_start_task_status_t | nrf_clock_hf_start_task_status_get (void) |
Function for retrieving the trigger status of the task HFCLKSTART. More... | |
__STATIC_INLINE nrf_clock_xtalfreq_t | nrf_clock_xtalfreq_get (void) |
Function for retrieving the frequency selection of the external crystal. More... | |
__STATIC_INLINE void | nrf_clock_xtalfreq_set (nrf_clock_xtalfreq_t xtalfreq) |
Function for changing the frequency selection of the external crystal. More... | |
__STATIC_INLINE void | nrf_clock_cal_timer_timeout_set (uint32_t interval) |
Function for changing the calibration timer interval. More... | |
Hardware abstraction layer for managing the low-frequency clock (LFCLK) and the high-frequency clock (HFCLK).
enum nrf_clock_events_t |
enum nrf_clock_hf_src_t |
enum nrf_clock_int_mask_t |
enum nrf_clock_lf_src_t |
enum nrf_clock_tasks_t |
Tasks.
The NRF_CLOCK_TASKS_LFCLKSTOP task cannot be set when the low-frequency clock is not running. The NRF_CLOCK_TASKS_HFCLKSTOP task cannot be set when the high-frequency clock is not running.
enum nrf_clock_xtalfreq_t |
__STATIC_INLINE void nrf_clock_cal_timer_timeout_set | ( | uint32_t | interval | ) |
Function for changing the calibration timer interval.
[in] | interval | New calibration timer interval in 0.25 s resolution (range: 0.25 seconds to 31.75 seconds). |
__STATIC_INLINE uint32_t nrf_clock_event_address_get | ( | nrf_clock_events_t | event | ) |
Function for retrieving the address of a specific event.
This function can be used by the PPI module.
[in] | event | Event. |
address | of requested event register |
__STATIC_INLINE bool nrf_clock_event_check | ( | nrf_clock_events_t | event | ) |
Function for retrieving the state of a specific event.
[in] | event | Event. |
true | If the event is set. |
false | If the event is not set. |
__STATIC_INLINE void nrf_clock_event_clear | ( | nrf_clock_events_t | event | ) |
Function for clearing a specific event.
[in] | event | Event. |
__STATIC_INLINE bool nrf_clock_hf_is_running | ( | void | ) |
Function for retrieving the state of the HFCLK clock.
false | If the HFCLK clock is not running. |
true | If the HFCLK clock is running. |
__STATIC_INLINE nrf_clock_hf_src_t nrf_clock_hf_src_get | ( | void | ) |
Function for retrieving the active source of the high-frequency clock.
NRF_CLOCK_HF_SRC_RC | If the internal 16 MHz RC oscillator is the active source of the high-frequency clock. |
NRF_CLOCK_HF_SRC_Xtal | If an external 16 MHz/32 MHz crystal oscillator is the active source of the high-frequency clock. |
__STATIC_INLINE nrf_clock_start_task_status_t nrf_clock_hf_start_task_status_get | ( | void | ) |
Function for retrieving the trigger status of the task HFCLKSTART.
NRF_CLOCK_START_TASK_NOT_TRIGGERED | If the task HFCLKSTART has not been triggered. |
NRF_CLOCK_START_TASK_TRIGGERED | If the task HFCLKSTART has been triggered. |
__STATIC_INLINE void nrf_clock_int_disable | ( | uint32_t | int_mask | ) |
Function for disabling a specific interrupt.
[in] | int_mask | Interrupt. |
__STATIC_INLINE void nrf_clock_int_enable | ( | uint32_t | int_mask | ) |
Function for enabling a specific interrupt.
[in] | int_mask | Interrupt. |
__STATIC_INLINE bool nrf_clock_int_enable_check | ( | nrf_clock_int_mask_t | int_mask | ) |
Function for retrieving the state of a specific interrupt.
[in] | int_mask | Interrupt. |
true | Interrupt is enabled. |
false | Interrupt is not enabled. |
__STATIC_INLINE nrf_clock_lf_src_t nrf_clock_lf_actv_src_get | ( | void | ) |
Function for retrieving the active source of the low-frequency clock.
NRF_CLOCK_LF_SRC_RC | If the internal 32 kHz RC oscillator is the active source of the low-frequency clock. |
NRF_CLOCK_LF_SRC_Xtal | If an external 32 kHz crystal oscillator is the active source of the low-frequency clock. |
NRF_CLOCK_LF_SRC_Synth | If the internal 32 kHz synthesizer from the HFCLK is the active source of the low-frequency clock. |
__STATIC_INLINE bool nrf_clock_lf_is_running | ( | void | ) |
Function for retrieving the state of the LFCLK clock.
false | If the LFCLK clock is not running. |
true | If the LFCLK clock is running. |
__STATIC_INLINE nrf_clock_lf_src_t nrf_clock_lf_src_get | ( | void | ) |
Function for retrieving the selected source for the low-frequency clock.
NRF_CLOCK_LF_SRC_RC | If the internal 32 kHz RC oscillator is the selected source for the low-frequency clock. |
NRF_CLOCK_LF_SRC_Xtal | If an external 32 kHz crystal oscillator is the selected source for the low-frequency clock. |
NRF_CLOCK_LF_SRC_Synth | If the internal 32 kHz synthesizer from the HFCLK is the selected source for the low-frequency clock. |
__STATIC_INLINE void nrf_clock_lf_src_set | ( | nrf_clock_lf_src_t | source | ) |
Function for changing the low-frequency clock source.
This function cannot be called when the low-frequency clock is running.
[in] | source | New low-frequency clock source. |
__STATIC_INLINE nrf_clock_lf_src_t nrf_clock_lf_srccopy_get | ( | void | ) |
Function for retrieving the clock source for the LFCLK clock when the task LKCLKSTART is triggered.
NRF_CLOCK_LF_SRC_RC | If the internal 32 kHz RC oscillator is running and generating the LFCLK clock. |
NRF_CLOCK_LF_SRC_Xtal | If an external 32 kHz crystal oscillator is running and generating the LFCLK clock. |
NRF_CLOCK_LF_SRC_Synth | If the internal 32 kHz synthesizer from the HFCLK is running and generating the LFCLK clock. |
__STATIC_INLINE nrf_clock_start_task_status_t nrf_clock_lf_start_task_status_get | ( | void | ) |
Function for retrieving the trigger status of the task LFCLKSTART.
NRF_CLOCK_START_TASK_NOT_TRIGGERED | If the task LFCLKSTART has not been triggered. |
NRF_CLOCK_START_TASK_TRIGGERED | If the task LFCLKSTART has been triggered. |
__STATIC_INLINE uint32_t nrf_clock_task_address_get | ( | nrf_clock_tasks_t | task | ) |
Function for retrieving the address of a specific task.
This function can be used by the PPI module.
[in] | task | Task. |
address | of requested task register |
__STATIC_INLINE void nrf_clock_task_set | ( | nrf_clock_tasks_t | task | ) |
Function for setting a specific task.
[in] | task | Task. |
__STATIC_INLINE nrf_clock_xtalfreq_t nrf_clock_xtalfreq_get | ( | void | ) |
Function for retrieving the frequency selection of the external crystal.
NRF_CLOCK_XTALFREQ_16MHz | If a 16 MHz crystal is used as source for the HFCLK oscillator. |
NRF_CLOCK_XTALFREQ_32MHz | If a 32 MHz crystal is used as source for the HFCLK oscillator. |
__STATIC_INLINE void nrf_clock_xtalfreq_set | ( | nrf_clock_xtalfreq_t | xtalfreq | ) |
Function for changing the frequency selection of the external crystal.
[in] | xtalfreq | New frequency selection for the external crystal. |