libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
pwr.c
Go to the documentation of this file.
1/** @defgroup pwr_file PWR peripheral API
2 *
3 * @ingroup peripheral_apis
4 *
5 * @brief <b>libopencm3 STM32F7xx Power Control</b>
6 *
7 * @version 1.0.0
8 *
9 * @author @htmlonly &copy; @endhtmlonly 2011 Stephen Caudle <scaudle@doceme.com>
10 * @author @htmlonly &copy; @endhtmlonly 2017 Matthew Lai <m@matthewlai.ca>
11 *
12 * @date 12 March 2017
13 *
14 * This library supports the power control system for the
15 * STM32F7 series of ARM Cortex Microcontrollers by ST Microelectronics.
16 *
17 * LGPL License Terms @ref lgpl_license
18 */
19/*
20 * This file is part of the libopencm3 project.
21 *
22 * Copyright (C) 2011 Stephen Caudle <scaudle@doceme.com>
23 * Copyright (C) 2017 Matthew Lai <m@matthewlai.ca>
24 *
25 * This library is free software: you can redistribute it and/or modify
26 * it under the terms of the GNU Lesser General Public License as published by
27 * the Free Software Foundation, either version 3 of the License, or
28 * (at your option) any later version.
29 *
30 * This library is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU Lesser General Public License for more details.
34 *
35 * You should have received a copy of the GNU Lesser General Public License
36 * along with this library. If not, see <http://www.gnu.org/licenses/>.
37 */
38
40
41/**@{*/
42
44{
45 PWR_CR1 &= ~PWR_CR1_VOS_MASK;
46
47 if (scale == PWR_SCALE1) {
49 } else if (scale == PWR_SCALE2) {
51 } else if (scale == PWR_SCALE3) {
53 }
54}
55
57{
59 while (!(PWR_CSR1 & PWR_CSR1_ODRDY));
61 while (!(PWR_CSR1 & PWR_CSR1_ODSWRDY));
62}
63
65{
67 while (!(PWR_CSR1 & PWR_CSR1_ODSWRDY));
68}
69
70/**@}*/
#define PWR_CR1_ODEN
ODEN: Over-drive enable.
Definition: f7/pwr.h:76
#define PWR_CR1_ODSWEN
ODSWEN: Over-drive switching enabled.
Definition: f7/pwr.h:73
#define PWR_CSR1_ODSWRDY
ODSWRDY: Over-drive mode switching ready.
Definition: f7/pwr.h:157
#define PWR_CSR1_ODRDY
ODRDY: Over-drive mode ready.
Definition: f7/pwr.h:160
pwr_vos_scale
Definition: f7/pwr.h:281
@ PWR_SCALE1
Definition: f7/pwr.h:282
@ PWR_SCALE2
<= 180MHz w/o overdrive, <= 216MHz w/ overdrive
Definition: f7/pwr.h:283
@ PWR_SCALE3
<= 168MHz w/o overdrive, <= 180MHz w/ overdrive
Definition: f7/pwr.h:284
void pwr_enable_overdrive(void)
Definition: pwr.c:56
void pwr_set_vos_scale(enum pwr_vos_scale scale)
Definition: pwr.c:43
void pwr_disable_overdrive(void)
Definition: pwr.c:64
#define PWR_CR1
Power control register (PWR_CR1)
Definition: f7/pwr.h:43
#define PWR_CSR1
Power control/status register (PWR_CSR1)
Definition: f7/pwr.h:46
#define PWR_CR1_VOS_SCALE_3
Definition: f7/pwr.h:84
#define PWR_CR1_VOS_SCALE_2
Definition: f7/pwr.h:85
#define PWR_CR1_VOS_SCALE_1
Definition: f7/pwr.h:86