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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? stm32f10x_gpio.c

?? 提供萬利的板子上能跑的在MDK下的UCOS源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
* File Name          : stm32f10x_gpio.c
* Author             : MCD Application Team
* Date First Issued  : 09/29/2006
* Description        : This file provides all the GPIO firmware functions.
********************************************************************************
* History:
* 05/21/2007: V0.3
* 04/02/2007: V0.2
* 02/05/2007: V0.1
* 09/29/2006: V0.01
********************************************************************************
* THE PRESENT SOFTWARE 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 SOFTWARE 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)0xF8FFFFFF)
#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..E) to select the GPIO peripheral.
* Output         : None
* Return         : None
*******************************************************************************/
void GPIO_DeInit(GPIO_TypeDef* 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;            

    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..E) 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(IS_GPIO_MODE(GPIO_InitStruct->GPIO_Mode));
  assert(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(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;
    tmpreg = 0;
  }

/*---------------------------- 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..E) 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(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..E) to select the GPIO peripheral.
* Output         : None
* Return         : GPIO input data port value.
*******************************************************************************/
u16 GPIO_ReadInputData(GPIO_TypeDef* GPIOx)
{
  return ((u16)GPIOx->IDR);
}

/*******************************************************************************
* Function Name  : GPIO_ReadOutputDataBit
* Description    : Reads the specified output data port bit.
* Input          : - GPIOx: where x can be (A..E) 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;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产日产欧美一区| 亚洲精品在线一区二区| 欧美人与z0zoxxxx视频| 精品欧美一区二区久久| 亚洲理论在线观看| 国产二区国产一区在线观看| 欧美亚男人的天堂| 国产精品乱子久久久久| 极品少妇xxxx精品少妇| 欧美精品123区| 亚洲综合男人的天堂| 99re热这里只有精品免费视频| 26uuu成人网一区二区三区| 婷婷一区二区三区| 欧美丝袜丝交足nylons| 亚洲欧洲国产专区| 成人毛片老司机大片| 国产一区二区三区免费看| 欧美丝袜丝交足nylons图片| 亚洲欧美日韩国产一区二区三区 | 欧美精品 国产精品| 中文字幕一区二区三区蜜月| 久草中文综合在线| 制服丝袜日韩国产| 日产精品久久久久久久性色| 欧美色图一区二区三区| 亚洲欧美日韩综合aⅴ视频| 成人av在线一区二区三区| 国产午夜精品一区二区三区嫩草 | 悠悠色在线精品| 高清免费成人av| 久久免费的精品国产v∧| 久久er99精品| 久久嫩草精品久久久精品一| 激情六月婷婷综合| wwww国产精品欧美| 国产精品456露脸| 日本一区二区三区在线观看| 国产成人在线视频网址| 国产欧美日韩在线观看| 成人免费毛片a| 国产精品久久久久一区二区三区| 国产一区二区三区电影在线观看| 久久精品人人做人人爽人人| 成人免费看黄yyy456| 亚洲私人黄色宅男| 91黄色小视频| 午夜国产不卡在线观看视频| 欧美一三区三区四区免费在线看 | 成人理论电影网| 亚洲欧美日韩人成在线播放| 欧美日韩在线播放| 美腿丝袜亚洲三区| 中文在线一区二区| 欧美视频第二页| 蜜桃一区二区三区在线| 国产亚洲精品精华液| 91美女视频网站| 蜜臀99久久精品久久久久久软件| 欧美激情综合五月色丁香| 91国偷自产一区二区开放时间 | 亚洲高清在线精品| 日韩精品中文字幕一区二区三区 | 久久影院午夜片一区| 99久久婷婷国产综合精品| 亚洲国产中文字幕在线视频综合 | 国内精品在线播放| 中文字幕一区二区三区精华液 | 精品一区二区三区欧美| 国产精品美女久久久久aⅴ | 精品国产免费久久| 91免费国产在线| 狠狠色综合日日| 夜夜嗨av一区二区三区中文字幕| 欧美一区二区三区人| av动漫一区二区| 精品一区二区久久久| 综合中文字幕亚洲| 亚洲精品一区二区三区精华液| 色激情天天射综合网| 狠狠色丁香久久婷婷综| 亚洲自拍欧美精品| 国产精品区一区二区三| 欧美一区2区视频在线观看| 99精品在线观看视频| 久久久精品黄色| 欧美视频日韩视频| av不卡在线播放| 国产精品一区三区| 日本不卡视频一二三区| 亚洲人123区| 国产成人在线看| 久久爱www久久做| 亚洲国产精品久久久久秋霞影院 | 三级精品在线观看| 亚洲日本一区二区三区| 中文字幕免费在线观看视频一区| 日韩一区二区不卡| 91.成人天堂一区| 欧美日韩成人在线一区| 国产精品国产三级国产aⅴ中文| 日本少妇一区二区| 国产不卡视频一区二区三区| 亚洲一区二区精品久久av| 欧美激情一区二区三区| 精品国产精品网麻豆系列| 555www色欧美视频| 日韩精品欧美精品| 天堂久久一区二区三区| 午夜伦理一区二区| 亚洲大片免费看| 亚洲va欧美va天堂v国产综合| 亚洲最快最全在线视频| 自拍偷在线精品自拍偷无码专区| 日本一区二区三级电影在线观看 | 一区二区三区丝袜| 国产精品久久午夜| 91免费国产在线观看| 色网站国产精品| 欧美在线短视频| 欧美日韩日本视频| 欧美一区二区三区免费在线看| 91精品国产综合久久久久| 在线综合视频播放| 欧美大黄免费观看| 久久久久久麻豆| 国产精品免费视频一区| 中文字幕一区二区日韩精品绯色| 综合自拍亚洲综合图不卡区| 亚洲国产欧美在线| 青青草精品视频| 国产精品另类一区| 一级特黄大欧美久久久| 天天操天天干天天综合网| 久久9热精品视频| 丁香网亚洲国际| 欧美最猛黑人xxxxx猛交| 欧美色老头old∨ideo| 日韩美女一区二区三区四区| 久久久久成人黄色影片| 亚洲欧洲中文日韩久久av乱码| 亚洲午夜精品在线| 麻豆91在线看| 国产酒店精品激情| 在线日韩一区二区| 精品国产亚洲在线| 欧美三级蜜桃2在线观看| 日韩精品一区二区三区四区| 日本一区免费视频| 亚洲h精品动漫在线观看| 免费看欧美美女黄的网站| 大白屁股一区二区视频| 欧美日韩美少妇| 国产欧美日本一区视频| 亚欧色一区w666天堂| 国产91精品免费| 欧美精品第一页| 国产精品九色蝌蚪自拍| 日韩电影免费在线看| 国产91富婆露脸刺激对白| 欧美日韩一卡二卡三卡 | 国内精品伊人久久久久影院对白| 99久久夜色精品国产网站| 欧美一区二区三区的| 国产精品麻豆网站| 老司机免费视频一区二区| 一本到不卡精品视频在线观看| 精品国精品自拍自在线| 亚洲一区二区三区中文字幕在线| 国产九色sp调教91| 欧美一区二区成人6969| 一区二区免费在线| 成人激情开心网| 久久综合色播五月| 天天色 色综合| 色综合天天视频在线观看| 99久久99久久免费精品蜜臀| www久久精品| 日韩黄色免费网站| 欧美日韩国产首页在线观看| 最近中文字幕一区二区三区| 高清在线不卡av| 国产午夜精品久久久久久久| 老色鬼精品视频在线观看播放| 欧美日免费三级在线| 亚洲精品国产a| 91在线云播放| 亚洲人吸女人奶水| 不卡视频在线观看| 国产欧美一区在线| 高清不卡在线观看| 国产午夜久久久久| 亚洲免费在线视频一区 二区| 丰满亚洲少妇av| 国产精品沙发午睡系列990531| 国产乱码精品一区二区三| 久久久久久久久伊人| 国产电影一区二区三区| 日本一区二区三区四区| 不卡一卡二卡三乱码免费网站|