encoder

Dependencies:   mbed

Committer:
schille
Date:
Wed Apr 26 08:26:20 2017 +0000
Revision:
0:5067873a2400
mmn

Who changed what in which revision?

UserRevisionLine numberNew contents of line
schille 0:5067873a2400 1 /**
schille 0:5067873a2400 2 ******************************************************************************
schille 0:5067873a2400 3 * @file stm32f4xx.h
schille 0:5067873a2400 4 * @author MCD Application Team
schille 0:5067873a2400 5 * @version V2.3.2
schille 0:5067873a2400 6 * @date 26-June-2015
schille 0:5067873a2400 7 * @brief CMSIS STM32F4xx Device Peripheral Access Layer Header File.
schille 0:5067873a2400 8 *
schille 0:5067873a2400 9 * The file is the unique include file that the application programmer
schille 0:5067873a2400 10 * is using in the C source code, usually in main.c. This file contains:
schille 0:5067873a2400 11 * - Configuration section that allows to select:
schille 0:5067873a2400 12 * - The STM32F4xx device used in the target application
schille 0:5067873a2400 13 * - To use or not the peripheral’s drivers in application code(i.e.
schille 0:5067873a2400 14 * code will be based on direct access to peripheral’s registers
schille 0:5067873a2400 15 * rather than drivers API), this option is controlled by
schille 0:5067873a2400 16 * "#define USE_HAL_DRIVER"
schille 0:5067873a2400 17 *
schille 0:5067873a2400 18 ******************************************************************************
schille 0:5067873a2400 19 * @attention
schille 0:5067873a2400 20 *
schille 0:5067873a2400 21 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
schille 0:5067873a2400 22 *
schille 0:5067873a2400 23 * Redistribution and use in source and binary forms, with or without modification,
schille 0:5067873a2400 24 * are permitted provided that the following conditions are met:
schille 0:5067873a2400 25 * 1. Redistributions of source code must retain the above copyright notice,
schille 0:5067873a2400 26 * this list of conditions and the following disclaimer.
schille 0:5067873a2400 27 * 2. Redistributions in binary form must reproduce the above copyright notice,
schille 0:5067873a2400 28 * this list of conditions and the following disclaimer in the documentation
schille 0:5067873a2400 29 * and/or other materials provided with the distribution.
schille 0:5067873a2400 30 * 3. Neither the name of STMicroelectronics nor the names of its contributors
schille 0:5067873a2400 31 * may be used to endorse or promote products derived from this software
schille 0:5067873a2400 32 * without specific prior written permission.
schille 0:5067873a2400 33 *
schille 0:5067873a2400 34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
schille 0:5067873a2400 35 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
schille 0:5067873a2400 36 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
schille 0:5067873a2400 37 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
schille 0:5067873a2400 38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
schille 0:5067873a2400 39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
schille 0:5067873a2400 40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
schille 0:5067873a2400 41 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
schille 0:5067873a2400 42 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
schille 0:5067873a2400 43 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
schille 0:5067873a2400 44 *
schille 0:5067873a2400 45 ******************************************************************************
schille 0:5067873a2400 46 */
schille 0:5067873a2400 47
schille 0:5067873a2400 48 /** @addtogroup CMSIS
schille 0:5067873a2400 49 * @{
schille 0:5067873a2400 50 */
schille 0:5067873a2400 51
schille 0:5067873a2400 52 /** @addtogroup stm32f4xx
schille 0:5067873a2400 53 * @{
schille 0:5067873a2400 54 */
schille 0:5067873a2400 55
schille 0:5067873a2400 56 #ifndef __STM32F4xx_H
schille 0:5067873a2400 57 #define __STM32F4xx_H
schille 0:5067873a2400 58
schille 0:5067873a2400 59 #ifdef __cplusplus
schille 0:5067873a2400 60 extern "C" {
schille 0:5067873a2400 61 #endif /* __cplusplus */
schille 0:5067873a2400 62
schille 0:5067873a2400 63 /** @addtogroup Library_configuration_section
schille 0:5067873a2400 64 * @{
schille 0:5067873a2400 65 */
schille 0:5067873a2400 66
schille 0:5067873a2400 67 /**
schille 0:5067873a2400 68 * @brief STM32 Family
schille 0:5067873a2400 69 */
schille 0:5067873a2400 70 #if !defined (STM32F4)
schille 0:5067873a2400 71 #define STM32F4
schille 0:5067873a2400 72 #endif /* STM32F4 */
schille 0:5067873a2400 73
schille 0:5067873a2400 74 /* Uncomment the line below according to the target STM32 device used in your
schille 0:5067873a2400 75 application
schille 0:5067873a2400 76 */
schille 0:5067873a2400 77 #if !defined (STM32F405xx) && !defined (STM32F415xx) && !defined (STM32F407xx) && !defined (STM32F417xx) && \
schille 0:5067873a2400 78 !defined (STM32F427xx) && !defined (STM32F437xx) && !defined (STM32F429xx) && !defined (STM32F439xx) && \
schille 0:5067873a2400 79 !defined (STM32F401xC) && !defined (STM32F401xE) && !defined (STM32F411xE) && !defined (STM32F446xx)
schille 0:5067873a2400 80 /* #define STM32F405xx */ /*!< STM32F405RG, STM32F405VG and STM32F405ZG Devices */
schille 0:5067873a2400 81 /* #define STM32F415xx */ /*!< STM32F415RG, STM32F415VG and STM32F415ZG Devices */
schille 0:5067873a2400 82 /* #define STM32F407xx */ /*!< STM32F407VG, STM32F407VE, STM32F407ZG, STM32F407ZE, STM32F407IG and STM32F407IE Devices */
schille 0:5067873a2400 83 /* #define STM32F417xx */ /*!< STM32F417VG, STM32F417VE, STM32F417ZG, STM32F417ZE, STM32F417IG and STM32F417IE Devices */
schille 0:5067873a2400 84 /* #define STM32F427xx */ /*!< STM32F427VG, STM32F427VI, STM32F427ZG, STM32F427ZI, STM32F427IG and STM32F427II Devices */
schille 0:5067873a2400 85 /* #define STM32F437xx */ /*!< STM32F437VG, STM32F437VI, STM32F437ZG, STM32F437ZI, STM32F437IG and STM32F437II Devices */
schille 0:5067873a2400 86 /* #define STM32F429xx */ /*!< STM32F429VG, STM32F429VI, STM32F429ZG, STM32F429ZI, STM32F429BG, STM32F429BI, STM32F429NG,
schille 0:5067873a2400 87 STM32F439NI, STM32F429IG and STM32F429II Devices */
schille 0:5067873a2400 88 /* #define STM32F439xx */ /*!< STM32F439VG, STM32F439VI, STM32F439ZG, STM32F439ZI, STM32F439BG, STM32F439BI, STM32F439NG,
schille 0:5067873a2400 89 STM32F439NI, STM32F439IG and STM32F439II Devices */
schille 0:5067873a2400 90 /* #define STM32F401xC */ /*!< STM32F401CB, STM32F401CC, STM32F401RB, STM32F401RC, STM32F401VB and STM32F401VC Devices */
schille 0:5067873a2400 91 #define STM32F401xE /*!< STM32F401CD, STM32F401RD, STM32F401VD, STM32F401CE, STM32F401RE and STM32F401VE Devices */
schille 0:5067873a2400 92 /* #define STM32F411xE */ /*!< STM32F411CD, STM32F411RD, STM32F411VD, STM32F411CE, STM32F411RE and STM32F411VE Devices */
schille 0:5067873a2400 93 /* #define STM32F446xx */ /*!< STM32F446MC, STM32F446ME, STM32F446RC, STM32F446RE, STM32F446VC, STM32F446VE, STM32F446ZC,
schille 0:5067873a2400 94 and STM32F446ZE Devices */
schille 0:5067873a2400 95 #endif
schille 0:5067873a2400 96
schille 0:5067873a2400 97 /* Tip: To avoid modifying this file each time you need to switch between these
schille 0:5067873a2400 98 devices, you can define the device in your toolchain compiler preprocessor.
schille 0:5067873a2400 99 */
schille 0:5067873a2400 100 #if !defined (USE_HAL_DRIVER)
schille 0:5067873a2400 101 /**
schille 0:5067873a2400 102 * @brief Comment the line below if you will not use the peripherals drivers.
schille 0:5067873a2400 103 In this case, these drivers will not be included and the application code will
schille 0:5067873a2400 104 be based on direct access to peripherals registers
schille 0:5067873a2400 105 */
schille 0:5067873a2400 106 #define USE_HAL_DRIVER
schille 0:5067873a2400 107 #endif /* USE_HAL_DRIVER */
schille 0:5067873a2400 108
schille 0:5067873a2400 109 /**
schille 0:5067873a2400 110 * @brief CMSIS Device version number V2.3.2
schille 0:5067873a2400 111 */
schille 0:5067873a2400 112 #define __STM32F4xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
schille 0:5067873a2400 113 #define __STM32F4xx_CMSIS_DEVICE_VERSION_SUB1 (0x03) /*!< [23:16] sub1 version */
schille 0:5067873a2400 114 #define __STM32F4xx_CMSIS_DEVICE_VERSION_SUB2 (0x02) /*!< [15:8] sub2 version */
schille 0:5067873a2400 115 #define __STM32F4xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
schille 0:5067873a2400 116 #define __STM32F4xx_CMSIS_DEVICE_VERSION ((__STM32F4xx_CMSIS_DEVICE_VERSION_MAIN << 24)\
schille 0:5067873a2400 117 |(__STM32F4xx_CMSIS_DEVICE_VERSION_SUB1 << 16)\
schille 0:5067873a2400 118 |(__STM32F4xx_CMSIS_DEVICE_VERSION_SUB2 << 8 )\
schille 0:5067873a2400 119 |(__STM32F4xx_CMSIS_DEVICE_VERSION))
schille 0:5067873a2400 120
schille 0:5067873a2400 121 /**
schille 0:5067873a2400 122 * @}
schille 0:5067873a2400 123 */
schille 0:5067873a2400 124
schille 0:5067873a2400 125 /** @addtogroup Device_Included
schille 0:5067873a2400 126 * @{
schille 0:5067873a2400 127 */
schille 0:5067873a2400 128
schille 0:5067873a2400 129 #if defined(STM32F405xx)
schille 0:5067873a2400 130 #include "stm32f405xx.h"
schille 0:5067873a2400 131 #elif defined(STM32F415xx)
schille 0:5067873a2400 132 #include "stm32f415xx.h"
schille 0:5067873a2400 133 #elif defined(STM32F407xx)
schille 0:5067873a2400 134 #include "stm32f407xx.h"
schille 0:5067873a2400 135 #elif defined(STM32F417xx)
schille 0:5067873a2400 136 #include "stm32f417xx.h"
schille 0:5067873a2400 137 #elif defined(STM32F427xx)
schille 0:5067873a2400 138 #include "stm32f427xx.h"
schille 0:5067873a2400 139 #elif defined(STM32F437xx)
schille 0:5067873a2400 140 #include "stm32f437xx.h"
schille 0:5067873a2400 141 #elif defined(STM32F429xx)
schille 0:5067873a2400 142 #include "stm32f429xx.h"
schille 0:5067873a2400 143 #elif defined(STM32F439xx)
schille 0:5067873a2400 144 #include "stm32f439xx.h"
schille 0:5067873a2400 145 #elif defined(STM32F401xC)
schille 0:5067873a2400 146 #include "stm32f401xc.h"
schille 0:5067873a2400 147 #elif defined(STM32F401xE)
schille 0:5067873a2400 148 #include "stm32f401xe.h"
schille 0:5067873a2400 149 #elif defined(STM32F411xE)
schille 0:5067873a2400 150 #include "stm32f411xe.h"
schille 0:5067873a2400 151 #elif defined(STM32F446xx)
schille 0:5067873a2400 152 #include "stm32f446xx.h"
schille 0:5067873a2400 153 #else
schille 0:5067873a2400 154 #error "Please select first the target STM32F4xx device used in your application (in stm32f4xx.h file)"
schille 0:5067873a2400 155 #endif
schille 0:5067873a2400 156
schille 0:5067873a2400 157 /**
schille 0:5067873a2400 158 * @}
schille 0:5067873a2400 159 */
schille 0:5067873a2400 160
schille 0:5067873a2400 161 /** @addtogroup Exported_types
schille 0:5067873a2400 162 * @{
schille 0:5067873a2400 163 */
schille 0:5067873a2400 164 typedef enum
schille 0:5067873a2400 165 {
schille 0:5067873a2400 166 RESET = 0,
schille 0:5067873a2400 167 SET = !RESET
schille 0:5067873a2400 168 } FlagStatus, ITStatus;
schille 0:5067873a2400 169
schille 0:5067873a2400 170 typedef enum
schille 0:5067873a2400 171 {
schille 0:5067873a2400 172 DISABLE = 0,
schille 0:5067873a2400 173 ENABLE = !DISABLE
schille 0:5067873a2400 174 } FunctionalState;
schille 0:5067873a2400 175 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
schille 0:5067873a2400 176
schille 0:5067873a2400 177 typedef enum
schille 0:5067873a2400 178 {
schille 0:5067873a2400 179 ERROR = 0,
schille 0:5067873a2400 180 SUCCESS = !ERROR
schille 0:5067873a2400 181 } ErrorStatus;
schille 0:5067873a2400 182
schille 0:5067873a2400 183 /**
schille 0:5067873a2400 184 * @}
schille 0:5067873a2400 185 */
schille 0:5067873a2400 186
schille 0:5067873a2400 187
schille 0:5067873a2400 188 /** @addtogroup Exported_macro
schille 0:5067873a2400 189 * @{
schille 0:5067873a2400 190 */
schille 0:5067873a2400 191 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
schille 0:5067873a2400 192
schille 0:5067873a2400 193 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
schille 0:5067873a2400 194
schille 0:5067873a2400 195 #define READ_BIT(REG, BIT) ((REG) & (BIT))
schille 0:5067873a2400 196
schille 0:5067873a2400 197 #define CLEAR_REG(REG) ((REG) = (0x0))
schille 0:5067873a2400 198
schille 0:5067873a2400 199 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
schille 0:5067873a2400 200
schille 0:5067873a2400 201 #define READ_REG(REG) ((REG))
schille 0:5067873a2400 202
schille 0:5067873a2400 203 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
schille 0:5067873a2400 204
schille 0:5067873a2400 205 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
schille 0:5067873a2400 206
schille 0:5067873a2400 207
schille 0:5067873a2400 208 /**
schille 0:5067873a2400 209 * @}
schille 0:5067873a2400 210 */
schille 0:5067873a2400 211
schille 0:5067873a2400 212 #if defined (USE_HAL_DRIVER)
schille 0:5067873a2400 213 #include "stm32f4xx_hal.h"
schille 0:5067873a2400 214 #endif /* USE_HAL_DRIVER */
schille 0:5067873a2400 215
schille 0:5067873a2400 216 #ifdef __cplusplus
schille 0:5067873a2400 217 }
schille 0:5067873a2400 218 #endif /* __cplusplus */
schille 0:5067873a2400 219
schille 0:5067873a2400 220 #endif /* __STM32F4xx_H */
schille 0:5067873a2400 221 /**
schille 0:5067873a2400 222 * @}
schille 0:5067873a2400 223 */
schille 0:5067873a2400 224
schille 0:5067873a2400 225 /**
schille 0:5067873a2400 226 * @}
schille 0:5067873a2400 227 */
schille 0:5067873a2400 228
schille 0:5067873a2400 229
schille 0:5067873a2400 230
schille 0:5067873a2400 231
schille 0:5067873a2400 232 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/