libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
crs_common_all.c
Go to the documentation of this file.
1
/** @addtogroup crs_file CRS peripheral API
2
* @ingroup peripheral_apis
3
*
4
* @brief <b>(USB) STM32 Clock Recovery Subsystem</b>
5
*
6
* @version 1.0.0
7
*
8
* @date 5 Feb 2014
9
*
10
* LGPL License Terms @ref lgpl_license
11
*/
12
13
/*
14
* This file is part of the libopencm3 project.
15
*
16
* This library is free software: you can redistribute it and/or modify
17
* it under the terms of the GNU Lesser General Public License as published by
18
* the Free Software Foundation, either version 3 of the License, or
19
* (at your option) any later version.
20
*
21
* This library is distributed in the hope that it will be useful,
22
* but WITHOUT ANY WARRANTY; without even the implied warranty of
23
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
* GNU Lesser General Public License for more details.
25
*
26
* You should have received a copy of the GNU Lesser General Public License
27
* along with this library. If not, see <http://www.gnu.org/licenses/>.
28
*/
29
/**@{*/
30
31
32
#include <
libopencm3/stm32/crs.h
>
33
#include <
libopencm3/stm32/rcc.h
>
34
35
/**
36
* This function enables automatic trimming of internal RC oscillator by USB SOF
37
* frames
38
*/
39
void
crs_autotrim_usb_enable
(
void
)
40
{
41
rcc_periph_clock_enable
(
RCC_CRS
);
42
43
CRS_CFGR
&= ~CRS_CFGR_SYNCSRC;
44
CRS_CFGR
|=
CRS_CFGR_SYNCSRC_USB_SOF
;
45
46
CRS_CR
|=
CRS_CR_AUTOTRIMEN
;
47
CRS_CR
|=
CRS_CR_CEN
;
48
}
49
50
/**@}*/
crs.h
CRS_CFGR
#define CRS_CFGR
Definition:
crs_common_all.h:41
CRS_CR
#define CRS_CR
Definition:
crs_common_all.h:40
CRS_CR_CEN
#define CRS_CR_CEN
Definition:
crs_common_all.h:56
CRS_CFGR_SYNCSRC_USB_SOF
#define CRS_CFGR_SYNCSRC_USB_SOF
Definition:
crs_common_all.h:70
CRS_CR_AUTOTRIMEN
#define CRS_CR_AUTOTRIMEN
Definition:
crs_common_all.h:55
crs_autotrim_usb_enable
void crs_autotrim_usb_enable(void)
This function enables automatic trimming of internal RC oscillator by USB SOF frames.
Definition:
crs_common_all.c:39
rcc_periph_clock_enable
void rcc_periph_clock_enable(enum rcc_periph_clken clken)
Enable Peripheral Clock in running mode.
Definition:
rcc_common_all.c:127
RCC_CRS
@ RCC_CRS
Definition:
l4/rcc.h:820
rcc.h
lib
stm32
common
crs_common_all.c
Generated on Tue Mar 7 2023 16:12:11 for libopencm3 by
1.9.4