1 /**
2   ******************************************************************************
3   * @file    stm32l4xx.h
4   * @author  MCD Application Team
5   * @brief   CMSIS STM32L4xx 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 STM32L4xx 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   *
19   * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
20   * All rights reserved.</center></h2>
21   *
22   * This software component is licensed by ST under Apache License, Version 2.0,
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/Apache-2.0
26   *
27   ******************************************************************************
28   */
29 
30 /** @addtogroup CMSIS
31   * @{
32   */
33 
34 /** @addtogroup stm32l4xx
35   * @{
36   */
37 
38 #ifndef __STM32L4xx_H
39 #define __STM32L4xx_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 (STM32L4)
53 #define STM32L4
54 #endif /* STM32L4 */
55 
56 /* Uncomment the line below according to the target STM32L4 device used in your
57    application
58   */
59 
60 #if !defined (STM32L412xx) && !defined (STM32L422xx) && \
61     !defined (STM32L431xx) && !defined (STM32L432xx) && !defined (STM32L433xx) && !defined (STM32L442xx) && !defined (STM32L443xx) && \
62     !defined (STM32L451xx) && !defined (STM32L452xx) && !defined (STM32L462xx) && \
63     !defined (STM32L471xx) && !defined (STM32L475xx) && !defined (STM32L476xx) && !defined (STM32L485xx) && !defined (STM32L486xx) && \
64     !defined (STM32L496xx) && !defined (STM32L4A6xx) && \
65     !defined (STM32L4P5xx) && !defined (STM32L4Q5xx) && \
66     !defined (STM32L4R5xx) && !defined (STM32L4R7xx) && !defined (STM32L4R9xx) && !defined (STM32L4S5xx) && !defined (STM32L4S7xx) && !defined (STM32L4S9xx)
67   /* #define STM32L412xx */   /*!< STM32L412xx Devices */
68   /* #define STM32L422xx */   /*!< STM32L422xx Devices */
69   /* #define STM32L431xx */   /*!< STM32L431xx Devices */
70   /* #define STM32L432xx */   /*!< STM32L432xx Devices */
71   /* #define STM32L433xx */   /*!< STM32L433xx Devices */
72   /* #define STM32L442xx */   /*!< STM32L442xx Devices */
73   /* #define STM32L443xx */   /*!< STM32L443xx Devices */
74   /* #define STM32L451xx */   /*!< STM32L451xx Devices */
75   /* #define STM32L452xx */   /*!< STM32L452xx Devices */
76   /* #define STM32L462xx */   /*!< STM32L462xx Devices */
77   /* #define STM32L471xx */   /*!< STM32L471xx Devices */
78   /* #define STM32L475xx */   /*!< STM32L475xx Devices */
79   /* #define STM32L476xx */   /*!< STM32L476xx Devices */
80   /* #define STM32L485xx */   /*!< STM32L485xx Devices */
81   /* #define STM32L486xx */   /*!< STM32L486xx Devices */
82   /* #define STM32L496xx */   /*!< STM32L496xx Devices */
83   /* #define STM32L4A6xx */   /*!< STM32L4A6xx Devices */
84   /* #define STM32L4P5xx */   /*!< STM32L4Q5xx Devices */
85   /* #define STM32L4R5xx */   /*!< STM32L4R5xx Devices */
86   /* #define STM32L4R7xx */   /*!< STM32L4R7xx Devices */
87   /* #define STM32L4R9xx */   /*!< STM32L4R9xx Devices */
88   /* #define STM32L4S5xx */   /*!< STM32L4S5xx Devices */
89   /* #define STM32L4S7xx */   /*!< STM32L4S7xx Devices */
90   /* #define STM32L4S9xx */   /*!< STM32L4S9xx Devices */
91 #endif
92 
93 /*  Tip: To avoid modifying this file each time you need to switch between these
94         devices, you can define the device in your toolchain compiler preprocessor.
95   */
96 #if !defined  (USE_HAL_DRIVER)
97 /**
98  * @brief Comment the line below if you will not use the peripherals drivers.
99    In this case, these drivers will not be included and the application code will
100    be based on direct access to peripherals registers
101    */
102   /*#define USE_HAL_DRIVER */
103 #endif /* USE_HAL_DRIVER */
104 
105 /**
106   * @brief CMSIS Device version number
107   */
108 #define __STM32L4_CMSIS_VERSION_MAIN   (0x01) /*!< [31:24] main version */
109 #define __STM32L4_CMSIS_VERSION_SUB1   (0x07) /*!< [23:16] sub1 version */
110 #define __STM32L4_CMSIS_VERSION_SUB2   (0x01) /*!< [15:8]  sub2 version */
111 #define __STM32L4_CMSIS_VERSION_RC     (0x00) /*!< [7:0]  release candidate */
112 #define __STM32L4_CMSIS_VERSION        ((__STM32L4_CMSIS_VERSION_MAIN << 24)\
113                                        |(__STM32L4_CMSIS_VERSION_SUB1 << 16)\
114                                        |(__STM32L4_CMSIS_VERSION_SUB2 << 8 )\
115                                        |(__STM32L4_CMSIS_VERSION_RC))
116 
117 /**
118   * @}
119   */
120 
121 /** @addtogroup Device_Included
122   * @{
123   */
124 
125 #if defined(STM32L412xx)
126   #include "stm32l412xx.h"
127 #elif defined(STM32L422xx)
128   #include "stm32l422xx.h"
129 #elif defined(STM32L431xx)
130   #include "stm32l431xx.h"
131 #elif defined(STM32L432xx)
132   #include "stm32l432xx.h"
133 #elif defined(STM32L433xx)
134   #include "stm32l433xx.h"
135 #elif defined(STM32L442xx)
136   #include "stm32l442xx.h"
137 #elif defined(STM32L443xx)
138   #include "stm32l443xx.h"
139 #elif defined(STM32L451xx)
140   #include "stm32l451xx.h"
141 #elif defined(STM32L452xx)
142   #include "stm32l452xx.h"
143 #elif defined(STM32L462xx)
144   #include "stm32l462xx.h"
145 #elif defined(STM32L471xx)
146   #include "stm32l471xx.h"
147 #elif defined(STM32L475xx)
148   #include "stm32l475xx.h"
149 #elif defined(STM32L476xx)
150   #include "stm32l476xx.h"
151 #elif defined(STM32L485xx)
152   #include "stm32l485xx.h"
153 #elif defined(STM32L486xx)
154   #include "stm32l486xx.h"
155 #elif defined(STM32L496xx)
156   #include "stm32l496xx.h"
157 #elif defined(STM32L4A6xx)
158   #include "stm32l4a6xx.h"
159 #elif defined(STM32L4P5xx)
160   #include "stm32l4p5xx.h"
161 #elif defined(STM32L4Q5xx)
162   #include "stm32l4q5xx.h"
163 #elif defined(STM32L4R5xx)
164   #include "stm32l4r5xx.h"
165 #elif defined(STM32L4R7xx)
166   #include "stm32l4r7xx.h"
167 #elif defined(STM32L4R9xx)
168   #include "stm32l4r9xx.h"
169 #elif defined(STM32L4S5xx)
170   #include "stm32l4s5xx.h"
171 #elif defined(STM32L4S7xx)
172   #include "stm32l4s7xx.h"
173 #elif defined(STM32L4S9xx)
174   #include "stm32l4s9xx.h"
175 #else
176  #error "Please select first the target STM32L4xx device used in your application (in stm32l4xx.h file)"
177 #endif
178 
179 /**
180   * @}
181   */
182 
183 /** @addtogroup Exported_types
184   * @{
185   */
186 typedef enum
187 {
188   RESET = 0,
189   SET = !RESET
190 } FlagStatus, ITStatus;
191 
192 typedef enum
193 {
194   DISABLE = 0,
195   ENABLE = !DISABLE
196 } FunctionalState;
197 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
198 
199 typedef enum
200 {
201   SUCCESS = 0,
202   ERROR = !SUCCESS
203 } ErrorStatus;
204 
205 /**
206   * @}
207   */
208 
209 
210 /** @addtogroup Exported_macros
211   * @{
212   */
213 #define SET_BIT(REG, BIT)     ((REG) |= (BIT))
214 
215 #define CLEAR_BIT(REG, BIT)   ((REG) &= ~(BIT))
216 
217 #define READ_BIT(REG, BIT)    ((REG) & (BIT))
218 
219 #define CLEAR_REG(REG)        ((REG) = (0x0))
220 
221 #define WRITE_REG(REG, VAL)   ((REG) = (VAL))
222 
223 #define READ_REG(REG)         ((REG))
224 
225 #define MODIFY_REG(REG, CLEARMASK, SETMASK)  WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
226 
227 #define POSITION_VAL(VAL)     (__CLZ(__RBIT(VAL)))
228 
229 
230 /**
231   * @}
232   */
233 
234 #if defined (USE_HAL_DRIVER)
235  #include "stm32l4xx_hal.h"
236 #endif /* USE_HAL_DRIVER */
237 
238 #ifdef __cplusplus
239 }
240 #endif /* __cplusplus */
241 
242 #endif /* __STM32L4xx_H */
243 /**
244   * @}
245   */
246 
247 /**
248   * @}
249   */
250 
251 
252 
253 
254 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
255