change some io settings for TWR-K22F-120M

Dependents:   twr_helloworld

Committer:
Jasper_lee
Date:
Tue Dec 23 03:35:08 2014 +0000
Revision:
0:b16d94660a33
change some io setting used in TWR-K22F120M

Who changed what in which revision?

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