mbed library with additional peripherals for ST F401 board

Fork of mbed-src by mbed official

This mbed LIB has additional peripherals for ST F401 board

  • UART2 : PA_3 rx, PA_2 tx
  • UART3 : PC_7 rx, PC_6 tx
  • I2C2 : PB_3 SDA, PB_10 SCL
  • I2C3 : PB_4 SDA, PA_8 SCL
Committer:
mbed_official
Date:
Tue Jan 07 11:00:05 2014 +0000
Revision:
70:c1fbde68b492
Parent:
52:a51c77007319
Child:
84:f54042cbc282
Synchronized with git revision 3f438a307904431f2782db3c8fa49946b9fc1d85

Full URL: https://github.com/mbedmicro/mbed/commit/3f438a307904431f2782db3c8fa49946b9fc1d85/

[NUCLEO_F103RB] license text changed + sleep hal updated

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 52:a51c77007319 1 /**
mbed_official 52:a51c77007319 2 ******************************************************************************
mbed_official 52:a51c77007319 3 * @file stm32f10x_gpio.h
mbed_official 52:a51c77007319 4 * @author MCD Application Team
mbed_official 52:a51c77007319 5 * @version V3.5.0
mbed_official 52:a51c77007319 6 * @date 11-March-2011
mbed_official 52:a51c77007319 7 * @brief This file contains all the functions prototypes for the GPIO
mbed_official 52:a51c77007319 8 * firmware library.
mbed_official 70:c1fbde68b492 9 *******************************************************************************
mbed_official 70:c1fbde68b492 10 * Copyright (c) 2014, STMicroelectronics
mbed_official 70:c1fbde68b492 11 * All rights reserved.
mbed_official 70:c1fbde68b492 12 *
mbed_official 70:c1fbde68b492 13 * Redistribution and use in source and binary forms, with or without
mbed_official 70:c1fbde68b492 14 * modification, are permitted provided that the following conditions are met:
mbed_official 70:c1fbde68b492 15 *
mbed_official 70:c1fbde68b492 16 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 70:c1fbde68b492 17 * this list of conditions and the following disclaimer.
mbed_official 70:c1fbde68b492 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 70:c1fbde68b492 19 * this list of conditions and the following disclaimer in the documentation
mbed_official 70:c1fbde68b492 20 * and/or other materials provided with the distribution.
mbed_official 70:c1fbde68b492 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 70:c1fbde68b492 22 * may be used to endorse or promote products derived from this software
mbed_official 70:c1fbde68b492 23 * without specific prior written permission.
mbed_official 70:c1fbde68b492 24 *
mbed_official 70:c1fbde68b492 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 70:c1fbde68b492 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 70:c1fbde68b492 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 70:c1fbde68b492 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 70:c1fbde68b492 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 70:c1fbde68b492 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 70:c1fbde68b492 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 70:c1fbde68b492 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 70:c1fbde68b492 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 70:c1fbde68b492 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 70:c1fbde68b492 35 *******************************************************************************
mbed_official 70:c1fbde68b492 36 */
mbed_official 52:a51c77007319 37
mbed_official 52:a51c77007319 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 52:a51c77007319 39 #ifndef __STM32F10x_GPIO_H
mbed_official 52:a51c77007319 40 #define __STM32F10x_GPIO_H
mbed_official 52:a51c77007319 41
mbed_official 52:a51c77007319 42 #ifdef __cplusplus
mbed_official 52:a51c77007319 43 extern "C" {
mbed_official 52:a51c77007319 44 #endif
mbed_official 52:a51c77007319 45
mbed_official 52:a51c77007319 46 /* Includes ------------------------------------------------------------------*/
mbed_official 52:a51c77007319 47 #include "stm32f10x.h"
mbed_official 52:a51c77007319 48
mbed_official 52:a51c77007319 49 /** @addtogroup STM32F10x_StdPeriph_Driver
mbed_official 52:a51c77007319 50 * @{
mbed_official 52:a51c77007319 51 */
mbed_official 52:a51c77007319 52
mbed_official 52:a51c77007319 53 /** @addtogroup GPIO
mbed_official 52:a51c77007319 54 * @{
mbed_official 52:a51c77007319 55 */
mbed_official 52:a51c77007319 56
mbed_official 52:a51c77007319 57 /** @defgroup GPIO_Exported_Types
mbed_official 52:a51c77007319 58 * @{
mbed_official 52:a51c77007319 59 */
mbed_official 52:a51c77007319 60
mbed_official 52:a51c77007319 61 #define IS_GPIO_ALL_PERIPH(PERIPH) (((PERIPH) == GPIOA) || \
mbed_official 52:a51c77007319 62 ((PERIPH) == GPIOB) || \
mbed_official 52:a51c77007319 63 ((PERIPH) == GPIOC) || \
mbed_official 52:a51c77007319 64 ((PERIPH) == GPIOD) || \
mbed_official 52:a51c77007319 65 ((PERIPH) == GPIOE) || \
mbed_official 52:a51c77007319 66 ((PERIPH) == GPIOF) || \
mbed_official 52:a51c77007319 67 ((PERIPH) == GPIOG))
mbed_official 52:a51c77007319 68
mbed_official 52:a51c77007319 69 /**
mbed_official 52:a51c77007319 70 * @brief Output Maximum frequency selection
mbed_official 52:a51c77007319 71 */
mbed_official 52:a51c77007319 72
mbed_official 52:a51c77007319 73 typedef enum
mbed_official 52:a51c77007319 74 {
mbed_official 52:a51c77007319 75 GPIO_Speed_10MHz = 1,
mbed_official 52:a51c77007319 76 GPIO_Speed_2MHz,
mbed_official 52:a51c77007319 77 GPIO_Speed_50MHz
mbed_official 52:a51c77007319 78 }GPIOSpeed_TypeDef;
mbed_official 52:a51c77007319 79 #define IS_GPIO_SPEED(SPEED) (((SPEED) == GPIO_Speed_10MHz) || ((SPEED) == GPIO_Speed_2MHz) || \
mbed_official 52:a51c77007319 80 ((SPEED) == GPIO_Speed_50MHz))
mbed_official 52:a51c77007319 81
mbed_official 52:a51c77007319 82 /**
mbed_official 52:a51c77007319 83 * @brief Configuration Mode enumeration
mbed_official 52:a51c77007319 84 */
mbed_official 52:a51c77007319 85
mbed_official 52:a51c77007319 86 typedef enum
mbed_official 52:a51c77007319 87 { GPIO_Mode_AIN = 0x0,
mbed_official 52:a51c77007319 88 GPIO_Mode_IN_FLOATING = 0x04,
mbed_official 52:a51c77007319 89 GPIO_Mode_IPD = 0x28,
mbed_official 52:a51c77007319 90 GPIO_Mode_IPU = 0x48,
mbed_official 52:a51c77007319 91 GPIO_Mode_Out_OD = 0x14,
mbed_official 52:a51c77007319 92 GPIO_Mode_Out_PP = 0x10,
mbed_official 52:a51c77007319 93 GPIO_Mode_AF_OD = 0x1C,
mbed_official 52:a51c77007319 94 GPIO_Mode_AF_PP = 0x18
mbed_official 52:a51c77007319 95 }GPIOMode_TypeDef;
mbed_official 52:a51c77007319 96
mbed_official 52:a51c77007319 97 #define IS_GPIO_MODE(MODE) (((MODE) == GPIO_Mode_AIN) || ((MODE) == GPIO_Mode_IN_FLOATING) || \
mbed_official 52:a51c77007319 98 ((MODE) == GPIO_Mode_IPD) || ((MODE) == GPIO_Mode_IPU) || \
mbed_official 52:a51c77007319 99 ((MODE) == GPIO_Mode_Out_OD) || ((MODE) == GPIO_Mode_Out_PP) || \
mbed_official 52:a51c77007319 100 ((MODE) == GPIO_Mode_AF_OD) || ((MODE) == GPIO_Mode_AF_PP))
mbed_official 52:a51c77007319 101
mbed_official 52:a51c77007319 102 /**
mbed_official 52:a51c77007319 103 * @brief GPIO Init structure definition
mbed_official 52:a51c77007319 104 */
mbed_official 52:a51c77007319 105
mbed_official 52:a51c77007319 106 typedef struct
mbed_official 52:a51c77007319 107 {
mbed_official 52:a51c77007319 108 uint16_t GPIO_Pin; /*!< Specifies the GPIO pins to be configured.
mbed_official 52:a51c77007319 109 This parameter can be any value of @ref GPIO_pins_define */
mbed_official 52:a51c77007319 110
mbed_official 52:a51c77007319 111 GPIOSpeed_TypeDef GPIO_Speed; /*!< Specifies the speed for the selected pins.
mbed_official 52:a51c77007319 112 This parameter can be a value of @ref GPIOSpeed_TypeDef */
mbed_official 52:a51c77007319 113
mbed_official 52:a51c77007319 114 GPIOMode_TypeDef GPIO_Mode; /*!< Specifies the operating mode for the selected pins.
mbed_official 52:a51c77007319 115 This parameter can be a value of @ref GPIOMode_TypeDef */
mbed_official 52:a51c77007319 116 }GPIO_InitTypeDef;
mbed_official 52:a51c77007319 117
mbed_official 52:a51c77007319 118
mbed_official 52:a51c77007319 119 /**
mbed_official 52:a51c77007319 120 * @brief Bit_SET and Bit_RESET enumeration
mbed_official 52:a51c77007319 121 */
mbed_official 52:a51c77007319 122
mbed_official 52:a51c77007319 123 typedef enum
mbed_official 52:a51c77007319 124 { Bit_RESET = 0,
mbed_official 52:a51c77007319 125 Bit_SET
mbed_official 52:a51c77007319 126 }BitAction;
mbed_official 52:a51c77007319 127
mbed_official 52:a51c77007319 128 #define IS_GPIO_BIT_ACTION(ACTION) (((ACTION) == Bit_RESET) || ((ACTION) == Bit_SET))
mbed_official 52:a51c77007319 129
mbed_official 52:a51c77007319 130 /**
mbed_official 52:a51c77007319 131 * @}
mbed_official 52:a51c77007319 132 */
mbed_official 52:a51c77007319 133
mbed_official 52:a51c77007319 134 /** @defgroup GPIO_Exported_Constants
mbed_official 52:a51c77007319 135 * @{
mbed_official 52:a51c77007319 136 */
mbed_official 52:a51c77007319 137
mbed_official 52:a51c77007319 138 /** @defgroup GPIO_pins_define
mbed_official 52:a51c77007319 139 * @{
mbed_official 52:a51c77007319 140 */
mbed_official 52:a51c77007319 141
mbed_official 52:a51c77007319 142 #define GPIO_Pin_0 ((uint16_t)0x0001) /*!< Pin 0 selected */
mbed_official 52:a51c77007319 143 #define GPIO_Pin_1 ((uint16_t)0x0002) /*!< Pin 1 selected */
mbed_official 52:a51c77007319 144 #define GPIO_Pin_2 ((uint16_t)0x0004) /*!< Pin 2 selected */
mbed_official 52:a51c77007319 145 #define GPIO_Pin_3 ((uint16_t)0x0008) /*!< Pin 3 selected */
mbed_official 52:a51c77007319 146 #define GPIO_Pin_4 ((uint16_t)0x0010) /*!< Pin 4 selected */
mbed_official 52:a51c77007319 147 #define GPIO_Pin_5 ((uint16_t)0x0020) /*!< Pin 5 selected */
mbed_official 52:a51c77007319 148 #define GPIO_Pin_6 ((uint16_t)0x0040) /*!< Pin 6 selected */
mbed_official 52:a51c77007319 149 #define GPIO_Pin_7 ((uint16_t)0x0080) /*!< Pin 7 selected */
mbed_official 52:a51c77007319 150 #define GPIO_Pin_8 ((uint16_t)0x0100) /*!< Pin 8 selected */
mbed_official 52:a51c77007319 151 #define GPIO_Pin_9 ((uint16_t)0x0200) /*!< Pin 9 selected */
mbed_official 52:a51c77007319 152 #define GPIO_Pin_10 ((uint16_t)0x0400) /*!< Pin 10 selected */
mbed_official 52:a51c77007319 153 #define GPIO_Pin_11 ((uint16_t)0x0800) /*!< Pin 11 selected */
mbed_official 52:a51c77007319 154 #define GPIO_Pin_12 ((uint16_t)0x1000) /*!< Pin 12 selected */
mbed_official 52:a51c77007319 155 #define GPIO_Pin_13 ((uint16_t)0x2000) /*!< Pin 13 selected */
mbed_official 52:a51c77007319 156 #define GPIO_Pin_14 ((uint16_t)0x4000) /*!< Pin 14 selected */
mbed_official 52:a51c77007319 157 #define GPIO_Pin_15 ((uint16_t)0x8000) /*!< Pin 15 selected */
mbed_official 52:a51c77007319 158 #define GPIO_Pin_All ((uint16_t)0xFFFF) /*!< All pins selected */
mbed_official 52:a51c77007319 159
mbed_official 52:a51c77007319 160 #define IS_GPIO_PIN(PIN) ((((PIN) & (uint16_t)0x00) == 0x00) && ((PIN) != (uint16_t)0x00))
mbed_official 52:a51c77007319 161
mbed_official 52:a51c77007319 162 #define IS_GET_GPIO_PIN(PIN) (((PIN) == GPIO_Pin_0) || \
mbed_official 52:a51c77007319 163 ((PIN) == GPIO_Pin_1) || \
mbed_official 52:a51c77007319 164 ((PIN) == GPIO_Pin_2) || \
mbed_official 52:a51c77007319 165 ((PIN) == GPIO_Pin_3) || \
mbed_official 52:a51c77007319 166 ((PIN) == GPIO_Pin_4) || \
mbed_official 52:a51c77007319 167 ((PIN) == GPIO_Pin_5) || \
mbed_official 52:a51c77007319 168 ((PIN) == GPIO_Pin_6) || \
mbed_official 52:a51c77007319 169 ((PIN) == GPIO_Pin_7) || \
mbed_official 52:a51c77007319 170 ((PIN) == GPIO_Pin_8) || \
mbed_official 52:a51c77007319 171 ((PIN) == GPIO_Pin_9) || \
mbed_official 52:a51c77007319 172 ((PIN) == GPIO_Pin_10) || \
mbed_official 52:a51c77007319 173 ((PIN) == GPIO_Pin_11) || \
mbed_official 52:a51c77007319 174 ((PIN) == GPIO_Pin_12) || \
mbed_official 52:a51c77007319 175 ((PIN) == GPIO_Pin_13) || \
mbed_official 52:a51c77007319 176 ((PIN) == GPIO_Pin_14) || \
mbed_official 52:a51c77007319 177 ((PIN) == GPIO_Pin_15))
mbed_official 52:a51c77007319 178
mbed_official 52:a51c77007319 179 /**
mbed_official 52:a51c77007319 180 * @}
mbed_official 52:a51c77007319 181 */
mbed_official 52:a51c77007319 182
mbed_official 52:a51c77007319 183 /** @defgroup GPIO_Remap_define
mbed_official 52:a51c77007319 184 * @{
mbed_official 52:a51c77007319 185 */
mbed_official 52:a51c77007319 186
mbed_official 52:a51c77007319 187 #define GPIO_Remap_SPI1 ((uint32_t)0x00000001) /*!< SPI1 Alternate Function mapping */
mbed_official 52:a51c77007319 188 #define GPIO_Remap_I2C1 ((uint32_t)0x00000002) /*!< I2C1 Alternate Function mapping */
mbed_official 52:a51c77007319 189 #define GPIO_Remap_USART1 ((uint32_t)0x00000004) /*!< USART1 Alternate Function mapping */
mbed_official 52:a51c77007319 190 #define GPIO_Remap_USART2 ((uint32_t)0x00000008) /*!< USART2 Alternate Function mapping */
mbed_official 52:a51c77007319 191 #define GPIO_PartialRemap_USART3 ((uint32_t)0x00140010) /*!< USART3 Partial Alternate Function mapping */
mbed_official 52:a51c77007319 192 #define GPIO_FullRemap_USART3 ((uint32_t)0x00140030) /*!< USART3 Full Alternate Function mapping */
mbed_official 52:a51c77007319 193 #define GPIO_PartialRemap_TIM1 ((uint32_t)0x00160040) /*!< TIM1 Partial Alternate Function mapping */
mbed_official 52:a51c77007319 194 #define GPIO_FullRemap_TIM1 ((uint32_t)0x001600C0) /*!< TIM1 Full Alternate Function mapping */
mbed_official 52:a51c77007319 195 #define GPIO_PartialRemap1_TIM2 ((uint32_t)0x00180100) /*!< TIM2 Partial1 Alternate Function mapping */
mbed_official 52:a51c77007319 196 #define GPIO_PartialRemap2_TIM2 ((uint32_t)0x00180200) /*!< TIM2 Partial2 Alternate Function mapping */
mbed_official 52:a51c77007319 197 #define GPIO_FullRemap_TIM2 ((uint32_t)0x00180300) /*!< TIM2 Full Alternate Function mapping */
mbed_official 52:a51c77007319 198 #define GPIO_PartialRemap_TIM3 ((uint32_t)0x001A0800) /*!< TIM3 Partial Alternate Function mapping */
mbed_official 52:a51c77007319 199 #define GPIO_FullRemap_TIM3 ((uint32_t)0x001A0C00) /*!< TIM3 Full Alternate Function mapping */
mbed_official 52:a51c77007319 200 #define GPIO_Remap_TIM4 ((uint32_t)0x00001000) /*!< TIM4 Alternate Function mapping */
mbed_official 52:a51c77007319 201 #define GPIO_Remap1_CAN1 ((uint32_t)0x001D4000) /*!< CAN1 Alternate Function mapping */
mbed_official 52:a51c77007319 202 #define GPIO_Remap2_CAN1 ((uint32_t)0x001D6000) /*!< CAN1 Alternate Function mapping */
mbed_official 52:a51c77007319 203 #define GPIO_Remap_PD01 ((uint32_t)0x00008000) /*!< PD01 Alternate Function mapping */
mbed_official 52:a51c77007319 204 #define GPIO_Remap_TIM5CH4_LSI ((uint32_t)0x00200001) /*!< LSI connected to TIM5 Channel4 input capture for calibration */
mbed_official 52:a51c77007319 205 #define GPIO_Remap_ADC1_ETRGINJ ((uint32_t)0x00200002) /*!< ADC1 External Trigger Injected Conversion remapping */
mbed_official 52:a51c77007319 206 #define GPIO_Remap_ADC1_ETRGREG ((uint32_t)0x00200004) /*!< ADC1 External Trigger Regular Conversion remapping */
mbed_official 52:a51c77007319 207 #define GPIO_Remap_ADC2_ETRGINJ ((uint32_t)0x00200008) /*!< ADC2 External Trigger Injected Conversion remapping */
mbed_official 52:a51c77007319 208 #define GPIO_Remap_ADC2_ETRGREG ((uint32_t)0x00200010) /*!< ADC2 External Trigger Regular Conversion remapping */
mbed_official 52:a51c77007319 209 #define GPIO_Remap_ETH ((uint32_t)0x00200020) /*!< Ethernet remapping (only for Connectivity line devices) */
mbed_official 52:a51c77007319 210 #define GPIO_Remap_CAN2 ((uint32_t)0x00200040) /*!< CAN2 remapping (only for Connectivity line devices) */
mbed_official 52:a51c77007319 211 #define GPIO_Remap_SWJ_NoJTRST ((uint32_t)0x00300100) /*!< Full SWJ Enabled (JTAG-DP + SW-DP) but without JTRST */
mbed_official 52:a51c77007319 212 #define GPIO_Remap_SWJ_JTAGDisable ((uint32_t)0x00300200) /*!< JTAG-DP Disabled and SW-DP Enabled */
mbed_official 52:a51c77007319 213 #define GPIO_Remap_SWJ_Disable ((uint32_t)0x00300400) /*!< Full SWJ Disabled (JTAG-DP + SW-DP) */
mbed_official 52:a51c77007319 214 #define GPIO_Remap_SPI3 ((uint32_t)0x00201100) /*!< SPI3/I2S3 Alternate Function mapping (only for Connectivity line devices) */
mbed_official 52:a51c77007319 215 #define GPIO_Remap_TIM2ITR1_PTP_SOF ((uint32_t)0x00202000) /*!< Ethernet PTP output or USB OTG SOF (Start of Frame) connected
mbed_official 52:a51c77007319 216 to TIM2 Internal Trigger 1 for calibration
mbed_official 52:a51c77007319 217 (only for Connectivity line devices) */
mbed_official 52:a51c77007319 218 #define GPIO_Remap_PTP_PPS ((uint32_t)0x00204000) /*!< Ethernet MAC PPS_PTS output on PB05 (only for Connectivity line devices) */
mbed_official 52:a51c77007319 219
mbed_official 52:a51c77007319 220 #define GPIO_Remap_TIM15 ((uint32_t)0x80000001) /*!< TIM15 Alternate Function mapping (only for Value line devices) */
mbed_official 52:a51c77007319 221 #define GPIO_Remap_TIM16 ((uint32_t)0x80000002) /*!< TIM16 Alternate Function mapping (only for Value line devices) */
mbed_official 52:a51c77007319 222 #define GPIO_Remap_TIM17 ((uint32_t)0x80000004) /*!< TIM17 Alternate Function mapping (only for Value line devices) */
mbed_official 52:a51c77007319 223 #define GPIO_Remap_CEC ((uint32_t)0x80000008) /*!< CEC Alternate Function mapping (only for Value line devices) */
mbed_official 52:a51c77007319 224 #define GPIO_Remap_TIM1_DMA ((uint32_t)0x80000010) /*!< TIM1 DMA requests mapping (only for Value line devices) */
mbed_official 52:a51c77007319 225
mbed_official 52:a51c77007319 226 #define GPIO_Remap_TIM9 ((uint32_t)0x80000020) /*!< TIM9 Alternate Function mapping (only for XL-density devices) */
mbed_official 52:a51c77007319 227 #define GPIO_Remap_TIM10 ((uint32_t)0x80000040) /*!< TIM10 Alternate Function mapping (only for XL-density devices) */
mbed_official 52:a51c77007319 228 #define GPIO_Remap_TIM11 ((uint32_t)0x80000080) /*!< TIM11 Alternate Function mapping (only for XL-density devices) */
mbed_official 52:a51c77007319 229 #define GPIO_Remap_TIM13 ((uint32_t)0x80000100) /*!< TIM13 Alternate Function mapping (only for High density Value line and XL-density devices) */
mbed_official 52:a51c77007319 230 #define GPIO_Remap_TIM14 ((uint32_t)0x80000200) /*!< TIM14 Alternate Function mapping (only for High density Value line and XL-density devices) */
mbed_official 52:a51c77007319 231 #define GPIO_Remap_FSMC_NADV ((uint32_t)0x80000400) /*!< FSMC_NADV Alternate Function mapping (only for High density Value line and XL-density devices) */
mbed_official 52:a51c77007319 232
mbed_official 52:a51c77007319 233 #define GPIO_Remap_TIM67_DAC_DMA ((uint32_t)0x80000800) /*!< TIM6/TIM7 and DAC DMA requests remapping (only for High density Value line devices) */
mbed_official 52:a51c77007319 234 #define GPIO_Remap_TIM12 ((uint32_t)0x80001000) /*!< TIM12 Alternate Function mapping (only for High density Value line devices) */
mbed_official 52:a51c77007319 235 #define GPIO_Remap_MISC ((uint32_t)0x80002000) /*!< Miscellaneous Remap (DMA2 Channel5 Position and DAC Trigger remapping,
mbed_official 52:a51c77007319 236 only for High density Value line devices) */
mbed_official 52:a51c77007319 237
mbed_official 52:a51c77007319 238 #define IS_GPIO_REMAP(REMAP) (((REMAP) == GPIO_Remap_SPI1) || ((REMAP) == GPIO_Remap_I2C1) || \
mbed_official 52:a51c77007319 239 ((REMAP) == GPIO_Remap_USART1) || ((REMAP) == GPIO_Remap_USART2) || \
mbed_official 52:a51c77007319 240 ((REMAP) == GPIO_PartialRemap_USART3) || ((REMAP) == GPIO_FullRemap_USART3) || \
mbed_official 52:a51c77007319 241 ((REMAP) == GPIO_PartialRemap_TIM1) || ((REMAP) == GPIO_FullRemap_TIM1) || \
mbed_official 52:a51c77007319 242 ((REMAP) == GPIO_PartialRemap1_TIM2) || ((REMAP) == GPIO_PartialRemap2_TIM2) || \
mbed_official 52:a51c77007319 243 ((REMAP) == GPIO_FullRemap_TIM2) || ((REMAP) == GPIO_PartialRemap_TIM3) || \
mbed_official 52:a51c77007319 244 ((REMAP) == GPIO_FullRemap_TIM3) || ((REMAP) == GPIO_Remap_TIM4) || \
mbed_official 52:a51c77007319 245 ((REMAP) == GPIO_Remap1_CAN1) || ((REMAP) == GPIO_Remap2_CAN1) || \
mbed_official 52:a51c77007319 246 ((REMAP) == GPIO_Remap_PD01) || ((REMAP) == GPIO_Remap_TIM5CH4_LSI) || \
mbed_official 52:a51c77007319 247 ((REMAP) == GPIO_Remap_ADC1_ETRGINJ) ||((REMAP) == GPIO_Remap_ADC1_ETRGREG) || \
mbed_official 52:a51c77007319 248 ((REMAP) == GPIO_Remap_ADC2_ETRGINJ) ||((REMAP) == GPIO_Remap_ADC2_ETRGREG) || \
mbed_official 52:a51c77007319 249 ((REMAP) == GPIO_Remap_ETH) ||((REMAP) == GPIO_Remap_CAN2) || \
mbed_official 52:a51c77007319 250 ((REMAP) == GPIO_Remap_SWJ_NoJTRST) || ((REMAP) == GPIO_Remap_SWJ_JTAGDisable) || \
mbed_official 52:a51c77007319 251 ((REMAP) == GPIO_Remap_SWJ_Disable)|| ((REMAP) == GPIO_Remap_SPI3) || \
mbed_official 52:a51c77007319 252 ((REMAP) == GPIO_Remap_TIM2ITR1_PTP_SOF) || ((REMAP) == GPIO_Remap_PTP_PPS) || \
mbed_official 52:a51c77007319 253 ((REMAP) == GPIO_Remap_TIM15) || ((REMAP) == GPIO_Remap_TIM16) || \
mbed_official 52:a51c77007319 254 ((REMAP) == GPIO_Remap_TIM17) || ((REMAP) == GPIO_Remap_CEC) || \
mbed_official 52:a51c77007319 255 ((REMAP) == GPIO_Remap_TIM1_DMA) || ((REMAP) == GPIO_Remap_TIM9) || \
mbed_official 52:a51c77007319 256 ((REMAP) == GPIO_Remap_TIM10) || ((REMAP) == GPIO_Remap_TIM11) || \
mbed_official 52:a51c77007319 257 ((REMAP) == GPIO_Remap_TIM13) || ((REMAP) == GPIO_Remap_TIM14) || \
mbed_official 52:a51c77007319 258 ((REMAP) == GPIO_Remap_FSMC_NADV) || ((REMAP) == GPIO_Remap_TIM67_DAC_DMA) || \
mbed_official 52:a51c77007319 259 ((REMAP) == GPIO_Remap_TIM12) || ((REMAP) == GPIO_Remap_MISC))
mbed_official 52:a51c77007319 260
mbed_official 52:a51c77007319 261 /**
mbed_official 52:a51c77007319 262 * @}
mbed_official 52:a51c77007319 263 */
mbed_official 52:a51c77007319 264
mbed_official 52:a51c77007319 265 /** @defgroup GPIO_Port_Sources
mbed_official 52:a51c77007319 266 * @{
mbed_official 52:a51c77007319 267 */
mbed_official 52:a51c77007319 268
mbed_official 52:a51c77007319 269 #define GPIO_PortSourceGPIOA ((uint8_t)0x00)
mbed_official 52:a51c77007319 270 #define GPIO_PortSourceGPIOB ((uint8_t)0x01)
mbed_official 52:a51c77007319 271 #define GPIO_PortSourceGPIOC ((uint8_t)0x02)
mbed_official 52:a51c77007319 272 #define GPIO_PortSourceGPIOD ((uint8_t)0x03)
mbed_official 52:a51c77007319 273 #define GPIO_PortSourceGPIOE ((uint8_t)0x04)
mbed_official 52:a51c77007319 274 #define GPIO_PortSourceGPIOF ((uint8_t)0x05)
mbed_official 52:a51c77007319 275 #define GPIO_PortSourceGPIOG ((uint8_t)0x06)
mbed_official 52:a51c77007319 276 #define IS_GPIO_EVENTOUT_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == GPIO_PortSourceGPIOA) || \
mbed_official 52:a51c77007319 277 ((PORTSOURCE) == GPIO_PortSourceGPIOB) || \
mbed_official 52:a51c77007319 278 ((PORTSOURCE) == GPIO_PortSourceGPIOC) || \
mbed_official 52:a51c77007319 279 ((PORTSOURCE) == GPIO_PortSourceGPIOD) || \
mbed_official 52:a51c77007319 280 ((PORTSOURCE) == GPIO_PortSourceGPIOE))
mbed_official 52:a51c77007319 281
mbed_official 52:a51c77007319 282 #define IS_GPIO_EXTI_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == GPIO_PortSourceGPIOA) || \
mbed_official 52:a51c77007319 283 ((PORTSOURCE) == GPIO_PortSourceGPIOB) || \
mbed_official 52:a51c77007319 284 ((PORTSOURCE) == GPIO_PortSourceGPIOC) || \
mbed_official 52:a51c77007319 285 ((PORTSOURCE) == GPIO_PortSourceGPIOD) || \
mbed_official 52:a51c77007319 286 ((PORTSOURCE) == GPIO_PortSourceGPIOE) || \
mbed_official 52:a51c77007319 287 ((PORTSOURCE) == GPIO_PortSourceGPIOF) || \
mbed_official 52:a51c77007319 288 ((PORTSOURCE) == GPIO_PortSourceGPIOG))
mbed_official 52:a51c77007319 289
mbed_official 52:a51c77007319 290 /**
mbed_official 52:a51c77007319 291 * @}
mbed_official 52:a51c77007319 292 */
mbed_official 52:a51c77007319 293
mbed_official 52:a51c77007319 294 /** @defgroup GPIO_Pin_sources
mbed_official 52:a51c77007319 295 * @{
mbed_official 52:a51c77007319 296 */
mbed_official 52:a51c77007319 297
mbed_official 52:a51c77007319 298 #define GPIO_PinSource0 ((uint8_t)0x00)
mbed_official 52:a51c77007319 299 #define GPIO_PinSource1 ((uint8_t)0x01)
mbed_official 52:a51c77007319 300 #define GPIO_PinSource2 ((uint8_t)0x02)
mbed_official 52:a51c77007319 301 #define GPIO_PinSource3 ((uint8_t)0x03)
mbed_official 52:a51c77007319 302 #define GPIO_PinSource4 ((uint8_t)0x04)
mbed_official 52:a51c77007319 303 #define GPIO_PinSource5 ((uint8_t)0x05)
mbed_official 52:a51c77007319 304 #define GPIO_PinSource6 ((uint8_t)0x06)
mbed_official 52:a51c77007319 305 #define GPIO_PinSource7 ((uint8_t)0x07)
mbed_official 52:a51c77007319 306 #define GPIO_PinSource8 ((uint8_t)0x08)
mbed_official 52:a51c77007319 307 #define GPIO_PinSource9 ((uint8_t)0x09)
mbed_official 52:a51c77007319 308 #define GPIO_PinSource10 ((uint8_t)0x0A)
mbed_official 52:a51c77007319 309 #define GPIO_PinSource11 ((uint8_t)0x0B)
mbed_official 52:a51c77007319 310 #define GPIO_PinSource12 ((uint8_t)0x0C)
mbed_official 52:a51c77007319 311 #define GPIO_PinSource13 ((uint8_t)0x0D)
mbed_official 52:a51c77007319 312 #define GPIO_PinSource14 ((uint8_t)0x0E)
mbed_official 52:a51c77007319 313 #define GPIO_PinSource15 ((uint8_t)0x0F)
mbed_official 52:a51c77007319 314
mbed_official 52:a51c77007319 315 #define IS_GPIO_PIN_SOURCE(PINSOURCE) (((PINSOURCE) == GPIO_PinSource0) || \
mbed_official 52:a51c77007319 316 ((PINSOURCE) == GPIO_PinSource1) || \
mbed_official 52:a51c77007319 317 ((PINSOURCE) == GPIO_PinSource2) || \
mbed_official 52:a51c77007319 318 ((PINSOURCE) == GPIO_PinSource3) || \
mbed_official 52:a51c77007319 319 ((PINSOURCE) == GPIO_PinSource4) || \
mbed_official 52:a51c77007319 320 ((PINSOURCE) == GPIO_PinSource5) || \
mbed_official 52:a51c77007319 321 ((PINSOURCE) == GPIO_PinSource6) || \
mbed_official 52:a51c77007319 322 ((PINSOURCE) == GPIO_PinSource7) || \
mbed_official 52:a51c77007319 323 ((PINSOURCE) == GPIO_PinSource8) || \
mbed_official 52:a51c77007319 324 ((PINSOURCE) == GPIO_PinSource9) || \
mbed_official 52:a51c77007319 325 ((PINSOURCE) == GPIO_PinSource10) || \
mbed_official 52:a51c77007319 326 ((PINSOURCE) == GPIO_PinSource11) || \
mbed_official 52:a51c77007319 327 ((PINSOURCE) == GPIO_PinSource12) || \
mbed_official 52:a51c77007319 328 ((PINSOURCE) == GPIO_PinSource13) || \
mbed_official 52:a51c77007319 329 ((PINSOURCE) == GPIO_PinSource14) || \
mbed_official 52:a51c77007319 330 ((PINSOURCE) == GPIO_PinSource15))
mbed_official 52:a51c77007319 331
mbed_official 52:a51c77007319 332 /**
mbed_official 52:a51c77007319 333 * @}
mbed_official 52:a51c77007319 334 */
mbed_official 52:a51c77007319 335
mbed_official 52:a51c77007319 336 /** @defgroup Ethernet_Media_Interface
mbed_official 52:a51c77007319 337 * @{
mbed_official 52:a51c77007319 338 */
mbed_official 52:a51c77007319 339 #define GPIO_ETH_MediaInterface_MII ((u32)0x00000000)
mbed_official 52:a51c77007319 340 #define GPIO_ETH_MediaInterface_RMII ((u32)0x00000001)
mbed_official 52:a51c77007319 341
mbed_official 52:a51c77007319 342 #define IS_GPIO_ETH_MEDIA_INTERFACE(INTERFACE) (((INTERFACE) == GPIO_ETH_MediaInterface_MII) || \
mbed_official 52:a51c77007319 343 ((INTERFACE) == GPIO_ETH_MediaInterface_RMII))
mbed_official 52:a51c77007319 344
mbed_official 52:a51c77007319 345 /**
mbed_official 52:a51c77007319 346 * @}
mbed_official 52:a51c77007319 347 */
mbed_official 52:a51c77007319 348 /**
mbed_official 52:a51c77007319 349 * @}
mbed_official 52:a51c77007319 350 */
mbed_official 52:a51c77007319 351
mbed_official 52:a51c77007319 352 /** @defgroup GPIO_Exported_Macros
mbed_official 52:a51c77007319 353 * @{
mbed_official 52:a51c77007319 354 */
mbed_official 52:a51c77007319 355
mbed_official 52:a51c77007319 356 /**
mbed_official 52:a51c77007319 357 * @}
mbed_official 52:a51c77007319 358 */
mbed_official 52:a51c77007319 359
mbed_official 52:a51c77007319 360 /** @defgroup GPIO_Exported_Functions
mbed_official 52:a51c77007319 361 * @{
mbed_official 52:a51c77007319 362 */
mbed_official 52:a51c77007319 363
mbed_official 52:a51c77007319 364 void GPIO_DeInit(GPIO_TypeDef* GPIOx);
mbed_official 52:a51c77007319 365 void GPIO_AFIODeInit(void);
mbed_official 52:a51c77007319 366 void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);
mbed_official 52:a51c77007319 367 void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct);
mbed_official 52:a51c77007319 368 uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
mbed_official 52:a51c77007319 369 uint16_t GPIO_ReadInputData(GPIO_TypeDef* GPIOx);
mbed_official 52:a51c77007319 370 uint8_t GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
mbed_official 52:a51c77007319 371 uint16_t GPIO_ReadOutputData(GPIO_TypeDef* GPIOx);
mbed_official 52:a51c77007319 372 void GPIO_SetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
mbed_official 52:a51c77007319 373 void GPIO_ResetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
mbed_official 52:a51c77007319 374 void GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal);
mbed_official 52:a51c77007319 375 void GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal);
mbed_official 52:a51c77007319 376 void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
mbed_official 52:a51c77007319 377 void GPIO_EventOutputConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource);
mbed_official 52:a51c77007319 378 void GPIO_EventOutputCmd(FunctionalState NewState);
mbed_official 52:a51c77007319 379 void GPIO_PinRemapConfig(uint32_t GPIO_Remap, FunctionalState NewState);
mbed_official 52:a51c77007319 380 void GPIO_EXTILineConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource);
mbed_official 52:a51c77007319 381 void GPIO_ETH_MediaInterfaceConfig(uint32_t GPIO_ETH_MediaInterface);
mbed_official 52:a51c77007319 382
mbed_official 52:a51c77007319 383 #ifdef __cplusplus
mbed_official 52:a51c77007319 384 }
mbed_official 52:a51c77007319 385 #endif
mbed_official 52:a51c77007319 386
mbed_official 52:a51c77007319 387 #endif /* __STM32F10x_GPIO_H */
mbed_official 52:a51c77007319 388 /**
mbed_official 52:a51c77007319 389 * @}
mbed_official 52:a51c77007319 390 */
mbed_official 52:a51c77007319 391
mbed_official 52:a51c77007319 392 /**
mbed_official 52:a51c77007319 393 * @}
mbed_official 52:a51c77007319 394 */
mbed_official 52:a51c77007319 395
mbed_official 52:a51c77007319 396 /**
mbed_official 52:a51c77007319 397 * @}
mbed_official 52:a51c77007319 398 */
mbed_official 52:a51c77007319 399
mbed_official 52:a51c77007319 400 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/