Loading...
Searching...
No Matches
nrf_clock.h
1/*
2 * Copyright (C) 2022 Gunar Schorcht
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
9#pragma once
10
24
25#include <stdbool.h>
26
27#include "nrf.h"
28#include_next "nrf_clock.h"
29
30#if !DOXYGEN
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#define NRF_CLOCK_HFCLK_HIGH_ACCURACY (1UL)
37#define NRF_CLOCK_EVENT_HFCLKSTARTED offsetof(NRF_CLOCK_Type, EVENTS_HFCLKSTARTED)
38
39typedef enum {
40 NRF_CLOCK_TASK_HFCLKSTART,
41 NRF_CLOCK_TASK_HFCLKSTOP,
42} nrf_clock_task_t;
43
55static bool _nrf_clock_hf_running = false;
56
60static inline bool nrf_clock_hf_is_running(NRF_CLOCK_Type const *reg,
61 uint32_t clk_src)
62{
63
64 return _nrf_clock_hf_running;
65}
66
73static inline bool nrf_clock_event_clear(NRF_CLOCK_Type *reg, uint32_t event)
74{
75 (void)reg;
76 (void)event;
77 return true;
78}
79
85static inline void nrf_clock_task_trigger(NRF_CLOCK_Type *reg,
86 nrf_clock_task_t task)
87{
88 switch (task) {
89 case NRF_CLOCK_TASK_HFCLKSTART:
91 _nrf_clock_hf_running = true;
92 break;
93 case NRF_CLOCK_TASK_HFCLKSTOP:
95 _nrf_clock_hf_running = false;
96 break;
97 default:
98 break;
99 }
100}
101
102#ifdef __cplusplus
103}
104#endif
105
106#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:145