Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
30 | mjames | 1 | /** |
2 | ****************************************************************************** |
||
3 | * @file stm32l1xx.h |
||
4 | * @author MCD Application Team |
||
5 | * @version V2.2.0 |
||
6 | * @date 01-July-2016 |
||
7 | * @brief CMSIS STM32L1xx 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 STM32L1xx 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 stm32l1xx |
||
53 | * @{ |
||
54 | */ |
||
55 | |||
56 | #ifndef __STM32L1XX_H |
||
57 | #define __STM32L1XX_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 (STM32L1) |
||
71 | #define STM32L1 |
||
72 | #endif /* STM32L1 */ |
||
73 | |||
74 | |||
75 | /* Uncomment the line below according to the target STM32L device used in your |
||
76 | application |
||
77 | */ |
||
78 | |||
79 | #if !defined (STM32L100xB) && !defined (STM32L100xBA) && !defined (STM32L100xC) && \ |
||
80 | !defined (STM32L151xB) && !defined (STM32L151xBA) && !defined (STM32L151xC) && !defined (STM32L151xCA) && !defined (STM32L151xD) && !defined (STM32L151xDX) && !defined (STM32L151xE) && \ |
||
81 | !defined (STM32L152xB) && !defined (STM32L152xBA) && !defined (STM32L152xC) && !defined (STM32L152xCA) && !defined (STM32L152xD) && !defined (STM32L152xDX) && !defined (STM32L152xE) && \ |
||
82 | !defined (STM32L162xC) && !defined (STM32L162xCA) && !defined (STM32L162xD) && !defined (STM32L162xDX) && !defined (STM32L162xE) |
||
83 | /* #define STM32L100xB */ /*!< STM32L100C6, STM32L100R and STM32L100RB Devices */ |
||
84 | /* #define STM32L100xBA */ /*!< STM32L100C6-A, STM32L100R8-A and STM32L100RB-A Devices */ |
||
85 | /* #define STM32L100xC */ /*!< STM32L100RC Devices */ |
||
86 | /* #define STM32L151xB */ /*!< STM32L151C6, STM32L151R6, STM32L151C8, STM32L151R8, STM32L151V8, STM32L151CB, STM32L151RB and STM32L151VB */ |
||
87 | /* #define STM32L151xBA */ /*!< STM32L151C6-A, STM32L151R6-A, STM32L151C8-A, STM32L151R8-A, STM32L151V8-A, STM32L151CB-A, STM32L151RB-A and STM32L151VB-A */ |
||
88 | /* #define STM32L151xC */ /*!< STM32L151CC, STM32L151UC, STM32L151RC and STM32L151VC */ |
||
89 | /* #define STM32L151xCA */ /*!< STM32L151RC-A, STM32L151VC-A, STM32L151QC and STM32L151ZC */ |
||
90 | /* #define STM32L151xD */ /*!< STM32L151QD, STM32L151RD, STM32L151VD & STM32L151ZD */ |
||
91 | /* #define STM32L151xDX */ /*!< STM32L151VD-X Devices */ |
||
92 | /* #define STM32L151xE */ /*!< STM32L151QE, STM32L151RE, STM32L151VE and STM32L151ZE */ |
||
93 | /* #define STM32L152xB */ /*!< STM32L152C6, STM32L152R6, STM32L152C8, STM32L152R8, STM32L152V8, STM32L152CB, STM32L152RB and STM32L152VB */ |
||
94 | /* #define STM32L152xBA */ /*!< STM32L152C6-A, STM32L152R6-A, STM32L152C8-A, STM32L152R8-A, STM32L152V8-A, STM32L152CB-A, STM32L152RB-A and STM32L152VB-A */ |
||
95 | /* #define STM32L152xC */ /*!< STM32L152CC, STM32L152UC, STM32L152RC and STM32L152VC */ |
||
96 | /* #define STM32L152xCA */ /*!< STM32L152RC-A, STM32L152VC-A, STM32L152QC and STM32L152ZC */ |
||
97 | /* #define STM32L152xD */ /*!< STM32L152QD, STM32L152RD, STM32L152VD and STM32L152ZD */ |
||
98 | /* #define STM32L152xDX */ /*!< STM32L152VD-X Devices */ |
||
99 | /* #define STM32L152xE */ /*!< STM32L152QE, STM32L152RE, STM32L152VE and STM32L152ZE */ |
||
100 | /* #define STM32L162xC */ /*!< STM32L162RC and STM32L162VC */ |
||
101 | /* #define STM32L162xCA */ /*!< STM32L162RC-A, STM32L162VC-A, STM32L162QC and STM32L162ZC */ |
||
102 | /* #define STM32L162xD */ /*!< STM32L162QD, STM32L162RD, STM32L162VD and STM32L162ZD */ |
||
103 | /* #define STM32L162xDX */ /*!< STM32L162VD-X Devices */ |
||
104 | /* #define STM32L162xE */ /*!< STM32L162RE, STM32L162VE and STM32L162ZE */ |
||
105 | #endif |
||
106 | |||
107 | /* Tip: To avoid modifying this file each time you need to switch between these |
||
108 | devices, you can define the device in your toolchain compiler preprocessor. |
||
109 | */ |
||
110 | |||
111 | #if !defined (USE_HAL_DRIVER) |
||
112 | /** |
||
113 | * @brief Comment the line below if you will not use the peripherals drivers. |
||
114 | In this case, these drivers will not be included and the application code will |
||
115 | be based on direct access to peripherals registers |
||
116 | */ |
||
117 | /*#define USE_HAL_DRIVER */ |
||
118 | #endif /* USE_HAL_DRIVER */ |
||
119 | |||
120 | /** |
||
121 | * @brief CMSIS Device version number |
||
122 | */ |
||
123 | #define __STM32L1xx_CMSIS_VERSION_MAIN (0x02) /*!< [31:24] main version */ |
||
124 | #define __STM32L1xx_CMSIS_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */ |
||
125 | #define __STM32L1xx_CMSIS_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */ |
||
126 | #define __STM32L1xx_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */ |
||
127 | #define __STM32L1xx_CMSIS_VERSION ((__STM32L1xx_CMSIS_VERSION_MAIN << 24)\ |
||
128 | |(__STM32L1xx_CMSIS_VERSION_SUB1 << 16)\ |
||
129 | |(__STM32L1xx_CMSIS_VERSION_SUB2 << 8 )\ |
||
130 | |(__STM32L1xx_CMSIS_VERSION_RC)) |
||
131 | |||
132 | /** |
||
133 | * @} |
||
134 | */ |
||
135 | |||
136 | /** @addtogroup Device_Included |
||
137 | * @{ |
||
138 | */ |
||
139 | |||
140 | #if defined(STM32L100xB) |
||
141 | #include "stm32l100xb.h" |
||
142 | #elif defined(STM32L100xBA) |
||
143 | #include "stm32l100xba.h" |
||
144 | #elif defined(STM32L100xC) |
||
145 | #include "stm32l100xc.h" |
||
146 | #elif defined(STM32L151xB) |
||
147 | #include "stm32l151xb.h" |
||
148 | #elif defined(STM32L151xBA) |
||
149 | #include "stm32l151xba.h" |
||
150 | #elif defined(STM32L151xC) |
||
151 | #include "stm32l151xc.h" |
||
152 | #elif defined(STM32L151xCA) |
||
153 | #include "stm32l151xca.h" |
||
154 | #elif defined(STM32L151xD) |
||
155 | #include "stm32l151xd.h" |
||
156 | #elif defined(STM32L151xDX) |
||
157 | #include "stm32l151xdx.h" |
||
158 | #elif defined(STM32L151xE) |
||
159 | #include "stm32l151xe.h" |
||
160 | #elif defined(STM32L152xB) |
||
161 | #include "stm32l152xb.h" |
||
162 | #elif defined(STM32L152xBA) |
||
163 | #include "stm32l152xba.h" |
||
164 | #elif defined(STM32L152xC) |
||
165 | #include "stm32l152xc.h" |
||
166 | #elif defined(STM32L152xCA) |
||
167 | #include "stm32l152xca.h" |
||
168 | #elif defined(STM32L152xD) |
||
169 | #include "stm32l152xd.h" |
||
170 | #elif defined(STM32L152xDX) |
||
171 | #include "stm32l152xdx.h" |
||
172 | #elif defined(STM32L152xE) |
||
173 | #include "stm32l152xe.h" |
||
174 | #elif defined(STM32L162xC) |
||
175 | #include "stm32l162xc.h" |
||
176 | #elif defined(STM32L162xCA) |
||
177 | #include "stm32l162xca.h" |
||
178 | #elif defined(STM32L162xD) |
||
179 | #include "stm32l162xd.h" |
||
180 | #elif defined(STM32L162xDX) |
||
181 | #include "stm32l162xdx.h" |
||
182 | #elif defined(STM32L162xE) |
||
183 | #include "stm32l162xe.h" |
||
184 | #else |
||
185 | #error "Please select first the target STM32L1xx device used in your application (in stm32l1xx.h file)" |
||
186 | #endif |
||
187 | |||
188 | /** |
||
189 | * @} |
||
190 | */ |
||
191 | |||
192 | /** @addtogroup Exported_types |
||
193 | * @{ |
||
194 | */ |
||
195 | typedef enum |
||
196 | { |
||
197 | RESET = 0, |
||
198 | SET = !RESET |
||
199 | } FlagStatus, ITStatus; |
||
200 | |||
201 | typedef enum |
||
202 | { |
||
203 | DISABLE = 0, |
||
204 | ENABLE = !DISABLE |
||
205 | } FunctionalState; |
||
206 | #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) |
||
207 | |||
208 | typedef enum |
||
209 | { |
||
210 | ERROR = 0, |
||
211 | SUCCESS = !ERROR |
||
212 | } ErrorStatus; |
||
213 | |||
214 | /** |
||
215 | * @} |
||
216 | */ |
||
217 | |||
218 | |||
219 | /** @addtogroup Exported_macros |
||
220 | * @{ |
||
221 | */ |
||
222 | #define SET_BIT(REG, BIT) ((REG) |= (BIT)) |
||
223 | |||
224 | #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) |
||
225 | |||
226 | #define READ_BIT(REG, BIT) ((REG) & (BIT)) |
||
227 | |||
228 | #define CLEAR_REG(REG) ((REG) = (0x0)) |
||
229 | |||
230 | #define WRITE_REG(REG, VAL) ((REG) = (VAL)) |
||
231 | |||
232 | #define READ_REG(REG) ((REG)) |
||
233 | |||
234 | #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) |
||
235 | |||
236 | #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) |
||
237 | |||
238 | |||
239 | /** |
||
240 | * @} |
||
241 | */ |
||
242 | |||
243 | #if defined (USE_HAL_DRIVER) |
||
244 | #include "stm32l1xx_hal.h" |
||
245 | #endif /* USE_HAL_DRIVER */ |
||
246 | |||
247 | |||
248 | #ifdef __cplusplus |
||
249 | } |
||
250 | #endif /* __cplusplus */ |
||
251 | |||
252 | #endif /* __STM32L1xx_H */ |
||
253 | /** |
||
254 | * @} |
||
255 | */ |
||
256 | |||
257 | /** |
||
258 | * @} |
||
259 | */ |
||
260 | |||
261 | |||
262 | |||
263 | |||
264 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |