meh

Fork of mbed by mbed official

Committer:
ricardobtez
Date:
Tue Apr 05 23:51:21 2016 +0000
Revision:
118:16969dd821af
Parent:
92:4fc01daae5a5
Child:
93:e188a91d3eaa
dgdgr

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 85:024bf7f99721 1 /**
bogdanm 85:024bf7f99721 2 ******************************************************************************
bogdanm 85:024bf7f99721 3 * @file stm32f0xx.h
bogdanm 85:024bf7f99721 4 * @author MCD Application Team
bogdanm 92:4fc01daae5a5 5 * @version V2.1.0
bogdanm 92:4fc01daae5a5 6 * @date 03-Oct-2014
bogdanm 85:024bf7f99721 7 * @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File.
bogdanm 85:024bf7f99721 8 *
bogdanm 85:024bf7f99721 9 * The file is the unique include file that the application programmer
bogdanm 85:024bf7f99721 10 * is using in the C source code, usually in main.c. This file contains:
bogdanm 85:024bf7f99721 11 * - Configuration section that allows to select:
bogdanm 85:024bf7f99721 12 * - The STM32F0xx device used in the target application
bogdanm 85:024bf7f99721 13 * - To use or not the peripheral’s drivers in application code(i.e.
bogdanm 85:024bf7f99721 14 * code will be based on direct access to peripheral’s registers
bogdanm 85:024bf7f99721 15 * rather than drivers API), this option is controlled by
bogdanm 85:024bf7f99721 16 * "#define USE_HAL_DRIVER"
bogdanm 85:024bf7f99721 17 *
bogdanm 85:024bf7f99721 18 ******************************************************************************
bogdanm 85:024bf7f99721 19 * @attention
bogdanm 85:024bf7f99721 20 *
bogdanm 85:024bf7f99721 21 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
bogdanm 85:024bf7f99721 22 *
bogdanm 85:024bf7f99721 23 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 85:024bf7f99721 24 * are permitted provided that the following conditions are met:
bogdanm 85:024bf7f99721 25 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 85:024bf7f99721 26 * this list of conditions and the following disclaimer.
bogdanm 85:024bf7f99721 27 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 85:024bf7f99721 28 * this list of conditions and the following disclaimer in the documentation
bogdanm 85:024bf7f99721 29 * and/or other materials provided with the distribution.
bogdanm 85:024bf7f99721 30 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 85:024bf7f99721 31 * may be used to endorse or promote products derived from this software
bogdanm 85:024bf7f99721 32 * without specific prior written permission.
bogdanm 85:024bf7f99721 33 *
bogdanm 85:024bf7f99721 34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 85:024bf7f99721 35 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 85:024bf7f99721 36 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 85:024bf7f99721 37 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 85:024bf7f99721 38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 85:024bf7f99721 39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 85:024bf7f99721 40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 85:024bf7f99721 41 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 85:024bf7f99721 42 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 85:024bf7f99721 43 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 85:024bf7f99721 44 *
bogdanm 85:024bf7f99721 45 ******************************************************************************
bogdanm 85:024bf7f99721 46 */
bogdanm 85:024bf7f99721 47
bogdanm 85:024bf7f99721 48 /** @addtogroup CMSIS
bogdanm 85:024bf7f99721 49 * @{
bogdanm 85:024bf7f99721 50 */
bogdanm 85:024bf7f99721 51
bogdanm 85:024bf7f99721 52 /** @addtogroup stm32f0xx
bogdanm 85:024bf7f99721 53 * @{
bogdanm 85:024bf7f99721 54 */
bogdanm 85:024bf7f99721 55
bogdanm 85:024bf7f99721 56 #ifndef __STM32F0xx_H
bogdanm 85:024bf7f99721 57 #define __STM32F0xx_H
bogdanm 85:024bf7f99721 58
bogdanm 85:024bf7f99721 59 #ifdef __cplusplus
bogdanm 85:024bf7f99721 60 extern "C" {
bogdanm 85:024bf7f99721 61 #endif /* __cplusplus */
bogdanm 85:024bf7f99721 62
bogdanm 85:024bf7f99721 63 /** @addtogroup Library_configuration_section
bogdanm 85:024bf7f99721 64 * @{
bogdanm 85:024bf7f99721 65 */
bogdanm 85:024bf7f99721 66
bogdanm 85:024bf7f99721 67 /* Uncomment the line below according to the target STM32 device used in your
bogdanm 85:024bf7f99721 68 application
bogdanm 85:024bf7f99721 69 */
bogdanm 85:024bf7f99721 70
bogdanm 85:024bf7f99721 71 #if !defined (STM32F030x6) && !defined (STM32F030x8) && \
bogdanm 85:024bf7f99721 72 !defined (STM32F031x6) && !defined (STM32F038xx) && \
bogdanm 85:024bf7f99721 73 !defined (STM32F042x6) && !defined (STM32F048xx) && \
bogdanm 85:024bf7f99721 74 !defined (STM32F051x8) && !defined (STM32F058xx) && \
bogdanm 92:4fc01daae5a5 75 !defined (STM32F071xB) && !defined (STM32F072xB) && !defined (STM32F078xx) && \
bogdanm 92:4fc01daae5a5 76 !defined (STM32F091xC) && !defined (STM32F098xx)
bogdanm 85:024bf7f99721 77 /* #define STM32F030x6 */ /*!< STM32F030x4, STM32F030x6 Devices (STM32F030xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
bogdanm 85:024bf7f99721 78 /* #define STM32F030x8 */ /*!< STM32F030x8 Devices (STM32F030xx microcontrollers where the Flash memory is 64 Kbytes) */
bogdanm 85:024bf7f99721 79 /* #define STM32F031x6 */ /*!< STM32F031x4, STM32F031x6 Devices (STM32F031xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
bogdanm 85:024bf7f99721 80 /* #define STM32F038xx */ /*!< STM32F038xx Devices (STM32F038xx microcontrollers where the Flash memory is 32 Kbytes) */
bogdanm 85:024bf7f99721 81 /* #define STM32F042x6 */ /*!< STM32F042x4, STM32F042x6 Devices (STM32F042xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
bogdanm 85:024bf7f99721 82 /* #define STM32F048x6 */ /*!< STM32F048xx Devices (STM32F042xx microcontrollers where the Flash memory is 32 Kbytes) */
bogdanm 85:024bf7f99721 83 /* #define STM32F051x8 */ /*!< STM32F051x4, STM32F051x6, STM32F051x8 Devices (STM32F051xx microcontrollers where the Flash memory ranges between 16 and 64 Kbytes) */
bogdanm 85:024bf7f99721 84 /* #define STM32F058xx */ /*!< STM32F058xx Devices (STM32F058xx microcontrollers where the Flash memory is 64 Kbytes) */
bogdanm 85:024bf7f99721 85 /* #define STM32F071xB */ /*!< STM32F071x8, STM32F071xB Devices (STM32F071xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
bogdanm 85:024bf7f99721 86 #define STM32F072xB /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
bogdanm 85:024bf7f99721 87 /* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */
bogdanm 92:4fc01daae5a5 88 /* #define STM32F091xC */ /*!< STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory is 256 Kbytes) */
bogdanm 92:4fc01daae5a5 89 /* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */
bogdanm 85:024bf7f99721 90 #endif
bogdanm 85:024bf7f99721 91
bogdanm 85:024bf7f99721 92 /* Tip: To avoid modifying this file each time you need to switch between these
bogdanm 85:024bf7f99721 93 devices, you can define the device in your toolchain compiler preprocessor.
bogdanm 85:024bf7f99721 94 */
bogdanm 85:024bf7f99721 95 #if !defined (USE_HAL_DRIVER)
bogdanm 85:024bf7f99721 96 /**
bogdanm 85:024bf7f99721 97 * @brief Comment the line below if you will not use the peripherals drivers.
bogdanm 85:024bf7f99721 98 In this case, these drivers will not be included and the application code will
bogdanm 85:024bf7f99721 99 be based on direct access to peripherals registers
bogdanm 85:024bf7f99721 100 */
bogdanm 85:024bf7f99721 101 #define USE_HAL_DRIVER
bogdanm 85:024bf7f99721 102 #endif /* USE_HAL_DRIVER */
bogdanm 85:024bf7f99721 103
bogdanm 85:024bf7f99721 104 /**
bogdanm 92:4fc01daae5a5 105 * @brief CMSIS Device version number V2.1.0
bogdanm 85:024bf7f99721 106 */
bogdanm 85:024bf7f99721 107 #define __STM32F0xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
bogdanm 92:4fc01daae5a5 108 #define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB1 (0x01) /*!< [23:16] sub1 version */
bogdanm 85:024bf7f99721 109 #define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
bogdanm 85:024bf7f99721 110 #define __STM32F0xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
bogdanm 85:024bf7f99721 111 #define __STM32F0xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
bogdanm 85:024bf7f99721 112 |(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
bogdanm 85:024bf7f99721 113 |(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
bogdanm 85:024bf7f99721 114 |(__CMSIS_DEVICE_HAL_VERSION_RC))
bogdanm 85:024bf7f99721 115
bogdanm 85:024bf7f99721 116 /**
bogdanm 85:024bf7f99721 117 * @}
bogdanm 85:024bf7f99721 118 */
bogdanm 85:024bf7f99721 119
bogdanm 85:024bf7f99721 120 /** @addtogroup Device_Included
bogdanm 85:024bf7f99721 121 * @{
bogdanm 85:024bf7f99721 122 */
bogdanm 85:024bf7f99721 123
bogdanm 85:024bf7f99721 124 #if defined(STM32F030x6)
bogdanm 85:024bf7f99721 125 #include "stm32f030x6.h"
bogdanm 85:024bf7f99721 126 #elif defined(STM32F030x8)
bogdanm 85:024bf7f99721 127 #include "stm32f030x8.h"
bogdanm 85:024bf7f99721 128 #elif defined(STM32F031x6)
bogdanm 85:024bf7f99721 129 #include "stm32f031x6.h"
bogdanm 85:024bf7f99721 130 #elif defined(STM32F038xx)
bogdanm 85:024bf7f99721 131 #include "stm32f038xx.h"
bogdanm 85:024bf7f99721 132 #elif defined(STM32F042x6)
bogdanm 85:024bf7f99721 133 #include "stm32f042x6.h"
bogdanm 85:024bf7f99721 134 #elif defined(STM32F048xx)
bogdanm 85:024bf7f99721 135 #include "stm32f048xx.h"
bogdanm 85:024bf7f99721 136 #elif defined(STM32F051x8)
bogdanm 85:024bf7f99721 137 #include "stm32f051x8.h"
bogdanm 85:024bf7f99721 138 #elif defined(STM32F058xx)
bogdanm 85:024bf7f99721 139 #include "stm32f058xx.h"
bogdanm 85:024bf7f99721 140 #elif defined(STM32F071xB)
bogdanm 85:024bf7f99721 141 #include "stm32f071xb.h"
bogdanm 85:024bf7f99721 142 #elif defined(STM32F072xB)
bogdanm 85:024bf7f99721 143 #include "stm32f072xb.h"
bogdanm 85:024bf7f99721 144 #elif defined(STM32F078xx)
bogdanm 85:024bf7f99721 145 #include "stm32f078xx.h"
bogdanm 92:4fc01daae5a5 146 #elif defined(STM32F091xC)
bogdanm 92:4fc01daae5a5 147 #include "stm32f091xc.h"
bogdanm 92:4fc01daae5a5 148 #elif defined(STM32F098xx)
bogdanm 92:4fc01daae5a5 149 #include "stm32f098xx.h"
bogdanm 85:024bf7f99721 150 #else
bogdanm 85:024bf7f99721 151 #error "Please select first the target STM32F0xx device used in your application (in stm32f0xx.h file)"
bogdanm 85:024bf7f99721 152 #endif
bogdanm 85:024bf7f99721 153
bogdanm 85:024bf7f99721 154 /**
bogdanm 85:024bf7f99721 155 * @}
bogdanm 85:024bf7f99721 156 */
bogdanm 85:024bf7f99721 157
bogdanm 85:024bf7f99721 158 /** @addtogroup Exported_types
bogdanm 85:024bf7f99721 159 * @{
bogdanm 85:024bf7f99721 160 */
bogdanm 85:024bf7f99721 161 typedef enum
bogdanm 85:024bf7f99721 162 {
bogdanm 85:024bf7f99721 163 RESET = 0,
bogdanm 85:024bf7f99721 164 SET = !RESET
bogdanm 85:024bf7f99721 165 } FlagStatus, ITStatus;
bogdanm 85:024bf7f99721 166
bogdanm 85:024bf7f99721 167 typedef enum
bogdanm 85:024bf7f99721 168 {
bogdanm 85:024bf7f99721 169 DISABLE = 0,
bogdanm 85:024bf7f99721 170 ENABLE = !DISABLE
bogdanm 85:024bf7f99721 171 } FunctionalState;
bogdanm 85:024bf7f99721 172 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
bogdanm 85:024bf7f99721 173
bogdanm 85:024bf7f99721 174 typedef enum
bogdanm 85:024bf7f99721 175 {
bogdanm 85:024bf7f99721 176 ERROR = 0,
bogdanm 85:024bf7f99721 177 SUCCESS = !ERROR
bogdanm 85:024bf7f99721 178 } ErrorStatus;
bogdanm 85:024bf7f99721 179
bogdanm 85:024bf7f99721 180 /**
bogdanm 85:024bf7f99721 181 * @}
bogdanm 85:024bf7f99721 182 */
bogdanm 85:024bf7f99721 183
bogdanm 85:024bf7f99721 184
bogdanm 85:024bf7f99721 185 /** @addtogroup Exported_macros
bogdanm 85:024bf7f99721 186 * @{
bogdanm 85:024bf7f99721 187 */
bogdanm 85:024bf7f99721 188 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
bogdanm 85:024bf7f99721 189
bogdanm 85:024bf7f99721 190 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
bogdanm 85:024bf7f99721 191
bogdanm 85:024bf7f99721 192 #define READ_BIT(REG, BIT) ((REG) & (BIT))
bogdanm 85:024bf7f99721 193
bogdanm 85:024bf7f99721 194 #define CLEAR_REG(REG) ((REG) = (0x0))
bogdanm 85:024bf7f99721 195
bogdanm 85:024bf7f99721 196 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
bogdanm 85:024bf7f99721 197
bogdanm 85:024bf7f99721 198 #define READ_REG(REG) ((REG))
bogdanm 85:024bf7f99721 199
bogdanm 85:024bf7f99721 200 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
bogdanm 85:024bf7f99721 201
bogdanm 85:024bf7f99721 202
bogdanm 85:024bf7f99721 203 /**
bogdanm 85:024bf7f99721 204 * @}
bogdanm 85:024bf7f99721 205 */
bogdanm 85:024bf7f99721 206
bogdanm 85:024bf7f99721 207 #if defined (USE_HAL_DRIVER)
bogdanm 85:024bf7f99721 208 #include "stm32f0xx_hal.h"
bogdanm 85:024bf7f99721 209 #endif /* USE_HAL_DRIVER */
bogdanm 85:024bf7f99721 210
bogdanm 85:024bf7f99721 211
bogdanm 85:024bf7f99721 212 #ifdef __cplusplus
bogdanm 85:024bf7f99721 213 }
bogdanm 85:024bf7f99721 214 #endif /* __cplusplus */
bogdanm 85:024bf7f99721 215
bogdanm 85:024bf7f99721 216 #endif /* __STM32F0xx_H */
bogdanm 85:024bf7f99721 217 /**
bogdanm 85:024bf7f99721 218 * @}
bogdanm 85:024bf7f99721 219 */
bogdanm 85:024bf7f99721 220
bogdanm 85:024bf7f99721 221 /**
bogdanm 85:024bf7f99721 222 * @}
bogdanm 85:024bf7f99721 223 */
bogdanm 85:024bf7f99721 224
bogdanm 85:024bf7f99721 225
bogdanm 85:024bf7f99721 226
bogdanm 85:024bf7f99721 227
bogdanm 85:024bf7f99721 228 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/