mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Wed Jul 01 09:45:11 2015 +0100
Revision:
579:53297373a894
Parent:
522:aee49fe30179
Synchronized with git revision d5b4d2ab9c47edb4dc5776e7177b0c2263459081

Full URL: https://github.com/mbedmicro/mbed/commit/d5b4d2ab9c47edb4dc5776e7177b0c2263459081/

Initial version of drivers for SAMR21

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 522:aee49fe30179 1 /**
mbed_official 522:aee49fe30179 2 ******************************************************************************
mbed_official 522:aee49fe30179 3 * @file stm32l1xx.h
mbed_official 522:aee49fe30179 4 * @author MCD Application Team
mbed_official 522:aee49fe30179 5 * @version V2.0.0
mbed_official 522:aee49fe30179 6 * @date 5-September-2014
mbed_official 522:aee49fe30179 7 * @brief CMSIS STM32L1xx Device Peripheral Access Layer Header File.
mbed_official 522:aee49fe30179 8 *
mbed_official 522:aee49fe30179 9 * The file is the unique include file that the application programmer
mbed_official 522:aee49fe30179 10 * is using in the C source code, usually in main.c. This file contains:
mbed_official 522:aee49fe30179 11 * - Configuration section that allows to select:
mbed_official 522:aee49fe30179 12 * - The STM32L1xx device used in the target application
mbed_official 522:aee49fe30179 13 * - To use or not the peripheral’s drivers in application code(i.e.
mbed_official 522:aee49fe30179 14 * code will be based on direct access to peripheral’s registers
mbed_official 522:aee49fe30179 15 * rather than drivers API), this option is controlled by
mbed_official 522:aee49fe30179 16 * "#define USE_HAL_DRIVER"
mbed_official 522:aee49fe30179 17 *
mbed_official 522:aee49fe30179 18 ******************************************************************************
mbed_official 522:aee49fe30179 19 * @attention
mbed_official 522:aee49fe30179 20 *
mbed_official 522:aee49fe30179 21 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 522:aee49fe30179 22 *
mbed_official 522:aee49fe30179 23 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 522:aee49fe30179 24 * are permitted provided that the following conditions are met:
mbed_official 522:aee49fe30179 25 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 522:aee49fe30179 26 * this list of conditions and the following disclaimer.
mbed_official 522:aee49fe30179 27 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 522:aee49fe30179 28 * this list of conditions and the following disclaimer in the documentation
mbed_official 522:aee49fe30179 29 * and/or other materials provided with the distribution.
mbed_official 522:aee49fe30179 30 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 522:aee49fe30179 31 * may be used to endorse or promote products derived from this software
mbed_official 522:aee49fe30179 32 * without specific prior written permission.
mbed_official 522:aee49fe30179 33 *
mbed_official 522:aee49fe30179 34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 522:aee49fe30179 35 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 522:aee49fe30179 36 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 522:aee49fe30179 37 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 522:aee49fe30179 38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 522:aee49fe30179 39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 522:aee49fe30179 40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 522:aee49fe30179 41 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 522:aee49fe30179 42 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 522:aee49fe30179 43 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 522:aee49fe30179 44 *
mbed_official 522:aee49fe30179 45 ******************************************************************************
mbed_official 522:aee49fe30179 46 */
mbed_official 522:aee49fe30179 47
mbed_official 522:aee49fe30179 48 /** @addtogroup CMSIS
mbed_official 522:aee49fe30179 49 * @{
mbed_official 522:aee49fe30179 50 */
mbed_official 522:aee49fe30179 51
mbed_official 522:aee49fe30179 52 /** @addtogroup stm32l1xx
mbed_official 522:aee49fe30179 53 * @{
mbed_official 522:aee49fe30179 54 */
mbed_official 522:aee49fe30179 55
mbed_official 522:aee49fe30179 56 #ifndef __STM32L1XX_H
mbed_official 522:aee49fe30179 57 #define __STM32L1XX_H
mbed_official 522:aee49fe30179 58
mbed_official 522:aee49fe30179 59 #ifdef __cplusplus
mbed_official 522:aee49fe30179 60 extern "C" {
mbed_official 522:aee49fe30179 61 #endif /* __cplusplus */
mbed_official 522:aee49fe30179 62
mbed_official 522:aee49fe30179 63 /** @addtogroup Library_configuration_section
mbed_official 522:aee49fe30179 64 * @{
mbed_official 522:aee49fe30179 65 */
mbed_official 522:aee49fe30179 66
mbed_official 522:aee49fe30179 67 /* Uncomment the line below according to the target STM32L device used in your
mbed_official 522:aee49fe30179 68 application
mbed_official 522:aee49fe30179 69 */
mbed_official 522:aee49fe30179 70
mbed_official 522:aee49fe30179 71 #if !defined (STM32L100xB) && !defined (STM32L100xBA) && !defined (STM32L100xC) && \
mbed_official 522:aee49fe30179 72 !defined (STM32L151xB) && !defined (STM32L151xBA) && !defined (STM32L151xC) && !defined (STM32L151xCA) && !defined (STM32L151xD) && !defined (STM32L151xE) && \
mbed_official 522:aee49fe30179 73 !defined (STM32L152xB) && !defined (STM32L152xBA) && !defined (STM32L152xC) && !defined (STM32L152xCA) && !defined (STM32L152xD) && !defined (STM32L152xE) && \
mbed_official 522:aee49fe30179 74 !defined (STM32L162xC) && !defined (STM32L162xCA) && !defined (STM32L162xD) && !defined (STM32L162xE)
mbed_official 522:aee49fe30179 75 /* #define STM32L100xB */ /*!< STM32L100C6, STM32L100R and STM32L100RB Devices */
mbed_official 522:aee49fe30179 76 /* #define STM32L100xBA */ /*!< STM32L100C6-A, STM32L100R8-A and STM32L100RB-A Devices */
mbed_official 522:aee49fe30179 77 /* #define STM32L100xC */ /*!< STM32L100RC Devices */
mbed_official 522:aee49fe30179 78 /* #define STM32L151xB */ /*!< STM32L151C6, STM32L151R6, STM32L151C8, STM32L151R8, STM32L151V8, STM32L151CB, STM32L151RB and STM32L151VB */
mbed_official 522:aee49fe30179 79 /* #define STM32L151xBA */ /*!< STM32L151C6-A, STM32L151R6-A, STM32L151C8-A, STM32L151R8-A, STM32L151V8-A, STM32L151CB-A, STM32L151RB-A and STM32L151VB-A */
mbed_official 522:aee49fe30179 80 /* #define STM32L151xC */ /*!< STM32L151CC, STM32L151UC, STM32L151RC and STM32L151VC */
mbed_official 522:aee49fe30179 81 /* #define STM32L151xCA */ /*!< STM32L151RC-A, STM32L151VC-A, STM32L151QC and STM32L151ZC */
mbed_official 522:aee49fe30179 82 /* #define STM32L151xD */ /*!< STM32L151QD, STM32L151RD, STM32L151VD & STM32L151ZD */
mbed_official 522:aee49fe30179 83 /* #define STM32L151xE */ /*!< STM32L151QE, STM32L151RE, STM32L151VE and STM32L151ZE */
mbed_official 522:aee49fe30179 84 /* #define STM32L152xB */ /*!< STM32L152C6, STM32L152R6, STM32L152C8, STM32L152R8, STM32L152V8, STM32L152CB, STM32L152RB and STM32L152VB */
mbed_official 522:aee49fe30179 85 /* #define STM32L152xBA */ /*!< STM32L152C6-A, STM32L152R6-A, STM32L152C8-A, STM32L152R8-A, STM32L152V8-A, STM32L152CB-A, STM32L152RB-A and STM32L152VB-A */
mbed_official 522:aee49fe30179 86 #define STM32L152xC /*!< STM32L152CC, STM32L152UC, STM32L152RC and STM32L152VC */
mbed_official 522:aee49fe30179 87 /* #define STM32L152xCA */ /*!< STM32L152RC-A, STM32L152VC-A, STM32L152QC and STM32L152ZC */
mbed_official 522:aee49fe30179 88 /* #define STM32L152xD */ /*!< STM32L152QD, STM32L152RD, STM32L152VD and STM32L152ZD */
mbed_official 522:aee49fe30179 89 /* #define STM32L152xE */ /*!< STM32L152QE, STM32L152RE, STM32L152VE and STM32L152ZE */
mbed_official 522:aee49fe30179 90 /* #define STM32L162xC */ /*!< STM32L162RC and STM32L162VC */
mbed_official 522:aee49fe30179 91 /* #define STM32L162xCA */ /*!< STM32L162RC-A, STM32L162VC-A, STM32L162QC and STM32L162ZC */
mbed_official 522:aee49fe30179 92 /* #define STM32L162xD */ /*!< STM32L162QD, STM32L162RD, STM32L162VD and STM32L162ZD */
mbed_official 522:aee49fe30179 93 /* #define STM32L162xE */ /*!< STM32L162RE, STM32L162VE and STM32L162ZE */
mbed_official 522:aee49fe30179 94 #endif
mbed_official 522:aee49fe30179 95
mbed_official 522:aee49fe30179 96 /* Tip: To avoid modifying this file each time you need to switch between these
mbed_official 522:aee49fe30179 97 devices, you can define the device in your toolchain compiler preprocessor.
mbed_official 522:aee49fe30179 98 */
mbed_official 522:aee49fe30179 99
mbed_official 522:aee49fe30179 100 #if !defined (USE_HAL_DRIVER)
mbed_official 522:aee49fe30179 101 /**
mbed_official 522:aee49fe30179 102 * @brief Comment the line below if you will not use the peripherals drivers.
mbed_official 522:aee49fe30179 103 In this case, these drivers will not be included and the application code will
mbed_official 522:aee49fe30179 104 be based on direct access to peripherals registers
mbed_official 522:aee49fe30179 105 */
mbed_official 522:aee49fe30179 106 #define USE_HAL_DRIVER
mbed_official 522:aee49fe30179 107 #endif /* USE_HAL_DRIVER */
mbed_official 522:aee49fe30179 108
mbed_official 522:aee49fe30179 109 /**
mbed_official 522:aee49fe30179 110 * @brief CMSIS Device version number V2.0.0
mbed_official 522:aee49fe30179 111 */
mbed_official 522:aee49fe30179 112 #define __STM32L1xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
mbed_official 522:aee49fe30179 113 #define __STM32L1xx_CMSIS_DEVICE_VERSION_SUB1 (0x00) /*!< [23:16] sub1 version */
mbed_official 522:aee49fe30179 114 #define __STM32L1xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
mbed_official 522:aee49fe30179 115 #define __STM32L1xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
mbed_official 522:aee49fe30179 116 #define __STM32L1xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
mbed_official 522:aee49fe30179 117 |(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
mbed_official 522:aee49fe30179 118 |(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
mbed_official 522:aee49fe30179 119 |(__CMSIS_DEVICE_HAL_VERSION_RC))
mbed_official 522:aee49fe30179 120
mbed_official 522:aee49fe30179 121 /**
mbed_official 522:aee49fe30179 122 * @}
mbed_official 522:aee49fe30179 123 */
mbed_official 522:aee49fe30179 124
mbed_official 522:aee49fe30179 125 /** @addtogroup Device_Included
mbed_official 522:aee49fe30179 126 * @{
mbed_official 522:aee49fe30179 127 */
mbed_official 522:aee49fe30179 128
mbed_official 522:aee49fe30179 129 #if defined(STM32L100xB)
mbed_official 522:aee49fe30179 130 #include "stm32l100xb.h"
mbed_official 522:aee49fe30179 131 #elif defined(STM32L100xBA)
mbed_official 522:aee49fe30179 132 #include "stm32l100xba.h"
mbed_official 522:aee49fe30179 133 #elif defined(STM32L100xC)
mbed_official 522:aee49fe30179 134 #include "stm32l100xc.h"
mbed_official 522:aee49fe30179 135 #elif defined(STM32L151xB)
mbed_official 522:aee49fe30179 136 #include "stm32l151xb.h"
mbed_official 522:aee49fe30179 137 #elif defined(STM32L151xBA)
mbed_official 522:aee49fe30179 138 #include "stm32l151xba.h"
mbed_official 522:aee49fe30179 139 #elif defined(STM32L151xC)
mbed_official 522:aee49fe30179 140 #include "stm32l151xc.h"
mbed_official 522:aee49fe30179 141 #elif defined(STM32L151xCA)
mbed_official 522:aee49fe30179 142 #include "stm32l151xca.h"
mbed_official 522:aee49fe30179 143 #elif defined(STM32L151xD)
mbed_official 522:aee49fe30179 144 #include "stm32l151xd.h"
mbed_official 522:aee49fe30179 145 #elif defined(STM32L151xE)
mbed_official 522:aee49fe30179 146 #include "stm32l151xe.h"
mbed_official 522:aee49fe30179 147 #elif defined(STM32L152xB)
mbed_official 522:aee49fe30179 148 #include "stm32l152xb.h"
mbed_official 522:aee49fe30179 149 #elif defined(STM32L152xBA)
mbed_official 522:aee49fe30179 150 #include "stm32l152xba.h"
mbed_official 522:aee49fe30179 151 #elif defined(STM32L152xC)
mbed_official 522:aee49fe30179 152 #include "stm32l152xc.h"
mbed_official 522:aee49fe30179 153 #elif defined(STM32L152xCA)
mbed_official 522:aee49fe30179 154 #include "stm32l152xca.h"
mbed_official 522:aee49fe30179 155 #elif defined(STM32L152xD)
mbed_official 522:aee49fe30179 156 #include "stm32l152xd.h"
mbed_official 522:aee49fe30179 157 #elif defined(STM32L152xE)
mbed_official 522:aee49fe30179 158 #include "stm32l152xe.h"
mbed_official 522:aee49fe30179 159 #elif defined(STM32L162xC)
mbed_official 522:aee49fe30179 160 #include "stm32l162xc.h"
mbed_official 522:aee49fe30179 161 #elif defined(STM32L162xCA)
mbed_official 522:aee49fe30179 162 #include "stm32l162xca.h"
mbed_official 522:aee49fe30179 163 #elif defined(STM32L162xD)
mbed_official 522:aee49fe30179 164 #include "stm32l162xd.h"
mbed_official 522:aee49fe30179 165 #elif defined(STM32L162xE)
mbed_official 522:aee49fe30179 166 #include "stm32l162xe.h"
mbed_official 522:aee49fe30179 167 #else
mbed_official 522:aee49fe30179 168 #error "Please select first the target STM32L1xx device used in your application (in stm32l1xx.h file)"
mbed_official 522:aee49fe30179 169 #endif
mbed_official 522:aee49fe30179 170
mbed_official 522:aee49fe30179 171 /**
mbed_official 522:aee49fe30179 172 * @}
mbed_official 522:aee49fe30179 173 */
mbed_official 522:aee49fe30179 174
mbed_official 522:aee49fe30179 175 /** @addtogroup Exported_types
mbed_official 522:aee49fe30179 176 * @{
mbed_official 522:aee49fe30179 177 */
mbed_official 522:aee49fe30179 178 typedef enum
mbed_official 522:aee49fe30179 179 {
mbed_official 522:aee49fe30179 180 RESET = 0,
mbed_official 522:aee49fe30179 181 SET = !RESET
mbed_official 522:aee49fe30179 182 } FlagStatus, ITStatus;
mbed_official 522:aee49fe30179 183
mbed_official 522:aee49fe30179 184 typedef enum
mbed_official 522:aee49fe30179 185 {
mbed_official 522:aee49fe30179 186 DISABLE = 0,
mbed_official 522:aee49fe30179 187 ENABLE = !DISABLE
mbed_official 522:aee49fe30179 188 } FunctionalState;
mbed_official 522:aee49fe30179 189 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
mbed_official 522:aee49fe30179 190
mbed_official 522:aee49fe30179 191 typedef enum
mbed_official 522:aee49fe30179 192 {
mbed_official 522:aee49fe30179 193 ERROR = 0,
mbed_official 522:aee49fe30179 194 SUCCESS = !ERROR
mbed_official 522:aee49fe30179 195 } ErrorStatus;
mbed_official 522:aee49fe30179 196
mbed_official 522:aee49fe30179 197 /**
mbed_official 522:aee49fe30179 198 * @}
mbed_official 522:aee49fe30179 199 */
mbed_official 522:aee49fe30179 200
mbed_official 522:aee49fe30179 201
mbed_official 522:aee49fe30179 202 /** @addtogroup Exported_macros
mbed_official 522:aee49fe30179 203 * @{
mbed_official 522:aee49fe30179 204 */
mbed_official 522:aee49fe30179 205 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
mbed_official 522:aee49fe30179 206
mbed_official 522:aee49fe30179 207 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
mbed_official 522:aee49fe30179 208
mbed_official 522:aee49fe30179 209 #define READ_BIT(REG, BIT) ((REG) & (BIT))
mbed_official 522:aee49fe30179 210
mbed_official 522:aee49fe30179 211 #define CLEAR_REG(REG) ((REG) = (0x0))
mbed_official 522:aee49fe30179 212
mbed_official 522:aee49fe30179 213 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
mbed_official 522:aee49fe30179 214
mbed_official 522:aee49fe30179 215 #define READ_REG(REG) ((REG))
mbed_official 522:aee49fe30179 216
mbed_official 522:aee49fe30179 217 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
mbed_official 522:aee49fe30179 218
mbed_official 522:aee49fe30179 219 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
mbed_official 522:aee49fe30179 220
mbed_official 522:aee49fe30179 221
mbed_official 522:aee49fe30179 222 /**
mbed_official 522:aee49fe30179 223 * @}
mbed_official 522:aee49fe30179 224 */
mbed_official 522:aee49fe30179 225
mbed_official 522:aee49fe30179 226 #if defined (USE_HAL_DRIVER)
mbed_official 522:aee49fe30179 227 #include "stm32l1xx_hal.h"
mbed_official 522:aee49fe30179 228 #endif /* USE_HAL_DRIVER */
mbed_official 522:aee49fe30179 229
mbed_official 522:aee49fe30179 230
mbed_official 522:aee49fe30179 231 #ifdef __cplusplus
mbed_official 522:aee49fe30179 232 }
mbed_official 522:aee49fe30179 233 #endif /* __cplusplus */
mbed_official 522:aee49fe30179 234
mbed_official 522:aee49fe30179 235 #endif /* __STM32L1xx_H */
mbed_official 522:aee49fe30179 236 /**
mbed_official 522:aee49fe30179 237 * @}
mbed_official 522:aee49fe30179 238 */
mbed_official 522:aee49fe30179 239
mbed_official 522:aee49fe30179 240 /**
mbed_official 522:aee49fe30179 241 * @}
mbed_official 522:aee49fe30179 242 */
mbed_official 522:aee49fe30179 243
mbed_official 522:aee49fe30179 244
mbed_official 522:aee49fe30179 245
mbed_official 522:aee49fe30179 246
mbed_official 522:aee49fe30179 247 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/