亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? stm32f10x_gpio.c

?? FWLib.rar
?? C
?? 第 1 頁 / 共 2 頁
字號:
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
* File Name          : stm32f10x_gpio.c
* Author             : MCD Application Team
* Version            : V2.0.1
* Date               : 06/13/2008
* Description        : This file provides all the GPIO firmware functions.
********************************************************************************
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*******************************************************************************/

/* Includes ------------------------------------------------------------------*/
#include "stm32f10x_gpio.h"
#include "stm32f10x_rcc.h"

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* ------------ RCC registers bit address in the alias region ----------- */
#define AFIO_OFFSET                 (AFIO_BASE - PERIPH_BASE)

/* --- EVENTCR Register ---*/
/* Alias word address of EVOE bit */
#define EVCR_OFFSET                 (AFIO_OFFSET + 0x00)
#define EVOE_BitNumber              ((u8)0x07)
#define EVCR_EVOE_BB                (PERIPH_BB_BASE + (EVCR_OFFSET * 32) + (EVOE_BitNumber * 4))

#define EVCR_PORTPINCONFIG_MASK     ((u16)0xFF80)
#define LSB_MASK                    ((u16)0xFFFF)
#define DBGAFR_POSITION_MASK        ((u32)0x000F0000)
#define DBGAFR_SWJCFG_MASK          ((u32)0xF0FFFFFF)
#define DBGAFR_LOCATION_MASK        ((u32)0x00200000)
#define DBGAFR_NUMBITS_MASK         ((u32)0x00100000)

/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/

/*******************************************************************************
* Function Name  : GPIO_DeInit
* Description    : Deinitializes the GPIOx peripheral registers to their default
*                  reset values.
* Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
* Output         : None
* Return         : None
*******************************************************************************/
void GPIO_DeInit(GPIO_TypeDef* GPIOx)
{
  /* Check the parameters */
  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
  
  switch (*(u32*)&GPIOx)
  {
    case GPIOA_BASE:
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOA, ENABLE);
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOA, DISABLE);
      break;

    case GPIOB_BASE:
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOB, ENABLE);
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOB, DISABLE);
      break;

    case GPIOC_BASE:
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOC, ENABLE);
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOC, DISABLE);
      break;

    case GPIOD_BASE:
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOD, ENABLE);
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOD, DISABLE);
      break;
      
    case GPIOE_BASE:
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOE, ENABLE);
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOE, DISABLE);
      break; 

    case GPIOF_BASE:
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOF, ENABLE);
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOF, DISABLE);
      break;

    case GPIOG_BASE:
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOG, ENABLE);
      RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOG, DISABLE);
      break;                       

    default:
      break;
  }
}

/*******************************************************************************
* Function Name  : GPIO_AFIODeInit
* Description    : Deinitializes the Alternate Functions (remap, event control
*                  and EXTI configuration) registers to their default reset
*                  values.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void GPIO_AFIODeInit(void)
{
  RCC_APB2PeriphResetCmd(RCC_APB2Periph_AFIO, ENABLE);
  RCC_APB2PeriphResetCmd(RCC_APB2Periph_AFIO, DISABLE);
}

/*******************************************************************************
* Function Name  : GPIO_Init
* Description    : Initializes the GPIOx peripheral according to the specified
*                  parameters in the GPIO_InitStruct.
* Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
*                  - GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure that
*                    contains the configuration information for the specified GPIO
*                    peripheral.
* Output         : None
* Return         : None
*******************************************************************************/
void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)
{
  u32 currentmode = 0x00, currentpin = 0x00, pinpos = 0x00, pos = 0x00;
  u32 tmpreg = 0x00, pinmask = 0x00;

  /* Check the parameters */
  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
  assert_param(IS_GPIO_MODE(GPIO_InitStruct->GPIO_Mode));
  assert_param(IS_GPIO_PIN(GPIO_InitStruct->GPIO_Pin));  
  
/*---------------------------- GPIO Mode Configuration -----------------------*/
  currentmode = ((u32)GPIO_InitStruct->GPIO_Mode) & ((u32)0x0F);

  if ((((u32)GPIO_InitStruct->GPIO_Mode) & ((u32)0x10)) != 0x00)
  { 
    /* Check the parameters */
    assert_param(IS_GPIO_SPEED(GPIO_InitStruct->GPIO_Speed));
    /* Output mode */
    currentmode |= (u32)GPIO_InitStruct->GPIO_Speed;
  }

/*---------------------------- GPIO CRL Configuration ------------------------*/
  /* Configure the eight low port pins */
  if (((u32)GPIO_InitStruct->GPIO_Pin & ((u32)0x00FF)) != 0x00)
  {
    tmpreg = GPIOx->CRL;

    for (pinpos = 0x00; pinpos < 0x08; pinpos++)
    {
      pos = ((u32)0x01) << pinpos;
      /* Get the port pins position */
      currentpin = (GPIO_InitStruct->GPIO_Pin) & pos;

      if (currentpin == pos)
      {
        pos = pinpos << 2;
        /* Clear the corresponding low control register bits */
        pinmask = ((u32)0x0F) << pos;
        tmpreg &= ~pinmask;

        /* Write the mode configuration in the corresponding bits */
        tmpreg |= (currentmode << pos);

        /* Reset the corresponding ODR bit */
        if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPD)
        {
          GPIOx->BRR = (((u32)0x01) << pinpos);
        }
        /* Set the corresponding ODR bit */
        if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPU)
        {
          GPIOx->BSRR = (((u32)0x01) << pinpos);
        }
      }
    }
    GPIOx->CRL = tmpreg;
  }

/*---------------------------- GPIO CRH Configuration ------------------------*/
  /* Configure the eight high port pins */
  if (GPIO_InitStruct->GPIO_Pin > 0x00FF)
  {
    tmpreg = GPIOx->CRH;
    for (pinpos = 0x00; pinpos < 0x08; pinpos++)
    {
      pos = (((u32)0x01) << (pinpos + 0x08));
      /* Get the port pins position */
      currentpin = ((GPIO_InitStruct->GPIO_Pin) & pos);
      if (currentpin == pos)
      {
        pos = pinpos << 2;
        /* Clear the corresponding high control register bits */
        pinmask = ((u32)0x0F) << pos;
        tmpreg &= ~pinmask;

        /* Write the mode configuration in the corresponding bits */
        tmpreg |= (currentmode << pos);

        /* Reset the corresponding ODR bit */
        if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPD)
        {
          GPIOx->BRR = (((u32)0x01) << (pinpos + 0x08));
        }
        /* Set the corresponding ODR bit */
        if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPU)
        {
          GPIOx->BSRR = (((u32)0x01) << (pinpos + 0x08));
        }
      }
    }
    GPIOx->CRH = tmpreg;
  }
}

/*******************************************************************************
* Function Name  : GPIO_StructInit
* Description    : Fills each GPIO_InitStruct member with its default value.
* Input          : - GPIO_InitStruct : pointer to a GPIO_InitTypeDef structure
*                    which will be initialized.
* Output         : None
* Return         : None
*******************************************************************************/
void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct)
{
  /* Reset GPIO init structure parameters values */
  GPIO_InitStruct->GPIO_Pin  = GPIO_Pin_All;
  GPIO_InitStruct->GPIO_Speed = GPIO_Speed_2MHz;
  GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IN_FLOATING;
}

/*******************************************************************************
* Function Name  : GPIO_ReadInputDataBit
* Description    : Reads the specified input port pin.
* Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
*                : - GPIO_Pin:  specifies the port bit to read.
*                    This parameter can be GPIO_Pin_x where x can be (0..15).
* Output         : None
* Return         : The input port pin value.
*******************************************************************************/
u8 GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
{
  u8 bitstatus = 0x00;
  
  /* Check the parameters */
  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
  assert_param(IS_GET_GPIO_PIN(GPIO_Pin)); 
  
  if ((GPIOx->IDR & GPIO_Pin) != (u32)Bit_RESET)
  {
    bitstatus = (u8)Bit_SET;
  }
  else
  {
    bitstatus = (u8)Bit_RESET;
  }
  return bitstatus;
}

/*******************************************************************************
* Function Name  : GPIO_ReadInputData
* Description    : Reads the specified GPIO input data port.
* Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
* Output         : None
* Return         : GPIO input data port value.
*******************************************************************************/
u16 GPIO_ReadInputData(GPIO_TypeDef* GPIOx)
{
  /* Check the parameters */
  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
  
  return ((u16)GPIOx->IDR);
}

/*******************************************************************************
* Function Name  : GPIO_ReadOutputDataBit
* Description    : Reads the specified output data port bit.
* Input          : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
*                : - GPIO_Pin:  specifies the port bit to read.
*                    This parameter can be GPIO_Pin_x where x can be (0..15).
* Output         : None
* Return         : The output port pin value.
*******************************************************************************/
u8 GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
{
  u8 bitstatus = 0x00;

  /* Check the parameters */
  assert_param(IS_GPIO_ALL_PERIPH(GPIOx));

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区欧美国产| 欧美日韩三级在线| 欧美精品一区二| 国产激情一区二区三区四区| 久久这里只有精品视频网| 国产精品一区二区三区乱码| 国产欧美综合在线| 91网站在线播放| 午夜影视日本亚洲欧洲精品| 欧美一区二区三区视频| 韩国欧美一区二区| 国产午夜精品一区二区三区四区 | 国产精品国产a| 91看片淫黄大片一级| 五月天亚洲精品| 日韩精品中文字幕在线一区| 高清在线观看日韩| 亚洲小说欧美激情另类| 日韩欧美不卡一区| 色网站国产精品| 黑人巨大精品欧美一区| 国产精品日产欧美久久久久| 欧美一区二区三区在线观看视频| 国产成人在线免费观看| 亚洲最快最全在线视频| 精品剧情v国产在线观看在线| 成人性生交大合| 日韩和的一区二区| 亚洲欧洲性图库| 精品三级在线观看| 欧美影视一区二区三区| 成人精品电影在线观看| 毛片av一区二区三区| 亚洲一区二区精品久久av| 国产日韩亚洲欧美综合| 欧美一级片在线| 欧美日韩国产另类一区| 欧美日韩免费一区二区三区| 久久成人免费网| 亚洲gay无套男同| 夜夜嗨av一区二区三区网页| 综合电影一区二区三区| 亚洲欧洲日韩在线| 最好看的中文字幕久久| 欧美极品少妇xxxxⅹ高跟鞋| 欧美精品一区二区三区高清aⅴ | 日本一区二区三区dvd视频在线| 欧美视频中文字幕| 欧美日韩在线精品一区二区三区激情 | 欧美大片顶级少妇| 日韩一区二区三区高清免费看看| 欧美一区二区三区系列电影| 日韩欧美二区三区| 国产午夜精品久久久久久免费视 | 日韩免费视频一区二区| 久久久久国色av免费看影院| 国产精品麻豆欧美日韩ww| 国产精品国产三级国产普通话蜜臀 | 国产精品中文有码| 成人激情动漫在线观看| 欧美在线不卡视频| 日韩一二在线观看| 国产精品久久久久一区二区三区| 亚洲猫色日本管| 日本视频一区二区| 99久久综合精品| 精品久久久久一区| 一区二区三区在线影院| 国产精品一线二线三线| 成人av在线播放网站| 91精品国产综合久久久久久| 久久久久久久久岛国免费| 亚洲午夜精品在线| 成人网男人的天堂| 精品免费国产一区二区三区四区| 国产精品毛片久久久久久久| 麻豆国产精品777777在线| 97精品视频在线观看自产线路二| 日韩天堂在线观看| 亚洲一区在线电影| 99在线精品视频| 国产日韩亚洲欧美综合| 久久国内精品视频| 91精品国产色综合久久ai换脸| 亚洲欧美影音先锋| 成人精品一区二区三区四区| 国产偷国产偷精品高清尤物| 久久精品国产一区二区三| 欧美三级午夜理伦三级中视频| 18成人在线观看| 色综合久久久久综合体| 亚洲欧美欧美一区二区三区| 日韩毛片精品高清免费| 麻豆久久一区二区| 日本一区二区三区电影| 卡一卡二国产精品| 日韩欧美自拍偷拍| 97久久精品人人做人人爽50路| 久久女同互慰一区二区三区| 在线一区二区三区四区| 国产精品正在播放| 免费国产亚洲视频| 亚洲欧美日韩久久| 久久精品日产第一区二区三区高清版| 欧洲国内综合视频| 成人免费视频播放| 国产麻豆精品久久一二三| 亚洲成va人在线观看| 亚洲激情av在线| 国产精品福利电影一区二区三区四区| 欧美一级视频精品观看| 欧美日韩视频在线第一区| 91在线视频观看| 91美女片黄在线观看| 欧美日韩激情一区| 成人少妇影院yyyy| 成人禁用看黄a在线| 不卡区在线中文字幕| 成人va在线观看| 日本韩国欧美一区| 欧美特级限制片免费在线观看| 91亚洲国产成人精品一区二区三 | 美女视频黄免费的久久| 日本午夜一本久久久综合| 日韩av一区二区三区四区| 日本在线不卡视频| 激情伊人五月天久久综合| 国产一区二区电影| 国产精品一区三区| 99国产精品久久久| 欧美少妇bbb| 欧美zozo另类异族| 国产精品久久久久影院亚瑟 | 欧美日本一区二区三区四区| 日韩一级片网址| 日本欧美大码aⅴ在线播放| 国产一区二区久久| 精品国产电影一区二区| 中文字幕一区二| 奇米一区二区三区| 国产精品88av| 欧美日韩中文另类| 欧美精品一区二区高清在线观看| 欧美韩国日本综合| 日韩激情av在线| 高清不卡一区二区| 7777精品伊人久久久大香线蕉完整版 | 91美女片黄在线| 欧美成人伊人久久综合网| 亚洲精品美国一| 国产露脸91国语对白| 欧美日韩精品一区二区三区| 亚洲成人精品一区二区| 久99久精品视频免费观看| 欧美亚洲尤物久久| 国产精品久线观看视频| 日日骚欧美日韩| 一本大道久久a久久综合| 日本一区二区视频在线| 日韩成人精品在线观看| 在线观看日韩毛片| 中文字幕一区二区三区在线不卡| 狠狠色丁香婷综合久久| 欧美日韩一区国产| 亚洲国产一区视频| 欧美亚洲一区二区在线| 亚洲国产成人高清精品| 91在线视频免费91| 亚洲欧美国产77777| 91久久线看在观草草青青| 最新国产の精品合集bt伙计| 99在线精品观看| 亚洲精品国产第一综合99久久| 成人av网址在线| 亚洲黄色小说网站| 91.xcao| 国产乱人伦精品一区二区在线观看 | 亚洲国产精品成人综合色在线婷婷| 精品一区二区三区免费观看| 欧美精品一区二区不卡| 国产精品1区二区.| 国产精品女人毛片| 91免费在线看| 日韩电影在线免费看| 日韩欧美久久一区| 国产成人免费视频| 亚洲激情图片小说视频| 宅男噜噜噜66一区二区66| 国产高清一区日本| 亚洲午夜影视影院在线观看| 在线观看91av| 9i在线看片成人免费| 视频一区免费在线观看| 国产人久久人人人人爽| 色婷婷av一区| 国产精品91xxx| 免费日韩伦理电影| 亚洲欧美综合网| 日韩午夜电影av| 91亚洲国产成人精品一区二区三 |