OpenMPTL - STM32F10X
C++ Microprocessor Template Library
pwr.hpp
Go to the documentation of this file.
1 /*
2  * OpenMPTL - C++ Microprocessor Template Library
3  *
4  * Copyright (C) 2012-2017 Axel Burri <axel@tty0.ch>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 /*
22  * This program contains derivative representations of CMSIS System
23  * View Description (SVD) files, and is subject to the "End User
24  * License Agreement for STMicroelectronics" (see "STM_License.html"
25  * in the containing directory).
26  */
27 
28 #ifndef ARCH_REG_PWR_HPP_INCLUDED
29 #define ARCH_REG_PWR_HPP_INCLUDED
30 
31 #include <register.hpp>
32 
33 namespace mptl {
34 
35 /**
36  * Power control
37  */
38 struct PWR
39 {
40  static constexpr reg_addr_t base_addr = 0x40007000;
41 
42  /**
43  * Power control register (PWR_CR)
44  */
45  struct CR
46  : public reg< uint32_t, base_addr + 0x0, rw, 0x00000000 >
47  {
49 
50  using LPDS = regbits< type, 0, 1 >; /**< Low Power Deep Sleep */
51  using PDDS = regbits< type, 1, 1 >; /**< Power Down Deep Sleep */
52  using CWUF = regbits< type, 2, 1 >; /**< Clear Wake-up Flag */
53  using CSBF = regbits< type, 3, 1 >; /**< Clear STANDBY Flag */
54  using PVDE = regbits< type, 4, 1 >; /**< Power Voltage Detector Enable */
55 
56  /** PVD Level Selection */
57  struct PLS : public regbits< type, 5, 3 >
58  {
59  template<unsigned int fraction>
61  : public regval< regbits_type, fraction - 2 >
62  { static_assert((fraction >= 2) && (fraction <= 9), "invalid fraction"); };
63  };
64 
65  using DBP = regbits< type, 8, 1 >; /**< Disable Backup Domain write protection */
66  };
67 
68  /**
69  * Power control register (PWR_CR)
70  */
71  struct CSR
72  : public reg< uint32_t, base_addr + 0x4, rw, 0x00000000 >
73  {
75 
76  using WUF = regbits< type, 0, 1 >; /**< Wake-Up Flag */
77  using SBF = regbits< type, 1, 1 >; /**< STANDBY Flag */
78  using PVDO = regbits< type, 2, 1 >; /**< PVD Output */
79  using EWUP = regbits< type, 8, 1 >; /**< Enable WKUP pin */
80  };
81 };
82 
83 } // namespace mptl
84 
85 #endif // ARCH_REG_PWR_HPP_INCLUDED
PVD Level Selection.
Definition: pwr.hpp:57
Power control register (PWR_CR)
Definition: pwr.hpp:45
uintptr_t reg_addr_t
Power control register (PWR_CR)
Definition: pwr.hpp:71
Power control.
Definition: pwr.hpp:38
static constexpr reg_addr_t base_addr
Definition: pwr.hpp:40