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

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

?? gpio.c

?? STM32+Grlib
?? C
?? 第 1 頁 / 共 4 頁
字號:
//*****************************************************************************
//
// gpio.c - API for GPIO ports
//
// Copyright (c) 2005-2010 Texas Instruments Incorporated.  All rights reserved.
// Software License Agreement
// 
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
// 
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
// 
// This is part of revision 5821 of the Stellaris Peripheral Driver Library.
//
//*****************************************************************************

//*****************************************************************************
//
//! \addtogroup gpio_api
//! @{
//
//*****************************************************************************

#include "inc/hw_gpio.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_sysctl.h"
#include "inc/hw_types.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"

//*****************************************************************************
//
// The base addresses of all the GPIO modules.  Both the APB and AHB apertures
// are provided.
//
//*****************************************************************************
static const unsigned long g_pulGPIOBaseAddrs[] =
{
    GPIO_PORTA_BASE, GPIO_PORTA_AHB_BASE,
    GPIO_PORTB_BASE, GPIO_PORTB_AHB_BASE,
    GPIO_PORTC_BASE, GPIO_PORTC_AHB_BASE,
    GPIO_PORTD_BASE, GPIO_PORTD_AHB_BASE,
    GPIO_PORTE_BASE, GPIO_PORTE_AHB_BASE,
    GPIO_PORTF_BASE, GPIO_PORTF_AHB_BASE,
    GPIO_PORTG_BASE, GPIO_PORTG_AHB_BASE,
    GPIO_PORTH_BASE, GPIO_PORTH_AHB_BASE,
    GPIO_PORTJ_BASE, GPIO_PORTJ_AHB_BASE,
};

//*****************************************************************************
//
//! \internal
//! Checks a GPIO base address.
//!
//! \param ulPort is the base address of the GPIO port.
//!
//! This function determines if a GPIO port base address is valid.
//!
//! \return Returns \b true if the base address is valid and \b false
//! otherwise.
//
//*****************************************************************************
#ifdef DEBUG
static tBoolean
GPIOBaseValid(unsigned long ulPort)
{
    return((ulPort == GPIO_PORTA_BASE) || (ulPort == GPIO_PORTA_AHB_BASE) ||
           (ulPort == GPIO_PORTB_BASE) || (ulPort == GPIO_PORTB_AHB_BASE) ||
           (ulPort == GPIO_PORTC_BASE) || (ulPort == GPIO_PORTC_AHB_BASE) ||
           (ulPort == GPIO_PORTD_BASE) || (ulPort == GPIO_PORTD_AHB_BASE) ||
           (ulPort == GPIO_PORTE_BASE) || (ulPort == GPIO_PORTE_AHB_BASE) ||
           (ulPort == GPIO_PORTF_BASE) || (ulPort == GPIO_PORTF_AHB_BASE) ||
           (ulPort == GPIO_PORTG_BASE) || (ulPort == GPIO_PORTG_AHB_BASE) ||
           (ulPort == GPIO_PORTH_BASE) || (ulPort == GPIO_PORTH_AHB_BASE) ||
           (ulPort == GPIO_PORTJ_BASE) || (ulPort == GPIO_PORTJ_AHB_BASE));
}
#endif

//*****************************************************************************
//
//! \internal
//! Gets the GPIO interrupt number.
//!
//! \param ulPort is the base address of the GPIO port.
//!
//! Given a GPIO base address, returns the corresponding interrupt number.
//!
//! \return Returns a GPIO interrupt number, or -1 if \e ulPort is invalid.
//
//*****************************************************************************
static long
GPIOGetIntNumber(unsigned long ulPort)
{
    unsigned int ulInt;

    //
    // Determine the GPIO interrupt number for the given module.
    //
    switch(ulPort)
    {
        case GPIO_PORTA_BASE:
        case GPIO_PORTA_AHB_BASE:
        {
            ulInt = INT_GPIOA;
            break;
        }

        case GPIO_PORTB_BASE:
        case GPIO_PORTB_AHB_BASE:
        {
            ulInt = INT_GPIOB;
            break;
        }

        case GPIO_PORTC_BASE:
        case GPIO_PORTC_AHB_BASE:
        {
            ulInt = INT_GPIOC;
            break;
        }

        case GPIO_PORTD_BASE:
        case GPIO_PORTD_AHB_BASE:
        {
            ulInt = INT_GPIOD;
            break;
        }

        case GPIO_PORTE_BASE:
        case GPIO_PORTE_AHB_BASE:
        {
            ulInt = INT_GPIOE;
            break;
        }

        case GPIO_PORTF_BASE:
        case GPIO_PORTF_AHB_BASE:
        {
            ulInt = INT_GPIOF;
            break;
        }

        case GPIO_PORTG_BASE:
        case GPIO_PORTG_AHB_BASE:
        {
            ulInt = INT_GPIOG;
            break;
        }

        case GPIO_PORTH_BASE:
        case GPIO_PORTH_AHB_BASE:
        {
            ulInt = INT_GPIOH;
            break;
        }

        case GPIO_PORTJ_BASE:
        case GPIO_PORTJ_AHB_BASE:
        {
            ulInt = INT_GPIOJ;
            break;
        }

        default:
        {
            return(-1);
        }
    }

    //
    // Return GPIO interrupt number.
    //
    return(ulInt);
}

//*****************************************************************************
//
//! Sets the direction and mode of the specified pin(s).
//!
//! \param ulPort is the base address of the GPIO port
//! \param ucPins is the bit-packed representation of the pin(s).
//! \param ulPinIO is the pin direction and/or mode.
//!
//! This function will set the specified pin(s) on the selected GPIO port
//! as either an input or output under software control, or it will set the
//! pin to be under hardware control.
//!
//! The parameter \e ulPinIO is an enumerated data type that can be one of
//! the following values:
//!
//! - \b GPIO_DIR_MODE_IN
//! - \b GPIO_DIR_MODE_OUT
//! - \b GPIO_DIR_MODE_HW
//!
//! where \b GPIO_DIR_MODE_IN specifies that the pin will be programmed as
//! a software controlled input, \b GPIO_DIR_MODE_OUT specifies that the pin
//! will be programmed as a software controlled output, and
//! \b GPIO_DIR_MODE_HW specifies that the pin will be placed under
//! hardware control.
//!
//! The pin(s) are specified using a bit-packed byte, where each bit that is
//! set identifies the pin to be accessed, and where bit 0 of the byte
//! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
//!
//! \note GPIOPadConfigSet() must also be used to configure the corresponding
//! pad(s) in order for them to propagate the signal to/from the GPIO.
//!
//! \return None.
//
//*****************************************************************************
void
GPIODirModeSet(unsigned long ulPort, unsigned char ucPins,
               unsigned long ulPinIO)
{
    //
    // Check the arguments.
    //
    ASSERT(GPIOBaseValid(ulPort));
    ASSERT((ulPinIO == GPIO_DIR_MODE_IN) || (ulPinIO == GPIO_DIR_MODE_OUT) ||
           (ulPinIO == GPIO_DIR_MODE_HW));

    //
    // Set the pin direction and mode.
    //
    HWREG(ulPort + GPIO_O_DIR) = ((ulPinIO & 1) ?
                                  (HWREG(ulPort + GPIO_O_DIR) | ucPins) :
                                  (HWREG(ulPort + GPIO_O_DIR) & ~(ucPins)));
    HWREG(ulPort + GPIO_O_AFSEL) = ((ulPinIO & 2) ?
                                    (HWREG(ulPort + GPIO_O_AFSEL) | ucPins) :
                                    (HWREG(ulPort + GPIO_O_AFSEL) &
                                     ~(ucPins)));
}

//*****************************************************************************
//
//! Gets the direction and mode of a pin.
//!
//! \param ulPort is the base address of the GPIO port.
//! \param ucPin is the pin number.
//!
//! This function gets the direction and control mode for a specified pin on
//! the selected GPIO port.  The pin can be configured as either an input or
//! output under software control, or it can be under hardware control.  The
//! type of control and direction are returned as an enumerated data type.
//!
//! \return Returns one of the enumerated data types described for
//! GPIODirModeSet().
//
//*****************************************************************************
unsigned long
GPIODirModeGet(unsigned long ulPort, unsigned char ucPin)
{
    unsigned long ulDir, ulAFSEL;

    //
    // Check the arguments.
    //
    ASSERT(GPIOBaseValid(ulPort));
    ASSERT(ucPin < 8);

    //
    // Convert from a pin number to a bit position.
    //
    ucPin = 1 << ucPin;

    //
    // Return the pin direction and mode.
    //
    ulDir = HWREG(ulPort + GPIO_O_DIR);
    ulAFSEL = HWREG(ulPort + GPIO_O_AFSEL);
    return(((ulDir & ucPin) ? 1 : 0) | ((ulAFSEL & ucPin) ? 2 : 0));
}

//*****************************************************************************
//
//! Sets the interrupt type for the specified pin(s).
//!
//! \param ulPort is the base address of the GPIO port.
//! \param ucPins is the bit-packed representation of the pin(s).
//! \param ulIntType specifies the type of interrupt trigger mechanism.
//!
//! This function sets up the various interrupt trigger mechanisms for the
//! specified pin(s) on the selected GPIO port.
//!
//! The parameter \e ulIntType is an enumerated data type that can be one of
//! the following values:
//!
//! - \b GPIO_FALLING_EDGE
//! - \b GPIO_RISING_EDGE
//! - \b GPIO_BOTH_EDGES
//! - \b GPIO_LOW_LEVEL
//! - \b GPIO_HIGH_LEVEL
//!
//! where the different values describe the interrupt detection mechanism
//! (edge or level) and the particular triggering event (falling, rising,
//! or both edges for edge detect, low or high for level detect).
//!
//! The pin(s) are specified using a bit-packed byte, where each bit that is
//! set identifies the pin to be accessed, and where bit 0 of the byte
//! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
//!
//! \note In order to avoid any spurious interrupts, the user must
//! ensure that the GPIO inputs remain stable for the duration of
//! this function.
//!
//! \return None.
//
//*****************************************************************************
void
GPIOIntTypeSet(unsigned long ulPort, unsigned char ucPins,
               unsigned long ulIntType)
{
    //
    // Check the arguments.
    //
    ASSERT(GPIOBaseValid(ulPort));
    ASSERT((ulIntType == GPIO_FALLING_EDGE) ||
           (ulIntType == GPIO_RISING_EDGE) || (ulIntType == GPIO_BOTH_EDGES) ||
           (ulIntType == GPIO_LOW_LEVEL) || (ulIntType == GPIO_HIGH_LEVEL));

    //
    // Set the pin interrupt type.
    //
    HWREG(ulPort + GPIO_O_IBE) = ((ulIntType & 1) ?
                                  (HWREG(ulPort + GPIO_O_IBE) | ucPins) :
                                  (HWREG(ulPort + GPIO_O_IBE) & ~(ucPins)));
    HWREG(ulPort + GPIO_O_IS) = ((ulIntType & 2) ?
                                 (HWREG(ulPort + GPIO_O_IS) | ucPins) :
                                 (HWREG(ulPort + GPIO_O_IS) & ~(ucPins)));
    HWREG(ulPort + GPIO_O_IEV) = ((ulIntType & 4) ?
                                  (HWREG(ulPort + GPIO_O_IEV) | ucPins) :
                                  (HWREG(ulPort + GPIO_O_IEV) & ~(ucPins)));
}

//*****************************************************************************
//
//! Gets the interrupt type for a pin.
//!
//! \param ulPort is the base address of the GPIO port.
//! \param ucPin is the pin number.
//!
//! This function gets the interrupt type for a specified pin on the selected
//! GPIO port.  The pin can be configured as a falling edge, rising edge, or
//! both edge detected interrupt, or it can be configured as a low level or
//! high level detected interrupt.  The type of interrupt detection mechanism
//! is returned as an enumerated data type.
//!
//! \return Returns one of the enumerated data types described for
//! GPIOIntTypeSet().
//
//*****************************************************************************
unsigned long
GPIOIntTypeGet(unsigned long ulPort, unsigned char ucPin)
{
    unsigned long ulIBE, ulIS, ulIEV;

    //
    // Check the arguments.
    //
    ASSERT(GPIOBaseValid(ulPort));
    ASSERT(ucPin < 8);

    //
    // Convert from a pin number to a bit position.
    //
    ucPin = 1 << ucPin;

    //
    // Return the pin interrupt type.
    //
    ulIBE = HWREG(ulPort + GPIO_O_IBE);
    ulIS = HWREG(ulPort + GPIO_O_IS);
    ulIEV = HWREG(ulPort + GPIO_O_IEV);
    return(((ulIBE & ucPin) ? 1 : 0) | ((ulIS & ucPin) ? 2 : 0) |
           ((ulIEV & ucPin) ? 4 : 0));
}

//*****************************************************************************
//
//! Sets the pad configuration for the specified pin(s).
//!
//! \param ulPort is the base address of the GPIO port.
//! \param ucPins is the bit-packed representation of the pin(s).
//! \param ulStrength specifies the output drive strength.
//! \param ulPinType specifies the pin type.
//!
//! This function sets the drive strength and type for the specified pin(s)
//! on the selected GPIO port.  For pin(s) configured as input ports, the
//! pad is configured as requested, but the only real effect on the input
//! is the configuration of the pull-up or pull-down termination.
//!

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲va中文字幕| 欧美肥妇bbw| 丝袜美腿亚洲一区| 国产欧美在线观看一区| 欧美日韩精品一区二区天天拍小说 | 中文字幕av一区二区三区免费看| 欧美天堂一区二区三区| 成人午夜私人影院| 亚洲一区二区影院| 日韩欧美成人一区二区| 色香色香欲天天天影视综合网| 国产一区二区三区精品视频| 亚洲影院在线观看| 中文字幕一区二区三区在线不卡 | 26uuu国产电影一区二区| 欧美最猛性xxxxx直播| 丰满放荡岳乱妇91ww| 老司机精品视频在线| 亚洲午夜免费视频| 亚洲日本在线看| 国产午夜亚洲精品理论片色戒| 欧美一区二区啪啪| 欧美日韩成人综合天天影院| 日本高清视频一区二区| 99精品视频中文字幕| 国产iv一区二区三区| 国产乱人伦偷精品视频免下载| 老司机一区二区| 久久精品国产久精国产爱| 日韩精品高清不卡| 全国精品久久少妇| 青青国产91久久久久久| 视频一区视频二区中文| 五月天久久比比资源色| 午夜伦理一区二区| 亚洲gay无套男同| 日韩中文字幕1| 日本特黄久久久高潮| 五月激情六月综合| 麻豆精品在线播放| 久久er99精品| 国产精品一卡二卡| 国产成人精品免费网站| 成人美女在线观看| 99精品1区2区| 精品视频在线看| 91精品国产综合久久精品app| 欧美人伦禁忌dvd放荡欲情| 欧美群妇大交群的观看方式| 欧美乱熟臀69xxxxxx| 欧美一级片免费看| www日韩大片| 国产精品伦理一区二区| 亚洲欧美色图小说| 午夜天堂影视香蕉久久| 免费人成在线不卡| 国产成人精品亚洲日本在线桃色 | 成人97人人超碰人人99| 91丨porny丨在线| 在线观看日韩毛片| 欧美一级xxx| 国产午夜亚洲精品羞羞网站| 中文字幕一区二区三区四区不卡| 亚洲人快播电影网| 日韩电影在线免费观看| 精品一区二区综合| 国产成人综合自拍| 色视频一区二区| 日韩色视频在线观看| 国产日产欧美一区二区视频| 亚洲婷婷综合久久一本伊一区| 丝袜美腿高跟呻吟高潮一区| 国产一区不卡视频| 色哟哟国产精品免费观看| 日韩你懂的电影在线观看| 国产日韩欧美精品一区| 一二三四区精品视频| 精品伊人久久久久7777人| 91亚洲精品乱码久久久久久蜜桃| 欧美精品日韩精品| 国产欧美日韩在线| 亚洲成人激情自拍| 不卡一区二区中文字幕| 欧美电影一区二区三区| 中文字幕在线不卡国产视频| 午夜精品福利一区二区蜜股av| 国产制服丝袜一区| 欧美性视频一区二区三区| 亚洲精品一区二区三区蜜桃下载| 一区二区三区丝袜| 国产精品自在欧美一区| 欧美肥胖老妇做爰| 日韩久久一区二区| 国产精品白丝av| 这里只有精品免费| 亚洲视频小说图片| 国产黄人亚洲片| 制服丝袜亚洲精品中文字幕| 中文字幕一区不卡| 国产福利一区在线观看| 欧美日韩成人在线一区| 亚洲色图另类专区| 国产剧情在线观看一区二区| 3d成人动漫网站| 亚洲女同ⅹxx女同tv| 岛国av在线一区| 精品国产乱码久久久久久蜜臀| 亚洲成人福利片| 91农村精品一区二区在线| 久久久不卡网国产精品一区| 免费欧美日韩国产三级电影| 精品污污网站免费看| 亚洲视频一区二区在线| 成人av免费在线观看| 国产亚洲视频系列| 精品影院一区二区久久久| 制服丝袜国产精品| 亚洲www啪成人一区二区麻豆 | 日韩欧美国产系列| 丝袜诱惑制服诱惑色一区在线观看| 色综合久久99| 成人欧美一区二区三区在线播放| 国产一区二区三区观看| 欧美v日韩v国产v| 青草国产精品久久久久久| 欧美色精品在线视频| 亚洲综合视频网| 色94色欧美sute亚洲线路一ni | 久久蜜桃av一区精品变态类天堂| 青青草国产成人av片免费| 91精品在线免费观看| 日韩—二三区免费观看av| 正在播放亚洲一区| 美女视频黄频大全不卡视频在线播放| 欧美高清激情brazzers| 午夜伊人狠狠久久| 欧美精品丝袜久久久中文字幕| 香蕉成人啪国产精品视频综合网| 欧美日本视频在线| 日本网站在线观看一区二区三区| 91精品国产综合久久香蕉麻豆| 日韩激情av在线| 日韩欧美在线综合网| 九色porny丨国产精品| 久久一区二区三区四区| 高清久久久久久| 国产精品家庭影院| 在线观看www91| 亚洲bt欧美bt精品| 欧美白人最猛性xxxxx69交| 国产乱码精品1区2区3区| 国产精品久线观看视频| 色婷婷综合久久久久中文一区二区| 一区二区不卡在线视频 午夜欧美不卡在 | 亚洲在线视频网站| 制服丝袜亚洲精品中文字幕| 精品一区二区三区不卡| 中文字幕免费一区| 在线精品视频小说1| 青青草91视频| 国产精品视频你懂的| 91国模大尺度私拍在线视频| 五月婷婷激情综合| 日韩精品专区在线影院重磅| 欧美在线免费观看视频| 亚洲福利视频一区| 欧美一级在线观看| 国产成人精品免费一区二区| 亚洲欧美另类小说视频| 91精品视频网| 成人av网站在线| 日韩专区在线视频| 国产亚洲欧美一级| 欧美在线观看视频在线| 久久激情五月婷婷| 亚洲人成网站精品片在线观看| 91精品国产丝袜白色高跟鞋| 国产精品538一区二区在线| 亚洲三级久久久| 欧美一级一区二区| jlzzjlzz亚洲日本少妇| 日本 国产 欧美色综合| 亚洲视频图片小说| 精品1区2区在线观看| 色婷婷香蕉在线一区二区| 久久99国产精品免费| 一区二区三区**美女毛片| 国产亚洲精品精华液| 欧美日本国产视频| 成人av资源在线| 精品一区二区三区在线视频| 亚洲欧美国产77777| 久久久久久久精| 制服丝袜av成人在线看| 99久久久国产精品| 国产做a爰片久久毛片| 91免费在线看| 美女一区二区三区| 专区另类欧美日韩| 久久精品夜色噜噜亚洲aⅴ|