Loading...
Searching...
No Matches
nrf_clock.h
1/*
2 * SPDX-FileCopyrightText: 2022 Gunar Schorcht
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
21
22#include <stdbool.h>
23
24#include "nrf.h"
25#include_next "nrf_clock.h"
26
27#if !DOXYGEN
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#define NRF_CLOCK_HFCLK_HIGH_ACCURACY (1UL)
34#define NRF_CLOCK_EVENT_HFCLKSTARTED offsetof(NRF_CLOCK_Type, EVENTS_HFCLKSTARTED)
35
36typedef enum {
37 NRF_CLOCK_TASK_HFCLKSTART,
38 NRF_CLOCK_TASK_HFCLKSTOP,
39} nrf_clock_task_t;
40
52static bool _nrf_clock_hf_running = false;
53
57static inline bool nrf_clock_hf_is_running(NRF_CLOCK_Type const *reg,
58 uint32_t clk_src)
59{
60
61 return _nrf_clock_hf_running;
62}
63
70static inline bool nrf_clock_event_clear(NRF_CLOCK_Type *reg, uint32_t event)
71{
72 (void)reg;
73 (void)event;
74 return true;
75}
76
82static inline void nrf_clock_task_trigger(NRF_CLOCK_Type *reg,
83 nrf_clock_task_t task)
84{
85 switch (task) {
86 case NRF_CLOCK_TASK_HFCLKSTART:
88 _nrf_clock_hf_running = true;
89 break;
90 case NRF_CLOCK_TASK_HFCLKSTOP:
92 _nrf_clock_hf_running = false;
93 break;
94 default:
95 break;
96 }
97}
98
99#ifdef __cplusplus
100}
101#endif
102
103#endif /* !DOXYGEN */
void clock_hfxo_request(void)
Request the external high frequency crystal (HFXO) as HF clock source.
void clock_hfxo_release(void)
Release the use of the HFXO.
event structure
Definition event.h:142