|
| 1 | +/** |
| 2 | + ****************************************************************************** |
| 3 | + * @file stm32l0xx.h |
| 4 | + * @author MCD Application Team |
| 5 | + * @version V1.7.1 |
| 6 | + * @date 25-November-2016 |
| 7 | + * @brief CMSIS Cortex-M0+ Device Peripheral Access Layer Header File. |
| 8 | + * This file contains all the peripheral register's definitions, bits |
| 9 | + * definitions and memory mapping for STM32L0xx devices. |
| 10 | + * |
| 11 | + * The file is the unique include file that the application programmer |
| 12 | + * is using in the C source code, usually in main.c. This file contains: |
| 13 | + * - Configuration section that allows to select: |
| 14 | + * - The device used in the target application |
| 15 | + * - To use or not the peripheral's drivers in application code(i.e. |
| 16 | + * code will be based on direct access to peripheral's registers |
| 17 | + * rather than drivers API), this option is controlled by |
| 18 | + * "#define USE_HAL_DRIVER" |
| 19 | + * |
| 20 | + ****************************************************************************** |
| 21 | + * @attention |
| 22 | + * |
| 23 | + * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
| 24 | + * |
| 25 | + * Redistribution and use in source and binary forms, with or without modification, |
| 26 | + * are permitted provided that the following conditions are met: |
| 27 | + * 1. Redistributions of source code must retain the above copyright notice, |
| 28 | + * this list of conditions and the following disclaimer. |
| 29 | + * 2. Redistributions in binary form must reproduce the above copyright notice, |
| 30 | + * this list of conditions and the following disclaimer in the documentation |
| 31 | + * and/or other materials provided with the distribution. |
| 32 | + * 3. Neither the name of STMicroelectronics nor the names of its contributors |
| 33 | + * may be used to endorse or promote products derived from this software |
| 34 | + * without specific prior written permission. |
| 35 | + * |
| 36 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 37 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 38 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 39 | + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 40 | + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 41 | + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 42 | + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 43 | + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 44 | + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 45 | + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 46 | + * |
| 47 | + ****************************************************************************** |
| 48 | + */ |
| 49 | + |
| 50 | +/** @addtogroup CMSIS |
| 51 | + * @{ |
| 52 | + */ |
| 53 | + |
| 54 | +/** @addtogroup stm32l0xx |
| 55 | + * @{ |
| 56 | + */ |
| 57 | + |
| 58 | +#ifndef __STM32L0xx_H |
| 59 | +#define __STM32L0xx_H |
| 60 | + |
| 61 | +#ifdef __cplusplus |
| 62 | + extern "C" { |
| 63 | +#endif /* __cplusplus */ |
| 64 | + |
| 65 | +/** @addtogroup Library_configuration_section |
| 66 | + * @{ |
| 67 | + */ |
| 68 | + |
| 69 | +/** |
| 70 | + * @brief STM32 Family |
| 71 | + */ |
| 72 | +#if !defined (STM32L0) |
| 73 | +#define STM32L0 |
| 74 | +#endif /* STM32L0 */ |
| 75 | + |
| 76 | +/* Uncomment the line below according to the target STM32 device used in your |
| 77 | + application |
| 78 | + */ |
| 79 | + |
| 80 | +#if !defined (STM32L011xx) && !defined (STM32L021xx) && \ |
| 81 | + !defined (STM32L031xx) && !defined (STM32L041xx) && \ |
| 82 | + !defined (STM32L051xx) && !defined (STM32L052xx) && !defined (STM32L053xx) && \ |
| 83 | + !defined (STM32L061xx) && !defined (STM32L062xx) && !defined (STM32L063xx) && \ |
| 84 | + !defined (STM32L071xx) && !defined (STM32L072xx) && !defined (STM32L073xx) && \ |
| 85 | + !defined (STM32L081xx) && !defined (STM32L082xx) && !defined (STM32L083xx) \ |
| 86 | + /* #define STM32L011xx */ |
| 87 | + /* #define STM32L021xx */ |
| 88 | + /* #define STM32L031xx */ /*!< STM32L031C6, STM32L031E6, STM32L031F6, STM32L031G6, STM32L031K6 Devices */ |
| 89 | + /* #define STM32L041xx */ /*!< STM32L041C6, STM32L041E6, STM32L041F6, STM32L041G6, STM32L041K6 Devices */ |
| 90 | + /* #define STM32L051xx */ /*!< STM32L051K8, STM32L051C6, STM32L051C8, STM32L051R6, STM32L051R8 Devices */ |
| 91 | + /* #define STM32L052xx */ /*!< STM32L052K6, STM32L052K8, STM32L052C6, STM32L052C8, STM32L052R6, STM32L052R8 Devices */ |
| 92 | + /* #define STM32L053xx */ /*!< STM32L053C6, STM32L053C8, STM32L053R6, STM32L053R8 Devices */ |
| 93 | + /* #define STM32L061xx */ /*!< */ |
| 94 | + /* #define STM32L062xx */ /*!< STM32L062K8 */ |
| 95 | + /* #define STM32L063xx */ /*!< STM32L063C8, STM32L063R8 */ |
| 96 | + /* #define STM32L071xx */ /*!< */ |
| 97 | + /* #define STM32L072xx */ /*!< */ |
| 98 | + /* #define STM32L073xx */ /*!< STM32L073V8, STM32L073VB, STM32L073RB, STM32L073VZ, STM32L073RZ Devices */ |
| 99 | + /* #define STM32L081xx */ /*!< */ |
| 100 | + /* #define STM32L082xx */ /*!< */ |
| 101 | + /* #define STM32L083xx */ /*!< */ |
| 102 | +#endif |
| 103 | + |
| 104 | +/* Tip: To avoid modifying this file each time you need to switch between these |
| 105 | + devices, you can define the device in your toolchain compiler preprocessor. |
| 106 | + */ |
| 107 | +#if !defined (USE_HAL_DRIVER) |
| 108 | +/** |
| 109 | + * @brief Comment the line below if you will not use the peripherals drivers. |
| 110 | + In this case, these drivers will not be included and the application code will |
| 111 | + be based on direct access to peripherals registers |
| 112 | + */ |
| 113 | + /*#define USE_HAL_DRIVER */ |
| 114 | +#endif /* USE_HAL_DRIVER */ |
| 115 | + |
| 116 | +/** |
| 117 | + * @brief CMSIS Device version number V1.7.1 |
| 118 | + */ |
| 119 | +#define __STM32L0xx_CMSIS_VERSION_MAIN (0x01) /*!< [31:24] main version */ |
| 120 | +#define __STM32L0xx_CMSIS_VERSION_SUB1 (0x07) /*!< [23:16] sub1 version */ |
| 121 | +#define __STM32L0xx_CMSIS_VERSION_SUB2 (0x01) /*!< [15:8] sub2 version */ |
| 122 | +#define __STM32L0xx_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */ |
| 123 | +#define __STM32L0xx_CMSIS_VERSION ((__STM32L0xx_CMSIS_VERSION_MAIN << 24)\ |
| 124 | + |(__STM32L0xx_CMSIS_VERSION_SUB1 << 16)\ |
| 125 | + |(__STM32L0xx_CMSIS_VERSION_SUB2 << 8 )\ |
| 126 | + |(__STM32L0xx_CMSIS_VERSION_RC)) |
| 127 | + |
| 128 | +/** |
| 129 | + * @} |
| 130 | + */ |
| 131 | + |
| 132 | +/** @addtogroup Device_Included |
| 133 | + * @{ |
| 134 | + */ |
| 135 | +#if defined(STM32L011xx) |
| 136 | + #include "stm32l011xx.h" |
| 137 | +#elif defined(STM32L021xx) |
| 138 | + #include "stm32l021xx.h" |
| 139 | +#elif defined(STM32L031xx) |
| 140 | + #include "stm32l031xx.h" |
| 141 | +#elif defined(STM32L041xx) |
| 142 | + #include "stm32l041xx.h" |
| 143 | +#elif defined(STM32L051xx) |
| 144 | + #include "stm32l051xx.h" |
| 145 | +#elif defined(STM32L052xx) |
| 146 | + #include "stm32l052xx.h" |
| 147 | +#elif defined(STM32L053xx) |
| 148 | + #include "stm32l053xx.h" |
| 149 | +#elif defined(STM32L062xx) |
| 150 | + #include "stm32l062xx.h" |
| 151 | +#elif defined(STM32L063xx) |
| 152 | + #include "stm32l063xx.h" |
| 153 | +#elif defined(STM32L061xx) |
| 154 | + #include "stm32l061xx.h" |
| 155 | +#elif defined(STM32L071xx) |
| 156 | + #include "stm32l071xx.h" |
| 157 | +#elif defined(STM32L072xx) |
| 158 | + #include "stm32l072xx.h" |
| 159 | +#elif defined(STM32L073xx) |
| 160 | + #include "stm32l073xx.h" |
| 161 | +#elif defined(STM32L082xx) |
| 162 | + #include "stm32l082xx.h" |
| 163 | +#elif defined(STM32L083xx) |
| 164 | + #include "stm32l083xx.h" |
| 165 | +#elif defined(STM32L081xx) |
| 166 | + #include "stm32l081xx.h" |
| 167 | +#else |
| 168 | + #error "Please select first the target STM32L0xx device used in your application (in stm32l0xx.h file)" |
| 169 | +#endif |
| 170 | + |
| 171 | +/** |
| 172 | + * @} |
| 173 | + */ |
| 174 | + |
| 175 | +/** @addtogroup Exported_types |
| 176 | + * @{ |
| 177 | + */ |
| 178 | +typedef enum |
| 179 | +{ |
| 180 | + RESET = 0, |
| 181 | + SET = !RESET |
| 182 | +} FlagStatus, ITStatus; |
| 183 | + |
| 184 | +typedef enum |
| 185 | +{ |
| 186 | + DISABLE = 0, |
| 187 | + ENABLE = !DISABLE |
| 188 | +} FunctionalState; |
| 189 | +#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) |
| 190 | + |
| 191 | +typedef enum |
| 192 | +{ |
| 193 | + ERROR = 0, |
| 194 | + SUCCESS = !ERROR |
| 195 | +} ErrorStatus; |
| 196 | + |
| 197 | +/** |
| 198 | + * @} |
| 199 | + */ |
| 200 | + |
| 201 | + |
| 202 | +/** @addtogroup Exported_macro |
| 203 | + * @{ |
| 204 | + */ |
| 205 | +#define SET_BIT(REG, BIT) ((REG) |= (BIT)) |
| 206 | + |
| 207 | +#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) |
| 208 | + |
| 209 | +#define READ_BIT(REG, BIT) ((REG) & (BIT)) |
| 210 | + |
| 211 | +#define CLEAR_REG(REG) ((REG) = (0x0)) |
| 212 | + |
| 213 | +#define WRITE_REG(REG, VAL) ((REG) = (VAL)) |
| 214 | + |
| 215 | +#define READ_REG(REG) ((REG)) |
| 216 | + |
| 217 | +#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) |
| 218 | + |
| 219 | +/** |
| 220 | + * @} |
| 221 | + */ |
| 222 | + |
| 223 | +#if defined (USE_HAL_DRIVER) |
| 224 | + #include "stm32l0xx_hal.h" |
| 225 | +#endif /* USE_HAL_DRIVER */ |
| 226 | + |
| 227 | +#ifdef __cplusplus |
| 228 | +} |
| 229 | +#endif /* __cplusplus */ |
| 230 | + |
| 231 | +#endif /* __STM32L0xx_H */ |
| 232 | +/** |
| 233 | + * @} |
| 234 | + */ |
| 235 | + |
| 236 | +/** |
| 237 | + * @} |
| 238 | + */ |
| 239 | + |
| 240 | + |
| 241 | + |
| 242 | + |
| 243 | +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
0 commit comments