Rev 49 | Rev 61 | Go to most recent revision | Details | Compare with Previous | 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 | * @brief CMSIS STM32L1xx Device Peripheral Access Layer Header File. |
||
6 | * |
||
7 | * The file is the unique include file that the application programmer |
||
8 | * is using in the C source code, usually in main.c. This file contains: |
||
9 | * - Configuration section that allows to select: |
||
10 | * - The STM32L1xx device used in the target application |
||
11 | * - To use or not the peripheral’s drivers in application code(i.e. |
||
12 | * code will be based on direct access to peripheral’s registers |
||
13 | * rather than drivers API), this option is controlled by |
||
14 | * "#define USE_HAL_DRIVER" |
||
15 | * |
||
16 | ****************************************************************************** |
||
17 | * @attention |
||
18 | * |
||
50 | mjames | 19 | * <h2><center>© Copyright (c) 2017 STMicroelectronics. |
20 | * All rights reserved.</center></h2> |
||
30 | mjames | 21 | * |
50 | mjames | 22 | * This software component is licensed by ST under BSD 3-Clause license, |
23 | * the "License"; You may not use this file except in compliance with the |
||
24 | * License. You may obtain a copy of the License at: |
||
25 | * opensource.org/licenses/BSD-3-Clause |
||
30 | mjames | 26 | * |
27 | ****************************************************************************** |
||
28 | */ |
||
29 | |||
30 | /** @addtogroup CMSIS |
||
31 | * @{ |
||
32 | */ |
||
33 | |||
34 | /** @addtogroup stm32l1xx |
||
35 | * @{ |
||
36 | */ |
||
37 | |||
38 | #ifndef __STM32L1XX_H |
||
39 | #define __STM32L1XX_H |
||
40 | |||
41 | #ifdef __cplusplus |
||
42 | extern "C" { |
||
43 | #endif /* __cplusplus */ |
||
44 | |||
45 | /** @addtogroup Library_configuration_section |
||
46 | * @{ |
||
47 | */ |
||
48 | |||
49 | /** |
||
50 | * @brief STM32 Family |
||
51 | */ |
||
52 | #if !defined (STM32L1) |
||
53 | #define STM32L1 |
||
54 | #endif /* STM32L1 */ |
||
55 | |||
56 | |||
57 | /* Uncomment the line below according to the target STM32L device used in your |
||
58 | application |
||
59 | */ |
||
60 | |||
61 | #if !defined (STM32L100xB) && !defined (STM32L100xBA) && !defined (STM32L100xC) && \ |
||
62 | !defined (STM32L151xB) && !defined (STM32L151xBA) && !defined (STM32L151xC) && !defined (STM32L151xCA) && !defined (STM32L151xD) && !defined (STM32L151xDX) && !defined (STM32L151xE) && \ |
||
63 | !defined (STM32L152xB) && !defined (STM32L152xBA) && !defined (STM32L152xC) && !defined (STM32L152xCA) && !defined (STM32L152xD) && !defined (STM32L152xDX) && !defined (STM32L152xE) && \ |
||
64 | !defined (STM32L162xC) && !defined (STM32L162xCA) && !defined (STM32L162xD) && !defined (STM32L162xDX) && !defined (STM32L162xE) |
||
65 | /* #define STM32L100xB */ /*!< STM32L100C6, STM32L100R and STM32L100RB Devices */ |
||
66 | /* #define STM32L100xBA */ /*!< STM32L100C6-A, STM32L100R8-A and STM32L100RB-A Devices */ |
||
67 | /* #define STM32L100xC */ /*!< STM32L100RC Devices */ |
||
68 | /* #define STM32L151xB */ /*!< STM32L151C6, STM32L151R6, STM32L151C8, STM32L151R8, STM32L151V8, STM32L151CB, STM32L151RB and STM32L151VB */ |
||
69 | /* #define STM32L151xBA */ /*!< STM32L151C6-A, STM32L151R6-A, STM32L151C8-A, STM32L151R8-A, STM32L151V8-A, STM32L151CB-A, STM32L151RB-A and STM32L151VB-A */ |
||
70 | /* #define STM32L151xC */ /*!< STM32L151CC, STM32L151UC, STM32L151RC and STM32L151VC */ |
||
71 | /* #define STM32L151xCA */ /*!< STM32L151RC-A, STM32L151VC-A, STM32L151QC and STM32L151ZC */ |
||
72 | /* #define STM32L151xD */ /*!< STM32L151QD, STM32L151RD, STM32L151VD & STM32L151ZD */ |
||
73 | /* #define STM32L151xDX */ /*!< STM32L151VD-X Devices */ |
||
74 | /* #define STM32L151xE */ /*!< STM32L151QE, STM32L151RE, STM32L151VE and STM32L151ZE */ |
||
75 | /* #define STM32L152xB */ /*!< STM32L152C6, STM32L152R6, STM32L152C8, STM32L152R8, STM32L152V8, STM32L152CB, STM32L152RB and STM32L152VB */ |
||
76 | /* #define STM32L152xBA */ /*!< STM32L152C6-A, STM32L152R6-A, STM32L152C8-A, STM32L152R8-A, STM32L152V8-A, STM32L152CB-A, STM32L152RB-A and STM32L152VB-A */ |
||
77 | /* #define STM32L152xC */ /*!< STM32L152CC, STM32L152UC, STM32L152RC and STM32L152VC */ |
||
78 | /* #define STM32L152xCA */ /*!< STM32L152RC-A, STM32L152VC-A, STM32L152QC and STM32L152ZC */ |
||
79 | /* #define STM32L152xD */ /*!< STM32L152QD, STM32L152RD, STM32L152VD and STM32L152ZD */ |
||
80 | /* #define STM32L152xDX */ /*!< STM32L152VD-X Devices */ |
||
81 | /* #define STM32L152xE */ /*!< STM32L152QE, STM32L152RE, STM32L152VE and STM32L152ZE */ |
||
82 | /* #define STM32L162xC */ /*!< STM32L162RC and STM32L162VC */ |
||
83 | /* #define STM32L162xCA */ /*!< STM32L162RC-A, STM32L162VC-A, STM32L162QC and STM32L162ZC */ |
||
84 | /* #define STM32L162xD */ /*!< STM32L162QD, STM32L162RD, STM32L162VD and STM32L162ZD */ |
||
85 | /* #define STM32L162xDX */ /*!< STM32L162VD-X Devices */ |
||
86 | /* #define STM32L162xE */ /*!< STM32L162RE, STM32L162VE and STM32L162ZE */ |
||
87 | #endif |
||
88 | |||
89 | /* Tip: To avoid modifying this file each time you need to switch between these |
||
90 | devices, you can define the device in your toolchain compiler preprocessor. |
||
91 | */ |
||
92 | |||
93 | #if !defined (USE_HAL_DRIVER) |
||
94 | /** |
||
95 | * @brief Comment the line below if you will not use the peripherals drivers. |
||
96 | In this case, these drivers will not be included and the application code will |
||
97 | be based on direct access to peripherals registers |
||
98 | */ |
||
99 | /*#define USE_HAL_DRIVER */ |
||
100 | #endif /* USE_HAL_DRIVER */ |
||
101 | |||
102 | /** |
||
50 | mjames | 103 | * @brief CMSIS Device version number V2.3.1 |
30 | mjames | 104 | */ |
50 | mjames | 105 | #define __STM32L1xx_CMSIS_VERSION_MAIN (0x02) /*!< [31:24] main version */ |
106 | #define __STM32L1xx_CMSIS_VERSION_SUB1 (0x03) /*!< [23:16] sub1 version */ |
||
107 | #define __STM32L1xx_CMSIS_VERSION_SUB2 (0x01) /*!< [15:8] sub2 version */ |
||
30 | mjames | 108 | #define __STM32L1xx_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */ |
109 | #define __STM32L1xx_CMSIS_VERSION ((__STM32L1xx_CMSIS_VERSION_MAIN << 24)\ |
||
110 | |(__STM32L1xx_CMSIS_VERSION_SUB1 << 16)\ |
||
111 | |(__STM32L1xx_CMSIS_VERSION_SUB2 << 8 )\ |
||
112 | |(__STM32L1xx_CMSIS_VERSION_RC)) |
||
113 | |||
114 | /** |
||
115 | * @} |
||
116 | */ |
||
117 | |||
118 | /** @addtogroup Device_Included |
||
119 | * @{ |
||
120 | */ |
||
121 | |||
122 | #if defined(STM32L100xB) |
||
123 | #include "stm32l100xb.h" |
||
124 | #elif defined(STM32L100xBA) |
||
125 | #include "stm32l100xba.h" |
||
126 | #elif defined(STM32L100xC) |
||
127 | #include "stm32l100xc.h" |
||
128 | #elif defined(STM32L151xB) |
||
129 | #include "stm32l151xb.h" |
||
130 | #elif defined(STM32L151xBA) |
||
131 | #include "stm32l151xba.h" |
||
132 | #elif defined(STM32L151xC) |
||
133 | #include "stm32l151xc.h" |
||
134 | #elif defined(STM32L151xCA) |
||
135 | #include "stm32l151xca.h" |
||
136 | #elif defined(STM32L151xD) |
||
137 | #include "stm32l151xd.h" |
||
138 | #elif defined(STM32L151xDX) |
||
139 | #include "stm32l151xdx.h" |
||
140 | #elif defined(STM32L151xE) |
||
141 | #include "stm32l151xe.h" |
||
142 | #elif defined(STM32L152xB) |
||
143 | #include "stm32l152xb.h" |
||
144 | #elif defined(STM32L152xBA) |
||
145 | #include "stm32l152xba.h" |
||
146 | #elif defined(STM32L152xC) |
||
147 | #include "stm32l152xc.h" |
||
148 | #elif defined(STM32L152xCA) |
||
149 | #include "stm32l152xca.h" |
||
150 | #elif defined(STM32L152xD) |
||
151 | #include "stm32l152xd.h" |
||
152 | #elif defined(STM32L152xDX) |
||
153 | #include "stm32l152xdx.h" |
||
154 | #elif defined(STM32L152xE) |
||
155 | #include "stm32l152xe.h" |
||
156 | #elif defined(STM32L162xC) |
||
157 | #include "stm32l162xc.h" |
||
158 | #elif defined(STM32L162xCA) |
||
159 | #include "stm32l162xca.h" |
||
160 | #elif defined(STM32L162xD) |
||
161 | #include "stm32l162xd.h" |
||
162 | #elif defined(STM32L162xDX) |
||
163 | #include "stm32l162xdx.h" |
||
164 | #elif defined(STM32L162xE) |
||
165 | #include "stm32l162xe.h" |
||
166 | #else |
||
167 | #error "Please select first the target STM32L1xx device used in your application (in stm32l1xx.h file)" |
||
168 | #endif |
||
169 | |||
170 | /** |
||
171 | * @} |
||
172 | */ |
||
173 | |||
174 | /** @addtogroup Exported_types |
||
175 | * @{ |
||
176 | */ |
||
177 | typedef enum |
||
178 | { |
||
179 | RESET = 0, |
||
180 | SET = !RESET |
||
181 | } FlagStatus, ITStatus; |
||
182 | |||
183 | typedef enum |
||
184 | { |
||
185 | DISABLE = 0, |
||
186 | ENABLE = !DISABLE |
||
187 | } FunctionalState; |
||
188 | #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) |
||
189 | |||
190 | typedef enum |
||
191 | { |
||
50 | mjames | 192 | SUCCESS = 0, |
193 | ERROR = !SUCCESS |
||
30 | mjames | 194 | } ErrorStatus; |
195 | |||
196 | /** |
||
197 | * @} |
||
198 | */ |
||
199 | |||
200 | |||
201 | /** @addtogroup Exported_macros |
||
202 | * @{ |
||
203 | */ |
||
204 | #define SET_BIT(REG, BIT) ((REG) |= (BIT)) |
||
205 | |||
206 | #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) |
||
207 | |||
208 | #define READ_BIT(REG, BIT) ((REG) & (BIT)) |
||
209 | |||
210 | #define CLEAR_REG(REG) ((REG) = (0x0)) |
||
211 | |||
212 | #define WRITE_REG(REG, VAL) ((REG) = (VAL)) |
||
213 | |||
214 | #define READ_REG(REG) ((REG)) |
||
215 | |||
216 | #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) |
||
217 | |||
218 | #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) |
||
219 | |||
220 | |||
221 | /** |
||
222 | * @} |
||
223 | */ |
||
224 | |||
225 | #if defined (USE_HAL_DRIVER) |
||
226 | #include "stm32l1xx_hal.h" |
||
227 | #endif /* USE_HAL_DRIVER */ |
||
228 | |||
229 | |||
230 | #ifdef __cplusplus |
||
231 | } |
||
232 | #endif /* __cplusplus */ |
||
233 | |||
234 | #endif /* __STM32L1xx_H */ |
||
235 | /** |
||
236 | * @} |
||
237 | */ |
||
238 | |||
239 | /** |
||
240 | * @} |
||
241 | */ |
||
242 | |||
243 | |||
244 | |||
245 | |||
246 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |