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

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
bogdanm
Date:
Fri Sep 12 16:41:52 2014 +0100
Revision:
89:552587b429a1
Parent:
86:04dd9b1680ae
Child:
92:4fc01daae5a5
Release 89 of the mbed library

Main changes:

- low power optimizations for Nordic targets
- code structure changes for Freescale K64F targets
- bug fixes in various backends

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 86:04dd9b1680ae 1 /**
bogdanm 86:04dd9b1680ae 2 ******************************************************************************
bogdanm 86:04dd9b1680ae 3 * @file stm32f3xx.h
bogdanm 86:04dd9b1680ae 4 * @author MCD Application Team
bogdanm 86:04dd9b1680ae 5 * @version V2.0.1
bogdanm 86:04dd9b1680ae 6 * @date 18-June-2014
bogdanm 86:04dd9b1680ae 7 * @brief CMSIS STM32F3xx Device Peripheral Access Layer Header File.
bogdanm 86:04dd9b1680ae 8 *
bogdanm 86:04dd9b1680ae 9 * The file is the unique include file that the application programmer
bogdanm 86:04dd9b1680ae 10 * is using in the C source code, usually in main.c. This file contains:
bogdanm 86:04dd9b1680ae 11 * - Configuration section that allows to select:
bogdanm 86:04dd9b1680ae 12 * - The STM32F3xx device used in the target application
bogdanm 86:04dd9b1680ae 13 * - To use or not the peripheral’s drivers in application code(i.e.
bogdanm 86:04dd9b1680ae 14 * code will be based on direct access to peripheral’s registers
bogdanm 86:04dd9b1680ae 15 * rather than drivers API), this option is controlled by
bogdanm 86:04dd9b1680ae 16 * "#define USE_HAL_DRIVER"
bogdanm 86:04dd9b1680ae 17 *
bogdanm 86:04dd9b1680ae 18 ******************************************************************************
bogdanm 86:04dd9b1680ae 19 * @attention
bogdanm 86:04dd9b1680ae 20 *
bogdanm 86:04dd9b1680ae 21 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
bogdanm 86:04dd9b1680ae 22 *
bogdanm 86:04dd9b1680ae 23 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 86:04dd9b1680ae 24 * are permitted provided that the following conditions are met:
bogdanm 86:04dd9b1680ae 25 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 86:04dd9b1680ae 26 * this list of conditions and the following disclaimer.
bogdanm 86:04dd9b1680ae 27 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 86:04dd9b1680ae 28 * this list of conditions and the following disclaimer in the documentation
bogdanm 86:04dd9b1680ae 29 * and/or other materials provided with the distribution.
bogdanm 86:04dd9b1680ae 30 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 86:04dd9b1680ae 31 * may be used to endorse or promote products derived from this software
bogdanm 86:04dd9b1680ae 32 * without specific prior written permission.
bogdanm 86:04dd9b1680ae 33 *
bogdanm 86:04dd9b1680ae 34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 86:04dd9b1680ae 35 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 86:04dd9b1680ae 36 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 86:04dd9b1680ae 37 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 86:04dd9b1680ae 38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 86:04dd9b1680ae 39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 86:04dd9b1680ae 40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 86:04dd9b1680ae 41 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 86:04dd9b1680ae 42 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 86:04dd9b1680ae 43 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 86:04dd9b1680ae 44 *
bogdanm 86:04dd9b1680ae 45 ******************************************************************************
bogdanm 86:04dd9b1680ae 46 */
bogdanm 86:04dd9b1680ae 47
bogdanm 86:04dd9b1680ae 48 /** @addtogroup CMSIS
bogdanm 86:04dd9b1680ae 49 * @{
bogdanm 86:04dd9b1680ae 50 */
bogdanm 86:04dd9b1680ae 51
bogdanm 86:04dd9b1680ae 52 /** @addtogroup stm32f3xx
bogdanm 86:04dd9b1680ae 53 * @{
bogdanm 86:04dd9b1680ae 54 */
bogdanm 86:04dd9b1680ae 55
bogdanm 86:04dd9b1680ae 56 #ifndef __STM32F3xx_H
bogdanm 86:04dd9b1680ae 57 #define __STM32F3xx_H
bogdanm 86:04dd9b1680ae 58
bogdanm 86:04dd9b1680ae 59 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 60 extern "C" {
bogdanm 86:04dd9b1680ae 61 #endif /* __cplusplus */
bogdanm 86:04dd9b1680ae 62
bogdanm 86:04dd9b1680ae 63 /** @addtogroup Library_configuration_section
bogdanm 86:04dd9b1680ae 64 * @{
bogdanm 86:04dd9b1680ae 65 */
bogdanm 86:04dd9b1680ae 66
bogdanm 86:04dd9b1680ae 67 /* Uncomment the line below according to the target STM32 device used in your
bogdanm 86:04dd9b1680ae 68 application
bogdanm 86:04dd9b1680ae 69 */
bogdanm 86:04dd9b1680ae 70
bogdanm 86:04dd9b1680ae 71 #if !defined (STM32F301x8) && !defined (STM32F318xx) && \
bogdanm 86:04dd9b1680ae 72 !defined (STM32F302x8) && !defined (STM32F302xC) && \
bogdanm 86:04dd9b1680ae 73 !defined (STM32F303x8) && \
bogdanm 86:04dd9b1680ae 74 !defined (STM32F303xC) && !defined (STM32F358xx) && \
bogdanm 86:04dd9b1680ae 75 !defined (STM32F373xC) && !defined (STM32F378xx) && \
bogdanm 86:04dd9b1680ae 76 !defined (STM32F334x8) && !defined (STM32F328xx)
bogdanm 86:04dd9b1680ae 77 /* #define STM32F301x8 */ /*!< STM32F301K6, STM32F301K8, STM32F301C6, STM32F301C8,
bogdanm 86:04dd9b1680ae 78 STM32F301R6 and STM32F301R8 Devices */
bogdanm 86:04dd9b1680ae 79 /* #define STM32F302x8 */ /*!< STM32F302K6, STM32F302K8, STM32F302C6, STM32F302C8,
bogdanm 86:04dd9b1680ae 80 STM32F302R6 and STM32F302R8 Devices */
bogdanm 86:04dd9b1680ae 81 /* #define STM32F302xC */ /*!< STM32F302CB, STM32F302CC, STM32F302RB, STM32F302RC, STM32F302VB and STM32F302VC Devices */
bogdanm 86:04dd9b1680ae 82 /* #define STM32F303x8 */ /*!< STM32F303K6, STM32F303K8, STM32F303C6, STM32F303C8,
bogdanm 86:04dd9b1680ae 83 STM32F303R6 and STM32F303R8 Devices */
bogdanm 86:04dd9b1680ae 84 /* #define STM32F303xC */ /*!< STM32F303CB, STM32F303CC, STM32F303RB, STM32F303RC, STM32F303VB and STM32F303VC Devices */
bogdanm 86:04dd9b1680ae 85 /* #define STM32F373xC */ /*!< STM32F373C8, STM32F373CB, STM32F373CC, STM32F373R8, STM32F373RB, STM32F373RC,
bogdanm 86:04dd9b1680ae 86 STM32F373V8, STM32F373VB and STM32F373VC Devices */
bogdanm 86:04dd9b1680ae 87 #define STM32F334x8 /*!< STM32F334C4, STM32F334C6, STM32F334C8, STM32F334R4, STM32F334R6 and STM32F334R8 Devices */
bogdanm 86:04dd9b1680ae 88 /* #define STM32F318xx */ /*!< STM32F318K8, STM32F318C8: STM32F301x8 with regulator off: STM32F318xx Devices */
bogdanm 86:04dd9b1680ae 89 /* #define STM32F328xx */ /*!< STM32F328C8, STM32F328R8: STM32F334x8 with regulator off: STM32F328xx Devices */
bogdanm 86:04dd9b1680ae 90 /* #define STM32F358xx */ /*!< STM32F358CC, STM32F358RC, STM32F358VC: STM32F303xC with regulator off: STM32F358xx Devices */
bogdanm 86:04dd9b1680ae 91 /* #define STM32F378xx */ /*!< STM32F378CC, STM32F378RC, STM32F378VC: STM32F373xC with regulator off: STM32F378xx Devices */
bogdanm 86:04dd9b1680ae 92 #endif
bogdanm 86:04dd9b1680ae 93
bogdanm 86:04dd9b1680ae 94 /* Tip: To avoid modifying this file each time you need to switch between these
bogdanm 86:04dd9b1680ae 95 devices, you can define the device in your toolchain compiler preprocessor.
bogdanm 86:04dd9b1680ae 96 */
bogdanm 86:04dd9b1680ae 97 #if !defined (USE_HAL_DRIVER)
bogdanm 86:04dd9b1680ae 98 /**
bogdanm 86:04dd9b1680ae 99 * @brief Comment the line below if you will not use the peripherals drivers.
bogdanm 86:04dd9b1680ae 100 In this case, these drivers will not be included and the application code will
bogdanm 86:04dd9b1680ae 101 be based on direct access to peripherals registers
bogdanm 86:04dd9b1680ae 102 */
bogdanm 86:04dd9b1680ae 103 #define USE_HAL_DRIVER
bogdanm 86:04dd9b1680ae 104 #endif /* USE_HAL_DRIVER */
bogdanm 86:04dd9b1680ae 105
bogdanm 86:04dd9b1680ae 106 /**
bogdanm 86:04dd9b1680ae 107 * @brief CMSIS Device version number V2.0.1
bogdanm 86:04dd9b1680ae 108 */
bogdanm 86:04dd9b1680ae 109 #define __STM32F3xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
bogdanm 86:04dd9b1680ae 110 #define __STM32F3xx_CMSIS_DEVICE_VERSION_SUB1 (0x00) /*!< [23:16] sub1 version */
bogdanm 86:04dd9b1680ae 111 #define __STM32F3xx_CMSIS_DEVICE_VERSION_SUB2 (0x01) /*!< [15:8] sub2 version */
bogdanm 86:04dd9b1680ae 112 #define __STM32F3xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
bogdanm 86:04dd9b1680ae 113 #define __STM32F3xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
bogdanm 86:04dd9b1680ae 114 |(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
bogdanm 86:04dd9b1680ae 115 |(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
bogdanm 86:04dd9b1680ae 116 |(__CMSIS_DEVICE_HAL_VERSION_RC))
bogdanm 86:04dd9b1680ae 117
bogdanm 86:04dd9b1680ae 118 /**
bogdanm 86:04dd9b1680ae 119 * @}
bogdanm 86:04dd9b1680ae 120 */
bogdanm 86:04dd9b1680ae 121
bogdanm 86:04dd9b1680ae 122 /** @addtogroup Device_Included
bogdanm 86:04dd9b1680ae 123 * @{
bogdanm 86:04dd9b1680ae 124 */
bogdanm 86:04dd9b1680ae 125
bogdanm 86:04dd9b1680ae 126 #if defined(STM32F301x8)
bogdanm 86:04dd9b1680ae 127 #include "stm32f301x8.h"
bogdanm 86:04dd9b1680ae 128 #elif defined(STM32F302x8)
bogdanm 86:04dd9b1680ae 129 #include "stm32f302x8.h"
bogdanm 86:04dd9b1680ae 130 #elif defined(STM32F302xC)
bogdanm 86:04dd9b1680ae 131 #include "stm32f302xc.h"
bogdanm 86:04dd9b1680ae 132 #elif defined(STM32F303x8)
bogdanm 86:04dd9b1680ae 133 #include "stm32f303x8.h"
bogdanm 86:04dd9b1680ae 134 #elif defined(STM32F303xC)
bogdanm 86:04dd9b1680ae 135 #include "stm32f303xc.h"
bogdanm 86:04dd9b1680ae 136 #elif defined(STM32F373xC)
bogdanm 86:04dd9b1680ae 137 #include "stm32f373xc.h"
bogdanm 86:04dd9b1680ae 138 #elif defined(STM32F334x8)
bogdanm 86:04dd9b1680ae 139 #include "stm32f334x8.h"
bogdanm 86:04dd9b1680ae 140 #elif defined(STM32F318xx)
bogdanm 86:04dd9b1680ae 141 #include "stm32f318xx.h"
bogdanm 86:04dd9b1680ae 142 #elif defined(STM32F328xx)
bogdanm 86:04dd9b1680ae 143 #include "stm32f328xx.h"
bogdanm 86:04dd9b1680ae 144 #elif defined(STM32F358xx)
bogdanm 86:04dd9b1680ae 145 #include "stm32f358xx.h"
bogdanm 86:04dd9b1680ae 146 #elif defined(STM32F378xx)
bogdanm 86:04dd9b1680ae 147 #include "stm32f378xx.h"
bogdanm 86:04dd9b1680ae 148 #else
bogdanm 86:04dd9b1680ae 149 #error "Please select first the target STM32F3xx device used in your application (in stm32f3xx.h file)"
bogdanm 86:04dd9b1680ae 150 #endif
bogdanm 86:04dd9b1680ae 151
bogdanm 86:04dd9b1680ae 152 /**
bogdanm 86:04dd9b1680ae 153 * @}
bogdanm 86:04dd9b1680ae 154 */
bogdanm 86:04dd9b1680ae 155
bogdanm 86:04dd9b1680ae 156 /** @addtogroup Exported_types
bogdanm 86:04dd9b1680ae 157 * @{
bogdanm 86:04dd9b1680ae 158 */
bogdanm 86:04dd9b1680ae 159 typedef enum
bogdanm 86:04dd9b1680ae 160 {
bogdanm 86:04dd9b1680ae 161 RESET = 0,
bogdanm 86:04dd9b1680ae 162 SET = !RESET
bogdanm 86:04dd9b1680ae 163 } FlagStatus, ITStatus;
bogdanm 86:04dd9b1680ae 164
bogdanm 86:04dd9b1680ae 165 typedef enum
bogdanm 86:04dd9b1680ae 166 {
bogdanm 86:04dd9b1680ae 167 DISABLE = 0,
bogdanm 86:04dd9b1680ae 168 ENABLE = !DISABLE
bogdanm 86:04dd9b1680ae 169 } FunctionalState;
bogdanm 86:04dd9b1680ae 170 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
bogdanm 86:04dd9b1680ae 171
bogdanm 86:04dd9b1680ae 172 typedef enum
bogdanm 86:04dd9b1680ae 173 {
bogdanm 86:04dd9b1680ae 174 ERROR = 0,
bogdanm 86:04dd9b1680ae 175 SUCCESS = !ERROR
bogdanm 86:04dd9b1680ae 176 } ErrorStatus;
bogdanm 86:04dd9b1680ae 177
bogdanm 86:04dd9b1680ae 178 /**
bogdanm 86:04dd9b1680ae 179 * @}
bogdanm 86:04dd9b1680ae 180 */
bogdanm 86:04dd9b1680ae 181
bogdanm 86:04dd9b1680ae 182
bogdanm 86:04dd9b1680ae 183 /** @addtogroup Exported_macros
bogdanm 86:04dd9b1680ae 184 * @{
bogdanm 86:04dd9b1680ae 185 */
bogdanm 86:04dd9b1680ae 186 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
bogdanm 86:04dd9b1680ae 187
bogdanm 86:04dd9b1680ae 188 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
bogdanm 86:04dd9b1680ae 189
bogdanm 86:04dd9b1680ae 190 #define READ_BIT(REG, BIT) ((REG) & (BIT))
bogdanm 86:04dd9b1680ae 191
bogdanm 86:04dd9b1680ae 192 #define CLEAR_REG(REG) ((REG) = (0x0))
bogdanm 86:04dd9b1680ae 193
bogdanm 86:04dd9b1680ae 194 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
bogdanm 86:04dd9b1680ae 195
bogdanm 86:04dd9b1680ae 196 #define READ_REG(REG) ((REG))
bogdanm 86:04dd9b1680ae 197
bogdanm 86:04dd9b1680ae 198 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
bogdanm 86:04dd9b1680ae 199
bogdanm 86:04dd9b1680ae 200 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
bogdanm 86:04dd9b1680ae 201
bogdanm 86:04dd9b1680ae 202
bogdanm 86:04dd9b1680ae 203 #if defined (USE_HAL_DRIVER)
bogdanm 86:04dd9b1680ae 204 #include "stm32f3xx_hal.h"
bogdanm 86:04dd9b1680ae 205 #endif /* USE_HAL_DRIVER */
bogdanm 86:04dd9b1680ae 206
bogdanm 86:04dd9b1680ae 207
bogdanm 86:04dd9b1680ae 208 /**
bogdanm 86:04dd9b1680ae 209 * @}
bogdanm 86:04dd9b1680ae 210 */
bogdanm 86:04dd9b1680ae 211
bogdanm 86:04dd9b1680ae 212
bogdanm 86:04dd9b1680ae 213 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 214 }
bogdanm 86:04dd9b1680ae 215 #endif /* __cplusplus */
bogdanm 86:04dd9b1680ae 216
bogdanm 86:04dd9b1680ae 217 #endif /* __STM32F3xx_H */
bogdanm 86:04dd9b1680ae 218 /**
bogdanm 86:04dd9b1680ae 219 * @}
bogdanm 86:04dd9b1680ae 220 */
bogdanm 86:04dd9b1680ae 221
bogdanm 86:04dd9b1680ae 222 /**
bogdanm 86:04dd9b1680ae 223 * @}
bogdanm 86:04dd9b1680ae 224 */
bogdanm 86:04dd9b1680ae 225
bogdanm 86:04dd9b1680ae 226
bogdanm 86:04dd9b1680ae 227
bogdanm 86:04dd9b1680ae 228
bogdanm 86:04dd9b1680ae 229 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/