Mercurial > pub > halpp
comparison l476rg/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l4xx.h @ 0:32a3b1785697
a rough draft of Hardware Abstraction Layer for C++
STM32L476RG drivers
author | cin |
---|---|
date | Thu, 12 Jan 2017 02:45:43 +0300 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:32a3b1785697 |
---|---|
1 /** | |
2 ****************************************************************************** | |
3 * @file stm32l4xx.h | |
4 * @author MCD Application Team | |
5 * @version V1.2.0 | |
6 * @date 28-October-2016 | |
7 * @brief CMSIS STM32L4xx Device Peripheral Access Layer Header File. | |
8 * | |
9 * The file is the unique include file that the application programmer | |
10 * is using in the C source code, usually in main.c. This file contains: | |
11 * - Configuration section that allows to select: | |
12 * - The STM32L4xx device used in the target application | |
13 * - To use or not the peripheral’s drivers in application code(i.e. | |
14 * code will be based on direct access to peripheral’s registers | |
15 * rather than drivers API), this option is controlled by | |
16 * "#define USE_HAL_DRIVER" | |
17 * | |
18 ****************************************************************************** | |
19 * @attention | |
20 * | |
21 * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> | |
22 * | |
23 * Redistribution and use in source and binary forms, with or without modification, | |
24 * are permitted provided that the following conditions are met: | |
25 * 1. Redistributions of source code must retain the above copyright notice, | |
26 * this list of conditions and the following disclaimer. | |
27 * 2. Redistributions in binary form must reproduce the above copyright notice, | |
28 * this list of conditions and the following disclaimer in the documentation | |
29 * and/or other materials provided with the distribution. | |
30 * 3. Neither the name of STMicroelectronics nor the names of its contributors | |
31 * may be used to endorse or promote products derived from this software | |
32 * without specific prior written permission. | |
33 * | |
34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
35 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
36 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
37 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |
38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
41 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
42 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
43 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
44 * | |
45 ****************************************************************************** | |
46 */ | |
47 | |
48 /** @addtogroup CMSIS | |
49 * @{ | |
50 */ | |
51 | |
52 /** @addtogroup stm32l4xx | |
53 * @{ | |
54 */ | |
55 | |
56 #ifndef __STM32L4xx_H | |
57 #define __STM32L4xx_H | |
58 | |
59 #ifdef __cplusplus | |
60 extern "C" { | |
61 #endif /* __cplusplus */ | |
62 | |
63 /** @addtogroup Library_configuration_section | |
64 * @{ | |
65 */ | |
66 | |
67 /** | |
68 * @brief STM32 Family | |
69 */ | |
70 #if !defined (STM32L4) | |
71 #define STM32L4 | |
72 #endif /* STM32L4 */ | |
73 | |
74 /* Uncomment the line below according to the target STM32L4 device used in your | |
75 application | |
76 */ | |
77 | |
78 #if !defined (STM32L431xx) && !defined (STM32L432xx) && !defined (STM32L433xx) && !defined (STM32L442xx) && !defined (STM32L443xx) && \ | |
79 !defined (STM32L451xx) && !defined (STM32L452xx) && !defined (STM32L462xx) && \ | |
80 !defined (STM32L471xx) && !defined (STM32L475xx) && !defined (STM32L476xx) && !defined (STM32L485xx) && !defined (STM32L486xx) | |
81 /* #define STM32L431xx */ /*!< STM32L431xx Devices */ | |
82 /* #define STM32L432xx */ /*!< STM32L432xx Devices */ | |
83 /* #define STM32L433xx */ /*!< STM32L433xx Devices */ | |
84 /* #define STM32L442xx */ /*!< STM32L442xx Devices */ | |
85 /* #define STM32L443xx */ /*!< STM32L443xx Devices */ | |
86 /* #define STM32L451xx */ /*!< STM32L451xx Devices */ | |
87 /* #define STM32L452xx */ /*!< STM32L452xx Devices */ | |
88 /* #define STM32L462xx */ /*!< STM32L462xx Devices */ | |
89 /* #define STM32L471xx */ /*!< STM32L471xx Devices */ | |
90 /* #define STM32L475xx */ /*!< STM32L475xx Devices */ | |
91 /* #define STM32L476xx */ /*!< STM32L476xx Devices */ | |
92 /* #define STM32L485xx */ /*!< STM32L485xx Devices */ | |
93 /* #define STM32L486xx */ /*!< STM32L486xx Devices */ | |
94 #endif | |
95 | |
96 /* Tip: To avoid modifying this file each time you need to switch between these | |
97 devices, you can define the device in your toolchain compiler preprocessor. | |
98 */ | |
99 #if !defined (USE_HAL_DRIVER) | |
100 /** | |
101 * @brief Comment the line below if you will not use the peripherals drivers. | |
102 In this case, these drivers will not be included and the application code will | |
103 be based on direct access to peripherals registers | |
104 */ | |
105 /*#define USE_HAL_DRIVER */ | |
106 #endif /* USE_HAL_DRIVER */ | |
107 | |
108 /** | |
109 * @brief CMSIS Device version number V1.2.0 | |
110 */ | |
111 #define __STM32L4_CMSIS_VERSION_MAIN (0x01) /*!< [31:24] main version */ | |
112 #define __STM32L4_CMSIS_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */ | |
113 #define __STM32L4_CMSIS_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */ | |
114 #define __STM32L4_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */ | |
115 #define __STM32L4_CMSIS_VERSION ((__STM32L4_CMSIS_VERSION_MAIN << 24)\ | |
116 |(__STM32L4_CMSIS_VERSION_SUB1 << 16)\ | |
117 |(__STM32L4_CMSIS_VERSION_SUB2 << 8 )\ | |
118 |(__STM32L4_CMSIS_VERSION_RC)) | |
119 | |
120 /** | |
121 * @} | |
122 */ | |
123 | |
124 /** @addtogroup Device_Included | |
125 * @{ | |
126 */ | |
127 | |
128 #if defined(STM32L431xx) | |
129 #include "stm32l431xx.h" | |
130 #elif defined(STM32L432xx) | |
131 #include "stm32l432xx.h" | |
132 #elif defined(STM32L433xx) | |
133 #include "stm32l433xx.h" | |
134 #elif defined(STM32L442xx) | |
135 #include "stm32l442xx.h" | |
136 #elif defined(STM32L443xx) | |
137 #include "stm32l443xx.h" | |
138 #elif defined(STM32L451xx) | |
139 #include "stm32l451xx.h" | |
140 #elif defined(STM32L452xx) | |
141 #include "stm32l452xx.h" | |
142 #elif defined(STM32L462xx) | |
143 #include "stm32l462xx.h" | |
144 #elif defined(STM32L471xx) | |
145 #include "stm32l471xx.h" | |
146 #elif defined(STM32L475xx) | |
147 #include "stm32l475xx.h" | |
148 #elif defined(STM32L476xx) | |
149 #include "stm32l476xx.h" | |
150 #elif defined(STM32L485xx) | |
151 #include "stm32l485xx.h" | |
152 #elif defined(STM32L486xx) | |
153 #include "stm32l486xx.h" | |
154 #else | |
155 #error "Please select first the target STM32L4xx device used in your application (in stm32l4xx.h file)" | |
156 #endif | |
157 | |
158 /** | |
159 * @} | |
160 */ | |
161 | |
162 /** @addtogroup Exported_types | |
163 * @{ | |
164 */ | |
165 typedef enum | |
166 { | |
167 RESET = 0, | |
168 SET = !RESET | |
169 } FlagStatus, ITStatus; | |
170 | |
171 typedef enum | |
172 { | |
173 DISABLE = 0, | |
174 ENABLE = !DISABLE | |
175 } FunctionalState; | |
176 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) | |
177 | |
178 typedef enum | |
179 { | |
180 ERROR = 0, | |
181 SUCCESS = !ERROR | |
182 } ErrorStatus; | |
183 | |
184 /** | |
185 * @} | |
186 */ | |
187 | |
188 | |
189 /** @addtogroup Exported_macros | |
190 * @{ | |
191 */ | |
192 #define SET_BIT(REG, BIT) ((REG) |= (BIT)) | |
193 | |
194 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) | |
195 | |
196 #define READ_BIT(REG, BIT) ((REG) & (BIT)) | |
197 | |
198 #define CLEAR_REG(REG) ((REG) = (0x0)) | |
199 | |
200 #define WRITE_REG(REG, VAL) ((REG) = (VAL)) | |
201 | |
202 #define READ_REG(REG) ((REG)) | |
203 | |
204 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) | |
205 | |
206 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) | |
207 | |
208 | |
209 /** | |
210 * @} | |
211 */ | |
212 | |
213 #if defined (USE_HAL_DRIVER) | |
214 #include "stm32l4xx_hal.h" | |
215 #endif /* USE_HAL_DRIVER */ | |
216 | |
217 #ifdef __cplusplus | |
218 } | |
219 #endif /* __cplusplus */ | |
220 | |
221 #endif /* __STM32L4xx_H */ | |
222 /** | |
223 * @} | |
224 */ | |
225 | |
226 /** | |
227 * @} | |
228 */ | |
229 | |
230 | |
231 | |
232 | |
233 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |