mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Wed Feb 20 22:31:08 2019 +0000
Revision:
189:f392fc9709a3
Parent:
186:707f6e361f3e
mbed library release version 165

Who changed what in which revision?

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