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