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