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>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> 20 * 21 * Redistribution and use in source and binary forms, with or without modification, 22 * are permitted provided that the following conditions are met: 23 * 1. Redistributions of source code must retain the above copyright notice, 24 * this list of conditions and the following disclaimer. 25 * 2. Redistributions in binary form must reproduce the above copyright notice, 26 * this list of conditions and the following disclaimer in the documentation 27 * and/or other materials provided with the distribution. 28 * 3. Neither the name of STMicroelectronics nor the names of its contributors 29 * may be used to endorse or promote products derived from this software 30 * without specific prior written permission. 31 * 32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 33 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 34 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 35 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 36 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 38 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 39 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 40 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 41 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 * 43 ****************************************************************************** 44 */ 45 46 /** @addtogroup CMSIS 47 * @{ 48 */ 49 50 /** @addtogroup stm32l4xx 51 * @{ 52 */ 53 54 #ifndef __STM32L4xx_H 55 #define __STM32L4xx_H 56 57 #ifdef __cplusplus 58 extern "C" { 59 #endif /* __cplusplus */ 60 61 /** @addtogroup Library_configuration_section 62 * @{ 63 */ 64 65 /** 66 * @brief STM32 Family 67 */ 68 #if !defined (STM32L4) 69 #define STM32L4 70 #endif /* STM32L4 */ 71 72 /* Uncomment the line below according to the target STM32L4 device used in your 73 application 74 */ 75 76 #if !defined (STM32L412xx) && !defined (STM32L422xx) && \ 77 !defined (STM32L431xx) && !defined (STM32L432xx) && !defined (STM32L433xx) && !defined (STM32L442xx) && !defined (STM32L443xx) && \ 78 !defined (STM32L451xx) && !defined (STM32L452xx) && !defined (STM32L462xx) && \ 79 !defined (STM32L471xx) && !defined (STM32L475xx) && !defined (STM32L476xx) && !defined (STM32L485xx) && !defined (STM32L486xx) && \ 80 !defined (STM32L496xx) && !defined (STM32L4A6xx) && \ 81 !defined (STM32L4R5xx) && !defined (STM32L4R7xx) && !defined (STM32L4R9xx) && !defined (STM32L4S5xx) && !defined (STM32L4S7xx) && !defined (STM32L4S9xx) 82 /* #define STM32L412xx */ /*!< STM32L412xx Devices */ 83 /* #define STM32L422xx */ /*!< STM32L422xx Devices */ 84 /* #define STM32L431xx */ /*!< STM32L431xx Devices */ 85 /* #define STM32L432xx */ /*!< STM32L432xx Devices */ 86 /* #define STM32L433xx */ /*!< STM32L433xx Devices */ 87 /* #define STM32L442xx */ /*!< STM32L442xx Devices */ 88 /* #define STM32L443xx */ /*!< STM32L443xx Devices */ 89 /* #define STM32L451xx */ /*!< STM32L451xx Devices */ 90 /* #define STM32L452xx */ /*!< STM32L452xx Devices */ 91 /* #define STM32L462xx */ /*!< STM32L462xx Devices */ 92 /* #define STM32L471xx */ /*!< STM32L471xx Devices */ 93 /* #define STM32L475xx */ /*!< STM32L475xx Devices */ 94 /* #define STM32L476xx */ /*!< STM32L476xx Devices */ 95 /* #define STM32L485xx */ /*!< STM32L485xx Devices */ 96 /* #define STM32L486xx */ /*!< STM32L486xx Devices */ 97 /* #define STM32L496xx */ /*!< STM32L496xx Devices */ 98 /* #define STM32L4A6xx */ /*!< STM32L4A6xx Devices */ 99 /* #define STM32L4R5xx */ /*!< STM32L4R5xx Devices */ 100 /* #define STM32L4R7xx */ /*!< STM32L4R7xx Devices */ 101 /* #define STM32L4R9xx */ /*!< STM32L4R9xx Devices */ 102 /* #define STM32L4S5xx */ /*!< STM32L4S5xx Devices */ 103 /* #define STM32L4S7xx */ /*!< STM32L4S7xx Devices */ 104 /* #define STM32L4S9xx */ /*!< STM32L4S9xx Devices */ 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 #if !defined (USE_HAL_DRIVER) 111 /** 112 * @brief Comment the line below if you will not use the peripherals drivers. 113 In this case, these drivers will not be included and the application code will 114 be based on direct access to peripherals registers 115 */ 116 /*#define USE_HAL_DRIVER */ 117 #endif /* USE_HAL_DRIVER */ 118 119 /** 120 * @brief CMSIS Device version number 121 */ 122 #define __STM32L4_CMSIS_VERSION_MAIN (0x01) /*!< [31:24] main version */ 123 #define __STM32L4_CMSIS_VERSION_SUB1 (0x05) /*!< [23:16] sub1 version */ 124 #define __STM32L4_CMSIS_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */ 125 #define __STM32L4_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */ 126 #define __STM32L4_CMSIS_VERSION ((__STM32L4_CMSIS_VERSION_MAIN << 24)\ 127 |(__STM32L4_CMSIS_VERSION_SUB1 << 16)\ 128 |(__STM32L4_CMSIS_VERSION_SUB2 << 8 )\ 129 |(__STM32L4_CMSIS_VERSION_RC)) 130 131 /** 132 * @} 133 */ 134 135 /** @addtogroup Device_Included 136 * @{ 137 */ 138 139 #if defined(STM32L412xx) 140 #include "stm32l412xx.h" 141 #elif defined(STM32L422xx) 142 #include "stm32l422xx.h" 143 #elif defined(STM32L431xx) 144 #include "stm32l431xx.h" 145 #elif defined(STM32L432xx) 146 #include "stm32l432xx.h" 147 #elif defined(STM32L433xx) 148 #include "stm32l433xx.h" 149 #elif defined(STM32L442xx) 150 #include "stm32l442xx.h" 151 #elif defined(STM32L443xx) 152 #include "stm32l443xx.h" 153 #elif defined(STM32L451xx) 154 #include "stm32l451xx.h" 155 #elif defined(STM32L452xx) 156 #include "stm32l452xx.h" 157 #elif defined(STM32L462xx) 158 #include "stm32l462xx.h" 159 #elif defined(STM32L471xx) 160 #include "stm32l471xx.h" 161 #elif defined(STM32L475xx) 162 #include "stm32l475xx.h" 163 #elif defined(STM32L476xx) 164 #include "stm32l476xx.h" 165 #elif defined(STM32L485xx) 166 #include "stm32l485xx.h" 167 #elif defined(STM32L486xx) 168 #include "stm32l486xx.h" 169 #elif defined(STM32L496xx) 170 #include "stm32l496xx.h" 171 #elif defined(STM32L4A6xx) 172 #include "stm32l4a6xx.h" 173 #elif defined(STM32L4R5xx) 174 #include "stm32l4r5xx.h" 175 #elif defined(STM32L4R7xx) 176 #include "stm32l4r7xx.h" 177 #elif defined(STM32L4R9xx) 178 #include "stm32l4r9xx.h" 179 #elif defined(STM32L4S5xx) 180 #include "stm32l4s5xx.h" 181 #elif defined(STM32L4S7xx) 182 #include "stm32l4s7xx.h" 183 #elif defined(STM32L4S9xx) 184 #include "stm32l4s9xx.h" 185 #else 186 #error "Please select first the target STM32L4xx device used in your application (in stm32l4xx.h file)" 187 #endif 188 189 /** 190 * @} 191 */ 192 193 /** @addtogroup Exported_types 194 * @{ 195 */ 196 typedef enum 197 { 198 RESET = 0, 199 SET = !RESET 200 } FlagStatus, ITStatus; 201 202 typedef enum 203 { 204 DISABLE = 0, 205 ENABLE = !DISABLE 206 } FunctionalState; 207 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) 208 209 typedef enum 210 { 211 ERROR = 0, 212 SUCCESS = !ERROR 213 } ErrorStatus; 214 215 /** 216 * @} 217 */ 218 219 220 /** @addtogroup Exported_macros 221 * @{ 222 */ 223 #define SET_BIT(REG, BIT) ((REG) |= (BIT)) 224 225 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) 226 227 #define READ_BIT(REG, BIT) ((REG) & (BIT)) 228 229 #define CLEAR_REG(REG) ((REG) = (0x0)) 230 231 #define WRITE_REG(REG, VAL) ((REG) = (VAL)) 232 233 #define READ_REG(REG) ((REG)) 234 235 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) 236 237 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) 238 239 240 /** 241 * @} 242 */ 243 244 #if defined (USE_HAL_DRIVER) 245 #include "stm32l4xx_hal.h" 246 #endif /* USE_HAL_DRIVER */ 247 248 #ifdef __cplusplus 249 } 250 #endif /* __cplusplus */ 251 252 #endif /* __STM32L4xx_H */ 253 /** 254 * @} 255 */ 256 257 /** 258 * @} 259 */ 260 261 262 263 264 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 265