libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
pwr_common_v2.c
Go to the documentation of this file.
1/** @addtogroup pwr_file PWR peripheral API
2 * @ingroup peripheral_apis
3 *
4 * @author @htmlonly &copy; @endhtmlonly 2012 Karl Palsson <karlp@tweak.net.au>
5 */
6/*
7 * This file is part of the libopencm3 project.
8 *
9 * Copyright (C) 2012 Karl Palsson <karlp@tweak.net.au>
10 *
11 * This library is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with this library. If not, see <http://www.gnu.org/licenses/>.
23 */
24/**@{*/
25
28
30{
31 /* You are not allowed to write zeros here, don't try and optimize! */
32 uint32_t reg = PWR_CR;
33 reg &= ~(PWR_CR_VOS_MASK);
34 switch (scale) {
35 case PWR_SCALE1:
36 reg |= PWR_CR_VOS_RANGE1;
37 break;
38 case PWR_SCALE2:
39 reg |= PWR_CR_VOS_RANGE2;
40 break;
41 case PWR_SCALE3:
42 reg |= PWR_CR_VOS_RANGE3;
43 break;
44 }
45 PWR_CR = reg;
46}
47
48/**@}*/
49
#define PWR_CR
Power control register (PWR_CR)
Definition: pwr_common_v1.h:41
void pwr_set_vos_scale(enum pwr_vos_scale scale)
Definition: pwr_common_v2.c:29
#define PWR_CR_VOS_RANGE2
Definition: pwr_common_v2.h:45
#define PWR_CR_VOS_RANGE3
Definition: pwr_common_v2.h:46
#define PWR_CR_VOS_RANGE1
Definition: pwr_common_v2.h:44
#define PWR_CR_VOS_MASK
Definition: pwr_common_v2.h:48
pwr_vos_scale
Voltage scales for internal regulator.
Definition: pwr_common_v2.h:82
@ PWR_SCALE1
high performance, highest voltage
Definition: pwr_common_v2.h:84
@ PWR_SCALE2
medium performance, flash operational but slow
Definition: pwr_common_v2.h:86
@ PWR_SCALE3
low performance, no flash erase/program
Definition: pwr_common_v2.h:88