]> git.gag.com Git - fw/stlink/blobdiff - example/libstm32l_discovery/src/stm32l1xx_gpio.c
Restructure libs source to support multi platform
[fw/stlink] / example / libstm32l_discovery / src / stm32l1xx_gpio.c
diff --git a/example/libstm32l_discovery/src/stm32l1xx_gpio.c b/example/libstm32l_discovery/src/stm32l1xx_gpio.c
deleted file mode 100644 (file)
index ad2db4f..0000000
+++ /dev/null
@@ -1,546 +0,0 @@
-/**\r
-  ******************************************************************************\r
-  * @file    stm32l1xx_gpio.c\r
-  * @author  MCD Application Team\r
-  * @version V1.0.0\r
-  * @date    31-December-2010\r
-  * @brief   This file provides firmware functions to manage the following \r
-  *          functionalities of the GPIO peripheral:           \r
-  *           - Initialization and Configuration\r
-  *           - GPIO Read and Write\r
-  *           - GPIO Alternate functions configuration\r
-  * \r
-  *  @verbatim\r
-  *\r
-  *          ===================================================================\r
-  *                                 How to use this driver\r
-  *          ===================================================================       \r
-  *           1. Enable the GPIO AHB clock using RCC_AHBPeriphClockCmd()\r
-  *             \r
-  *           2. Configure the GPIO pin(s) using GPIO_Init()\r
-  *              Four possible configuration are available for each pin:\r
-  *                - Input: Floating, Pull-up, Pull-down.\r
-  *                - Output: Push-Pull (Pull-up, Pull-down or no Pull)\r
-  *                          Open Drain (Pull-up, Pull-down or no Pull).\r
-  *                  In output mode, the speed is configurable: Very Low, Low,\r
-  *                  Medium or High.\r
-  *                - Alternate Function: Push-Pull (Pull-up, Pull-down or no Pull)\r
-  *                                      Open Drain (Pull-up, Pull-down or no Pull).\r
-  *                - Analog: required mode when a pin is to be used as ADC channel,\r
-  *                          DAC output or comparator input.\r
-  * \r
-  *          3- Peripherals alternate function:\r
-  *              - For ADC, DAC and comparators, configure the desired pin in \r
-  *                analog mode using GPIO_InitStruct->GPIO_Mode = GPIO_Mode_AN\r
-  *              - For other peripherals (TIM, USART...):\r
-  *                 - Connect the pin to the desired peripherals' Alternate \r
-  *                   Function (AF) using GPIO_PinAFConfig() function\r
-  *                 - Configure the desired pin in alternate function mode using\r
-  *                   GPIO_InitStruct->GPIO_Mode = GPIO_Mode_AF\r
-  *                 - Select the type, pull-up/pull-down and output speed via \r
-  *                   GPIO_PuPd, GPIO_OType and GPIO_Speed members\r
-  *                 - Call GPIO_Init() function\r
-  *        \r
-  *          4. To get the level of a pin configured in input mode use GPIO_ReadInputDataBit()\r
-  *          \r
-  *          5. To set/reset the level of a pin configured in output mode use\r
-  *             GPIO_SetBits()/GPIO_ResetBits()\r
-  *               \r
-  *          6. During and just after reset, the alternate functions are not \r
-  *             active and the GPIO pins are configured in input floating mode\r
-  *             (except JTAG pins).\r
-  *\r
-  *          7. The LSE oscillator pins OSC32_IN and OSC32_OUT can be used as \r
-  *             general-purpose (PC14 and PC15, respectively) when the LSE\r
-  *             oscillator is off. The LSE has priority over the GPIO function.\r
-  *\r
-  *          8. The HSE oscillator pins OSC_IN/OSC_OUT can be used as \r
-  *             general-purpose PH0 and PH1, respectively, when the HSE \r
-  *             oscillator is off. The HSE has priority over the GPIO function.\r
-  *             \r
-  *  @endverbatim        \r
-  *\r
-  ******************************************************************************\r
-  * @attention\r
-  *\r
-  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
-  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
-  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
-  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
-  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
-  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
-  *\r
-  * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>\r
-  ******************************************************************************  \r
-  */ \r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "stm32l1xx_gpio.h"\r
-#include "stm32l1xx_rcc.h"\r
-\r
-/** @addtogroup STM32L1xx_StdPeriph_Driver\r
-  * @{\r
-  */\r
-\r
-/** @defgroup GPIO \r
-  * @brief GPIO driver modules\r
-  * @{\r
-  */\r
-\r
-/* Private typedef -----------------------------------------------------------*/\r
-/* Private define ------------------------------------------------------------*/\r
-/* Private macro -------------------------------------------------------------*/\r
-/* Private variables ---------------------------------------------------------*/\r
-/* Private function prototypes -----------------------------------------------*/\r
-/* Private functions ---------------------------------------------------------*/\r
-\r
-/** @defgroup GPIO_Private_Functions\r
-  * @{\r
-  */\r
-\r
-/** @defgroup GPIO_Group1 Initialization and Configuration\r
- *  @brief   Initialization and Configuration\r
- *\r
-@verbatim   \r
- ===============================================================================\r
-                        Initialization and Configuration\r
- ===============================================================================  \r
-\r
-@endverbatim\r
-  * @{\r
-  */\r
-\r
-/**\r
-  * @brief  Deinitializes the GPIOx peripheral registers to their default reset \r
-  *         values.\r
-  *         By default, The GPIO pins are configured in input floating mode\r
-  *         (except JTAG pins).\r
-  * @param  GPIOx: where x can be (A, B, C, D, E or H) to select the GPIO peripheral.\r
-  * @retval None\r
-  */\r
-void GPIO_DeInit(GPIO_TypeDef* GPIOx)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-\r
-  if(GPIOx == GPIOA)\r
-  {\r
-    RCC_AHBPeriphResetCmd(RCC_AHBPeriph_GPIOA, ENABLE);\r
-    RCC_AHBPeriphResetCmd(RCC_AHBPeriph_GPIOA, DISABLE);  \r
-  }\r
-  else if(GPIOx == GPIOB)\r
-  {\r
-    RCC_AHBPeriphResetCmd(RCC_AHBPeriph_GPIOB, ENABLE);\r
-    RCC_AHBPeriphResetCmd(RCC_AHBPeriph_GPIOB, DISABLE);\r
-  }\r
-  else if(GPIOx == GPIOC)\r
-  {\r
-    RCC_AHBPeriphResetCmd(RCC_AHBPeriph_GPIOC, ENABLE);\r
-    RCC_AHBPeriphResetCmd(RCC_AHBPeriph_GPIOC, DISABLE);\r
-  }\r
-  else if(GPIOx == GPIOD)\r
-  {\r
-    RCC_AHBPeriphResetCmd(RCC_AHBPeriph_GPIOD, ENABLE);\r
-    RCC_AHBPeriphResetCmd(RCC_AHBPeriph_GPIOD, DISABLE);\r
-  }\r
-  else if(GPIOx == GPIOE)\r
-  {\r
-      RCC_AHBPeriphResetCmd(RCC_AHBPeriph_GPIOE, ENABLE);\r
-      RCC_AHBPeriphResetCmd(RCC_AHBPeriph_GPIOE, DISABLE);\r
-  }\r
-  else\r
-  {\r
-    if(GPIOx == GPIOH)\r
-    {\r
-      RCC_AHBPeriphResetCmd(RCC_AHBPeriph_GPIOH, ENABLE);\r
-      RCC_AHBPeriphResetCmd(RCC_AHBPeriph_GPIOH, DISABLE);\r
-    }\r
-  }\r
-}\r
-\r
-/**\r
-  * @brief  Initializes the GPIOx peripheral according to the specified \r
-  *         parameters in the GPIO_InitStruct.\r
-  * @param  GPIOx: where x can be (A, B, C, D, E or H) to select the GPIO peripheral.\r
-  * @param  GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure that \r
-  *         contains the configuration information for the specified GPIO\r
-  *         peripheral.\r
-  *         GPIO_Pin: selects the pin to be configured: GPIO_Pin_0 -> GPIO_Pin_15\r
-  *         GPIO_Mode: selects the mode of the pin: \r
-  *                      - Input mode: GPIO_Mode_IN\r
-  *                      - Output mode: GPIO_Mode_OUT\r
-  *                      - Alternate Function mode: GPIO_Mode_AF\r
-  *                      - Analog mode: GPIO_Mode_AN\r
-  *         GPIO_Speed: selects the speed of the pin if configured in Output:\r
-  *                      - Very Low: GPIO_Speed_400KHz\r
-  *                      - Low: GPIO_Speed_2MHz\r
-  *                      - Medium: GPIO_Speed_10MHz\r
-  *                      - High: GPIO_Speed_40MHz\r
-  *         GPIO_OType: selects the Output type (if the selected mode is output):\r
-  *                      - Push-pull: GPIO_OType_PP\r
-  *                      - Open Drain: GPIO_OType_OD\r
-  *         GPIO_PuPd: configures the Pull-up/Pull-down resistor on the pin:\r
-  *                      - pull-up: GPIO_PuPd_UP\r
-  *                      - pull-down: GPIO_PuPd_DOWN\r
-  *                      - Neither pull-up nor Pull-down: GPIO_PuPd_NOPULL\r
-  * @retval None\r
-  */\r
-void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)\r
-{\r
-  uint32_t pinpos = 0x00, pos = 0x00 , currentpin = 0x00;\r
-  \r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  assert_param(IS_GPIO_PIN(GPIO_InitStruct->GPIO_Pin));\r
-  assert_param(IS_GPIO_MODE(GPIO_InitStruct->GPIO_Mode));\r
-  assert_param(IS_GPIO_PUPD(GPIO_InitStruct->GPIO_PuPd));\r
-\r
-  /* -------------------------Configure the port pins---------------- */\r
-  /*-- GPIO Mode Configuration --*/\r
-  for (pinpos = 0x00; pinpos < 0x10; pinpos++)\r
-  {\r
-    pos = ((uint32_t)0x01) << pinpos;\r
-\r
-    /* Get the port pins position */\r
-    currentpin = (GPIO_InitStruct->GPIO_Pin) & pos;\r
-\r
-    if (currentpin == pos)\r
-    {\r
-      GPIOx->MODER  &= ~(GPIO_MODER_MODER0 << (pinpos * 2));\r
-\r
-      GPIOx->MODER |= (((uint32_t)GPIO_InitStruct->GPIO_Mode) << (pinpos * 2));\r
-\r
-      if ((GPIO_InitStruct->GPIO_Mode == GPIO_Mode_OUT) || (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_AF))\r
-      {\r
-        /* Check Speed mode parameters */\r
-        assert_param(IS_GPIO_SPEED(GPIO_InitStruct->GPIO_Speed));\r
-\r
-        /* Speed mode configuration */\r
-        GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << (pinpos * 2));\r
-        GPIOx->OSPEEDR |= ((uint32_t)(GPIO_InitStruct->GPIO_Speed) << (pinpos * 2));\r
-\r
-        /*Check Output mode parameters */\r
-        assert_param(IS_GPIO_OTYPE(GPIO_InitStruct->GPIO_OType));\r
-\r
-        /* Output mode configuration */\r
-        GPIOx->OTYPER  &= ~((GPIO_OTYPER_OT_0) << ((uint16_t)pinpos)) ;\r
-        GPIOx->OTYPER |= (uint16_t)(((uint16_t)GPIO_InitStruct->GPIO_OType) << ((uint16_t)pinpos));\r
-      }\r
-\r
-      /* Pull-up Pull down resistor configuration */\r
-      GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)pinpos * 2));\r
-      GPIOx->PUPDR |= (((uint32_t)GPIO_InitStruct->GPIO_PuPd) << (pinpos * 2));\r
-    }\r
-  }\r
-}\r
-\r
-/**\r
-  * @brief  Fills each GPIO_InitStruct member with its default value.\r
-  * @param  GPIO_InitStruct : pointer to a GPIO_InitTypeDef structure which will \r
-  *         be initialized.\r
-  * @retval None\r
-  */\r
-void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct)\r
-{\r
-  /* Reset GPIO init structure parameters values */\r
-  GPIO_InitStruct->GPIO_Pin  = GPIO_Pin_All;\r
-  GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IN;\r
-  GPIO_InitStruct->GPIO_Speed = GPIO_Speed_400KHz;\r
-  GPIO_InitStruct->GPIO_OType = GPIO_OType_PP;\r
-  GPIO_InitStruct->GPIO_PuPd = GPIO_PuPd_NOPULL;\r
-}\r
-\r
-/**\r
-  * @brief  Locks GPIO Pins configuration registers.\r
-  *         The locked registers are GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR,\r
-  *         GPIOx_PUPDR, GPIOx_AFRL and GPIOx_AFRH.\r
-  *         The configuration of the locked GPIO pins can no longer be modified\r
-  *         until the next reset.\r
-  * @param  GPIOx: where x can be (A, B, C, D, E or H) to select the GPIO peripheral.\r
-  * @param  GPIO_Pin: specifies the port bit to be written.\r
-  *   This parameter can be any combination of GPIO_Pin_x where x can be (0..15).\r
-  * @retval None\r
-  */\r
-void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)\r
-{\r
-  uint32_t tmp = 0x00010000;\r
-  \r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  assert_param(IS_GPIO_PIN(GPIO_Pin));\r
-  \r
-  tmp |= GPIO_Pin;\r
-  /* Set LCKK bit */\r
-  GPIOx->LCKR = tmp;\r
-  /* Reset LCKK bit */\r
-  GPIOx->LCKR =  GPIO_Pin;\r
-  /* Set LCKK bit */\r
-  GPIOx->LCKR = tmp;\r
-  /* Read LCKK bit*/\r
-  tmp = GPIOx->LCKR;\r
-  /* Read LCKK bit*/\r
-  tmp = GPIOx->LCKR;\r
-}\r
-\r
-/**\r
-  * @}\r
-  */\r
-\r
-/** @defgroup GPIO_Group2 GPIO Read and Write\r
- *  @brief   GPIO Read and Write\r
- *\r
-@verbatim   \r
- ===============================================================================\r
-                              GPIO Read and Write\r
- ===============================================================================  \r
-\r
-@endverbatim\r
-  * @{\r
-  */\r
-\r
-/**\r
-  * @brief  Reads the specified input port pin.\r
-  * @param  GPIOx: where x can be (A, B, C, D, E or H) to select the GPIO peripheral.\r
-  * @param  GPIO_Pin: specifies the port bit to read.\r
-  *   This parameter can be GPIO_Pin_x where x can be (0..15).\r
-  * @retval The input port pin value.\r
-  */\r
-uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)\r
-{\r
-  uint8_t bitstatus = 0x00;\r
-  \r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  assert_param(IS_GET_GPIO_PIN(GPIO_Pin));\r
-\r
-  if ((GPIOx->IDR & GPIO_Pin) != (uint32_t)Bit_RESET)\r
-  {\r
-    bitstatus = (uint8_t)Bit_SET;\r
-  }\r
-  else\r
-  {\r
-    bitstatus = (uint8_t)Bit_RESET;\r
-  }\r
-  return bitstatus;\r
-}\r
-\r
-/**\r
-  * @brief  Reads the specified GPIO input data port.\r
-  * @param  GPIOx: where x can be (A, B, C, D, E or H) to select the GPIO peripheral.\r
-  * @retval GPIO input data port value.\r
-  */\r
-uint16_t GPIO_ReadInputData(GPIO_TypeDef* GPIOx)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  \r
-  return ((uint16_t)GPIOx->IDR);\r
-}\r
-\r
-/**\r
-  * @brief  Reads the specified output data port bit.\r
-  * @param  GPIOx: where x can be (A, B, C, D, E or H) to select the GPIO peripheral.\r
-  * @param  GPIO_Pin: Specifies the port bit to read.\r
-  *   This parameter can be GPIO_Pin_x where x can be (0..15).\r
-  * @retval The output port pin value.\r
-  */\r
-uint8_t GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)\r
-{\r
-  uint8_t bitstatus = 0x00;\r
-\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  assert_param(IS_GET_GPIO_PIN(GPIO_Pin));\r
-  \r
-  if ((GPIOx->ODR & GPIO_Pin) != (uint32_t)Bit_RESET)\r
-  {\r
-    bitstatus = (uint8_t)Bit_SET;\r
-  }\r
-  else\r
-  {\r
-    bitstatus = (uint8_t)Bit_RESET;\r
-  }\r
-  return bitstatus;\r
-}\r
-\r
-/**\r
-  * @brief  Reads the specified GPIO output data port.\r
-  * @param  GPIOx: where x can be (A, B, C, D, E or H) to select the GPIO peripheral.\r
-  * @retval GPIO output data port value.\r
-  */\r
-uint16_t GPIO_ReadOutputData(GPIO_TypeDef* GPIOx)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  \r
-  return ((uint16_t)GPIOx->ODR);\r
-}\r
-\r
-/**\r
-  * @brief  Sets the selected data port bits.\r
-  * @param  GPIOx: where x can be (A, B, C, D, E or H) to select the GPIO peripheral.\r
-  * @param  GPIO_Pin: specifies the port bits to be written.\r
-  *   This parameter can be any combination of GPIO_Pin_x where x can be (0..15).\r
-  * @note  This functions uses GPIOx_BSRR register to allow atomic read/modify \r
-  *        accesses. In this way, there is no risk of an IRQ occurring between\r
-  *        the read and the modify access.\r
-  * @retval None\r
-  */\r
-void GPIO_SetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  assert_param(IS_GPIO_PIN(GPIO_Pin));\r
-  \r
-  GPIOx->BSRRL = GPIO_Pin;\r
-}\r
-\r
-/**\r
-  * @brief  Clears the selected data port bits.\r
-  * @param  GPIOx: where x can be (A, B, C, D, E or H) to select the GPIO peripheral.\r
-  * @param  GPIO_Pin: specifies the port bits to be written.\r
-  *   This parameter can be any combination of GPIO_Pin_x where x can be (0..15).\r
-  * @note  This functions uses GPIOx_BSRR register to allow atomic read/modify \r
-  *        accesses. In this way, there is no risk of an IRQ occurring between\r
-  *        the read and the modify access.\r
-  * @retval None\r
-  */\r
-void GPIO_ResetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  assert_param(IS_GPIO_PIN(GPIO_Pin));\r
-  \r
-  GPIOx->BSRRH = GPIO_Pin;\r
-}\r
-\r
-/**\r
-  * @brief  Sets or clears the selected data port bit.\r
-  * @param  GPIOx: where x can be (A, B, C, D, E or H) to select the GPIO peripheral.\r
-  * @param  GPIO_Pin: specifies the port bit to be written.\r
-  *   This parameter can be one of GPIO_Pin_x where x can be (0..15).\r
-  * @param  BitVal: specifies the value to be written to the selected bit.\r
-  *   This parameter can be one of the BitAction enum values:\r
-  *     @arg Bit_RESET: to clear the port pin\r
-  *     @arg Bit_SET: to set the port pin\r
-  * @retval None\r
-  */\r
-void GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  assert_param(IS_GET_GPIO_PIN(GPIO_Pin));\r
-  assert_param(IS_GPIO_BIT_ACTION(BitVal));\r
-  \r
-  if (BitVal != Bit_RESET)\r
-  {\r
-    GPIOx->BSRRL = GPIO_Pin;\r
-  }\r
-  else\r
-  {\r
-    GPIOx->BSRRH = GPIO_Pin ;\r
-  }\r
-}\r
-\r
-/**\r
-  * @brief  Writes data to the specified GPIO data port.\r
-  * @param  GPIOx: where x can be (A, B, C, D, E or H) to select the GPIO peripheral.\r
-  * @param  PortVal: specifies the value to be written to the port output data \r
-  *                  register.\r
-  * @retval None\r
-  */\r
-void GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  \r
-  GPIOx->ODR = PortVal;\r
-}\r
-\r
-/**\r
-  * @}\r
-  */\r
-\r
-/** @defgroup GPIO_Group3 GPIO Alternate functions configuration functions\r
- *  @brief   GPIO Alternate functions configuration functions\r
- *\r
-@verbatim   \r
- ===============================================================================\r
-               GPIO Alternate functions configuration functions\r
- ===============================================================================  \r
-\r
-@endverbatim\r
-  * @{\r
-  */\r
-\r
-/**\r
-  * @brief  Changes the mapping of the specified pin.\r
-  * @param  GPIOx: where x can be (A, B, C, D, E or H) to select the GPIO peripheral.\r
-  * @param  GPIO_PinSource: specifies the pin for the Alternate function.\r
-  *   This parameter can be GPIO_PinSourcex where x can be (0..15).\r
-  * @param  GPIO_AFSelection: selects the pin to used as Alternat function.\r
-  *   This parameter can be one of the following values:\r
-  *     @arg GPIO_AF_RTC_50Hz: RTC 50/60 Hz synchronization\r
-  *     @arg GPIO_AF_MCO: Microcontroller clock output\r
-  *     @arg GPIO_AF_RTC_AF1: Time stamp, Tamper, Alarm A out, Alarm B out,\r
-  *                           512 Hz clock output (with an LSE oscillator of 32.768 kHz)\r
-  *     @arg GPIO_AF_WKUP: wakeup\r
-  *     @arg GPIO_AF_SWJ: SWJ (SW and JTAG)\r
-  *     @arg GPIO_AF_TRACE\r
-  *     @arg GPIO_AF_TIM2\r
-  *     @arg GPIO_AF_TIM3\r
-  *     @arg GPIO_AF_TIM4\r
-  *     @arg GPIO_AF_TIM9\r
-  *     @arg GPIO_AF_TIM10\r
-  *     @arg GPIO_AF_TIM11\r
-  *     @arg GPIO_AF_I2C1\r
-  *     @arg GPIO_AF_I2C2\r
-  *     @arg GPIO_AF_SPI1\r
-  *     @arg GPIO_AF_SPI2\r
-  *     @arg GPIO_AF_USART1\r
-  *     @arg GPIO_AF_USART2\r
-  *     @arg GPIO_AF_USART3\r
-  *     @arg GPIO_AF_USB\r
-  *     @arg GPIO_AF_LCD\r
-  *     @arg GPIO_AF_RI\r
-  *     @arg GPIO_AF_EVENTOUT: Cortex-M3 EVENTOUT signal\r
-  * @note: The pin should already been configured in Alternate Function mode(AF)\r
-  *        using GPIO_InitStruct->GPIO_Mode = GPIO_Mode_AF\r
-  * @note: Please refer to the Alternate function mapping table in the device \r
-  *        datasheet for the detailed mapping of the system and peripherals\92\r
-  *        alternate function I/O pins.  \r
-  * @note: EVENTOUT is not mapped on PH0, PH1 and PH2.  \r
-  * @retval None\r
-  */\r
-void GPIO_PinAFConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF)\r
-{\r
-  uint32_t temp = 0x00;\r
-  uint32_t temp_2 = 0x00;\r
-  \r
-  /* Check the parameters */\r
-  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));\r
-  assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource));\r
-  assert_param(IS_GPIO_AF(GPIO_AF));\r
-  \r
-  temp = ((uint32_t)(GPIO_AF) << ((uint32_t)((uint32_t)GPIO_PinSource & (uint32_t)0x07) * 4)) ;\r
-  GPIOx->AFR[GPIO_PinSource >> 0x03] &= ~((uint32_t)0xF << ((uint32_t)((uint32_t)GPIO_PinSource & (uint32_t)0x07) * 4)) ;\r
-  temp_2 = GPIOx->AFR[GPIO_PinSource >> 0x03] | temp;\r
-  GPIOx->AFR[GPIO_PinSource >> 0x03] = temp_2;\r
-}\r
-\r
-/**\r
-  * @}\r
-  */\r
-\r
-/**\r
-  * @}\r
-  */\r
-\r
-/**\r
-  * @}\r
-  */\r
-\r
-/**\r
-  * @}\r
-  */\r
-/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/\r