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