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 stm32f4xx.h
Jasper_lee 0:b16d94660a33 4 * @author MCD Application Team
Jasper_lee 0:b16d94660a33 5 * @version V2.1.0RC2
Jasper_lee 0:b16d94660a33 6 * @date 14-May-2014
Jasper_lee 0:b16d94660a33 7 * @brief CMSIS STM32F4xx 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 STM32F4xx 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 stm32f4xx
Jasper_lee 0:b16d94660a33 53 * @{
Jasper_lee 0:b16d94660a33 54 */
Jasper_lee 0:b16d94660a33 55
Jasper_lee 0:b16d94660a33 56 #ifndef __STM32F4xx_H
Jasper_lee 0:b16d94660a33 57 #define __STM32F4xx_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 (STM32F405xx) && !defined (STM32F415xx) && !defined (STM32F407xx) && !defined (STM32F417xx) && \
Jasper_lee 0:b16d94660a33 72 !defined (STM32F427xx) && !defined (STM32F437xx) && !defined (STM32F429xx) && !defined (STM32F439xx) && \
Jasper_lee 0:b16d94660a33 73 !defined (STM32F401xC) && !defined (STM32F401xE) && !defined (STM32F411xE)
Jasper_lee 0:b16d94660a33 74 /* #define STM32F405xx */ /*!< STM32F405RG, STM32F405VG and STM32F405ZG Devices */
Jasper_lee 0:b16d94660a33 75 /* #define STM32F415xx */ /*!< STM32F415RG, STM32F415VG and STM32F415ZG Devices */
Jasper_lee 0:b16d94660a33 76 #define STM32F407xx /*!< STM32F407VG, STM32F407VE, STM32F407ZG, STM32F407ZE, STM32F407IG and STM32F407IE Devices */
Jasper_lee 0:b16d94660a33 77 /* #define STM32F417xx */ /*!< STM32F417VG, STM32F417VE, STM32F417ZG, STM32F417ZE, STM32F417IG and STM32F417IE Devices */
Jasper_lee 0:b16d94660a33 78 /* #define STM32F427xx */ /*!< STM32F427VG, STM32F427VI, STM32F427ZG, STM32F427ZI, STM32F427IG and STM32F427II Devices */
Jasper_lee 0:b16d94660a33 79 /* #define STM32F437xx */ /*!< STM32F437VG, STM32F437VI, STM32F437ZG, STM32F437ZI, STM32F437IG and STM32F437II Devices */
Jasper_lee 0:b16d94660a33 80 /* #define STM32F429xx */ /*!< STM32F429VG, STM32F429VI, STM32F429ZG, STM32F429ZI, STM32F429BG, STM32F429BI, STM32F429NG,
Jasper_lee 0:b16d94660a33 81 STM32F439NI, STM32F429IG and STM32F429II Devices */
Jasper_lee 0:b16d94660a33 82 /* #define STM32F439xx */ /*!< STM32F439VG, STM32F439VI, STM32F439ZG, STM32F439ZI, STM32F439BG, STM32F439BI, STM32F439NG,
Jasper_lee 0:b16d94660a33 83 STM32F439NI, STM32F439IG and STM32F439II Devices */
Jasper_lee 0:b16d94660a33 84 /* #define STM32F401xC */ /*!< STM32F401CB, STM32F401CC, STM32F401RB, STM32F401RC, STM32F401VB and STM32F401VC Devices */
Jasper_lee 0:b16d94660a33 85 /* #define STM32F401xE */ /*!< STM32F401CD, STM32F401RD, STM32F401VD, STM32F401CE, STM32F401RE and STM32F401VE Devices */
Jasper_lee 0:b16d94660a33 86 /* #define STM32F411xE */ /*!< STM32F411CD, STM32F411RD, STM32F411VD, STM32F411CE, STM32F411RE and STM32F411VE Devices */
Jasper_lee 0:b16d94660a33 87 #endif
Jasper_lee 0:b16d94660a33 88
Jasper_lee 0:b16d94660a33 89 /* Tip: To avoid modifying this file each time you need to switch between these
Jasper_lee 0:b16d94660a33 90 devices, you can define the device in your toolchain compiler preprocessor.
Jasper_lee 0:b16d94660a33 91 */
Jasper_lee 0:b16d94660a33 92 #if !defined (USE_HAL_DRIVER)
Jasper_lee 0:b16d94660a33 93 /**
Jasper_lee 0:b16d94660a33 94 * @brief Comment the line below if you will not use the peripherals drivers.
Jasper_lee 0:b16d94660a33 95 In this case, these drivers will not be included and the application code will
Jasper_lee 0:b16d94660a33 96 be based on direct access to peripherals registers
Jasper_lee 0:b16d94660a33 97 */
Jasper_lee 0:b16d94660a33 98 #define USE_HAL_DRIVER
Jasper_lee 0:b16d94660a33 99 #endif /* USE_HAL_DRIVER */
Jasper_lee 0:b16d94660a33 100
Jasper_lee 0:b16d94660a33 101 /**
Jasper_lee 0:b16d94660a33 102 * @brief CMSIS Device version number V2.1.0RC2
Jasper_lee 0:b16d94660a33 103 */
Jasper_lee 0:b16d94660a33 104 #define __STM32F4xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
Jasper_lee 0:b16d94660a33 105 #define __STM32F4xx_CMSIS_DEVICE_VERSION_SUB1 (0x01) /*!< [23:16] sub1 version */
Jasper_lee 0:b16d94660a33 106 #define __STM32F4xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
Jasper_lee 0:b16d94660a33 107 #define __STM32F4xx_CMSIS_DEVICE_VERSION_RC (0x02) /*!< [7:0] release candidate */
Jasper_lee 0:b16d94660a33 108 #define __STM32F4xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
Jasper_lee 0:b16d94660a33 109 |(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
Jasper_lee 0:b16d94660a33 110 |(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
Jasper_lee 0:b16d94660a33 111 |(__CMSIS_DEVICE_HAL_VERSION_RC))
Jasper_lee 0:b16d94660a33 112
Jasper_lee 0:b16d94660a33 113 /**
Jasper_lee 0:b16d94660a33 114 * @}
Jasper_lee 0:b16d94660a33 115 */
Jasper_lee 0:b16d94660a33 116
Jasper_lee 0:b16d94660a33 117 /** @addtogroup Device_Included
Jasper_lee 0:b16d94660a33 118 * @{
Jasper_lee 0:b16d94660a33 119 */
Jasper_lee 0:b16d94660a33 120
Jasper_lee 0:b16d94660a33 121 #if defined(STM32F405xx)
Jasper_lee 0:b16d94660a33 122 #include "stm32f405xx.h"
Jasper_lee 0:b16d94660a33 123 #elif defined(STM32F415xx)
Jasper_lee 0:b16d94660a33 124 #include "stm32f415xx.h"
Jasper_lee 0:b16d94660a33 125 #elif defined(STM32F407xx)
Jasper_lee 0:b16d94660a33 126 #include "stm32f407xx.h"
Jasper_lee 0:b16d94660a33 127 #elif defined(STM32F417xx)
Jasper_lee 0:b16d94660a33 128 #include "stm32f417xx.h"
Jasper_lee 0:b16d94660a33 129 #elif defined(STM32F427xx)
Jasper_lee 0:b16d94660a33 130 #include "stm32f427xx.h"
Jasper_lee 0:b16d94660a33 131 #elif defined(STM32F437xx)
Jasper_lee 0:b16d94660a33 132 #include "stm32f437xx.h"
Jasper_lee 0:b16d94660a33 133 #elif defined(STM32F429xx)
Jasper_lee 0:b16d94660a33 134 #include "stm32f429xx.h"
Jasper_lee 0:b16d94660a33 135 #elif defined(STM32F439xx)
Jasper_lee 0:b16d94660a33 136 #include "stm32f439xx.h"
Jasper_lee 0:b16d94660a33 137 #elif defined(STM32F401xC)
Jasper_lee 0:b16d94660a33 138 #include "stm32f401xc.h"
Jasper_lee 0:b16d94660a33 139 #elif defined(STM32F401xE)
Jasper_lee 0:b16d94660a33 140 #include "stm32f401xe.h"
Jasper_lee 0:b16d94660a33 141 #elif defined(STM32F411xE)
Jasper_lee 0:b16d94660a33 142 #include "stm32f411xe.h"
Jasper_lee 0:b16d94660a33 143 #else
Jasper_lee 0:b16d94660a33 144 #error "Please select first the target STM32F4xx device used in your application (in stm32f4xx.h file)"
Jasper_lee 0:b16d94660a33 145 #endif
Jasper_lee 0:b16d94660a33 146
Jasper_lee 0:b16d94660a33 147 /**
Jasper_lee 0:b16d94660a33 148 * @}
Jasper_lee 0:b16d94660a33 149 */
Jasper_lee 0:b16d94660a33 150
Jasper_lee 0:b16d94660a33 151 /** @addtogroup Exported_types
Jasper_lee 0:b16d94660a33 152 * @{
Jasper_lee 0:b16d94660a33 153 */
Jasper_lee 0:b16d94660a33 154 typedef enum
Jasper_lee 0:b16d94660a33 155 {
Jasper_lee 0:b16d94660a33 156 RESET = 0,
Jasper_lee 0:b16d94660a33 157 SET = !RESET
Jasper_lee 0:b16d94660a33 158 } FlagStatus, ITStatus;
Jasper_lee 0:b16d94660a33 159
Jasper_lee 0:b16d94660a33 160 typedef enum
Jasper_lee 0:b16d94660a33 161 {
Jasper_lee 0:b16d94660a33 162 DISABLE = 0,
Jasper_lee 0:b16d94660a33 163 ENABLE = !DISABLE
Jasper_lee 0:b16d94660a33 164 } FunctionalState;
Jasper_lee 0:b16d94660a33 165 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
Jasper_lee 0:b16d94660a33 166
Jasper_lee 0:b16d94660a33 167 typedef enum
Jasper_lee 0:b16d94660a33 168 {
Jasper_lee 0:b16d94660a33 169 ERROR = 0,
Jasper_lee 0:b16d94660a33 170 SUCCESS = !ERROR
Jasper_lee 0:b16d94660a33 171 } ErrorStatus;
Jasper_lee 0:b16d94660a33 172
Jasper_lee 0:b16d94660a33 173 /**
Jasper_lee 0:b16d94660a33 174 * @}
Jasper_lee 0:b16d94660a33 175 */
Jasper_lee 0:b16d94660a33 176
Jasper_lee 0:b16d94660a33 177
Jasper_lee 0:b16d94660a33 178 /** @addtogroup Exported_macro
Jasper_lee 0:b16d94660a33 179 * @{
Jasper_lee 0:b16d94660a33 180 */
Jasper_lee 0:b16d94660a33 181 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
Jasper_lee 0:b16d94660a33 182
Jasper_lee 0:b16d94660a33 183 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
Jasper_lee 0:b16d94660a33 184
Jasper_lee 0:b16d94660a33 185 #define READ_BIT(REG, BIT) ((REG) & (BIT))
Jasper_lee 0:b16d94660a33 186
Jasper_lee 0:b16d94660a33 187 #define CLEAR_REG(REG) ((REG) = (0x0))
Jasper_lee 0:b16d94660a33 188
Jasper_lee 0:b16d94660a33 189 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
Jasper_lee 0:b16d94660a33 190
Jasper_lee 0:b16d94660a33 191 #define READ_REG(REG) ((REG))
Jasper_lee 0:b16d94660a33 192
Jasper_lee 0:b16d94660a33 193 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
Jasper_lee 0:b16d94660a33 194
Jasper_lee 0:b16d94660a33 195 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
Jasper_lee 0:b16d94660a33 196
Jasper_lee 0:b16d94660a33 197
Jasper_lee 0:b16d94660a33 198 /**
Jasper_lee 0:b16d94660a33 199 * @}
Jasper_lee 0:b16d94660a33 200 */
Jasper_lee 0:b16d94660a33 201
Jasper_lee 0:b16d94660a33 202 #if defined (USE_HAL_DRIVER)
Jasper_lee 0:b16d94660a33 203 #include "stm32f4xx_hal.h"
Jasper_lee 0:b16d94660a33 204 #endif /* USE_HAL_DRIVER */
Jasper_lee 0:b16d94660a33 205
Jasper_lee 0:b16d94660a33 206 #ifdef __cplusplus
Jasper_lee 0:b16d94660a33 207 }
Jasper_lee 0:b16d94660a33 208 #endif /* __cplusplus */
Jasper_lee 0:b16d94660a33 209
Jasper_lee 0:b16d94660a33 210 #endif /* __STM32F4xx_H */
Jasper_lee 0:b16d94660a33 211 /**
Jasper_lee 0:b16d94660a33 212 * @}
Jasper_lee 0:b16d94660a33 213 */
Jasper_lee 0:b16d94660a33 214
Jasper_lee 0:b16d94660a33 215 /**
Jasper_lee 0:b16d94660a33 216 * @}
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 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/