libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
clock_common.c
Go to the documentation of this file.
1/** @addtogroup clock_file CLOCK peripheral API
2 *
3 * @brief <b>Access functions for the Clock Controller</b>
4 *
5 * @ingroup peripheral_apis
6 * LGPL License Terms @ref lgpl_license
7 * @author @htmlonly &copy; @endhtmlonly 2016 Maxim Sloyko <maxims@google.com>
8 * @author @htmlonly &copy; @endhtmlonly 2021 Eduard Drusa <ventyl86 at netkosice dot sk>
9 *
10 */
11
12/*
13 * This file is part of the libopencm3 project.
14 *
15 * Copyright (C) 2017-2018 Unicore MX project<dev(at)lists(dot)unicore-mx(dot)org>
16 * Copyright (C) 2021 Eduard Drusa <ventyl86(at)netkosice(dot)sk>
17 *
18 * This library is free software: you can redistribute it and/or modify
19 * it under the terms of the GNU Lesser General Public License as published by
20 * the Free Software Foundation, either version 3 of the License, or
21 * (at your option) any later version.
22 *
23 * This library is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU Lesser General Public License for more details.
27 *
28 * You should have received a copy of the GNU Lesser General Public License
29 * along with this library. If not, see <http://www.gnu.org/licenses/>.
30 */
31
34/**@{*/
35
36/** @brief Start Low Frequency Clock
37 *
38 * @param[in] wait bool: If true, will busy wait for the clock to start.
39 */
40void clock_start_lfclk(bool wait)
41{
43 if (wait) {
45 }
46}
47
48/** @brief Stop Low Frequency Clock */
50{
52}
53
54/** @brief Start High Frequency Crystal Oscillator.
55 *
56 * @details Oscillator needs to be running for the radio to work.
57 *
58 * @param[in] wait bool If true, will busy wait for the clock to start.
59 */
60void clock_start_hfclk(bool wait)
61{
63 if (wait) {
65 }
66}
67
68/** @brief Stop High Frequency Crystal Oscillator */
70{
72}
73
74/** @brief Low Frequency Clock Source.
75 *
76 * @param[in] lfclk_src enum clock_lfclk_src
77 */
79{
80 CLOCK_LFCLKSRC = lfclk_src;
81}
82/**@}*/
83
#define PERIPH_TRIGGER_TASK(task)
#define CLOCK_HFCLKSTAT_STATE
Definition: common/clock.h:71
#define CLOCK_TASK_HFCLKSTART
Definition: common/clock.h:37
#define CLOCK_HFCLKSTAT
Definition: common/clock.h:55
#define CLOCK_TASK_HFCLKSTOP
Definition: common/clock.h:38
#define CLOCK_LFCLKSRC
Definition: common/clock.h:59
#define CLOCK_LFCLKSTAT_STATE
Definition: common/clock.h:79
#define CLOCK_TASK_LFCLKSTART
Definition: common/clock.h:39
clock_lfclk_src
Definition: common/clock.h:81
#define CLOCK_TASK_LFCLKSTOP
Definition: common/clock.h:40
#define CLOCK_LFCLKSTAT
Definition: common/clock.h:57
void clock_start_lfclk(bool wait)
Start Low Frequency Clock.
Definition: clock_common.c:40
void clock_set_lfclk_src(enum clock_lfclk_src lfclk_src)
Low Frequency Clock Source.
Definition: clock_common.c:78
void clock_start_hfclk(bool wait)
Start High Frequency Crystal Oscillator.
Definition: clock_common.c:60
void clock_stop_lfclk()
Stop Low Frequency Clock.
Definition: clock_common.c:49
void clock_stop_hfclk()
Stop High Frequency Crystal Oscillator.
Definition: clock_common.c:69