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

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

?? gpio.c

?? 基于 Cortex-M3 (ARM) 內核使用之 uC/OS-II 作業系統,此例程可移植于 Cortex-M3 (ARM)內核的微處理器上的應用,于 Keil MDK 3.15b以上 工程編譯,而
?? C
?? 第 1 頁 / 共 3 頁
字號:
//*****************************************************************************
//
// gpio.c - API for GPIO ports
//
// Copyright (c) 2005,2006 Luminary Micro, Inc.  All rights reserved.
//
// Software License Agreement
//
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
// exclusively on LMI's Stellaris Family of microcontroller products.
//
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  Any use in violation
// of the foregoing restrictions may subject the user to criminal sanctions
// under applicable laws, as well as to civil liability for the breach of the
// terms and conditions of this license.
//
// THIS SOFTWARE IS PROVIDED "AS IS".  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.
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 852 of the Stellaris Driver Library.
//
//*****************************************************************************

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

#include "hw_gpio.h"
#include "hw_ints.h"
#include "hw_memmap.h"
#include "hw_types.h"
#include "debug.h"
#include "gpio.h"
#include "interrupt.h"

//*****************************************************************************
//
//! \internal
//! Get GPIO interrupt number.
//!
//! \param ulPort base address of the selected 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.
//
//*****************************************************************************
long
GPIOGetIntNumber(unsigned long ulPort)
{
    unsigned int ulInt;

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

        case GPIO_PORTB_BASE:
        {
            ulInt = INT_GPIOB;
            break;
        }

        case GPIO_PORTC_BASE:
        {
            ulInt = INT_GPIOC;
            break;
        }

        case GPIO_PORTD_BASE:
        {
            ulInt = INT_GPIOD;
            break;
        }

        case GPIO_PORTE_BASE:
        {
            ulInt = INT_GPIOE;
            break;
        }

        default:
        {
            return(-1);
        }
    }

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

//*****************************************************************************
//
//! Sets the direction and mode of the specified pins of the selected
//! GPIO port.
//!
//! \param ulPort base address of the selected GPIO port
//! \param ucPins bit-packed representation of the specified pins
//! \param ulPinIO pin direction and/or mode
//!
//! This function will set the specified pins 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 pins 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, etc.
//!
//! \return None.
//
//*****************************************************************************
void
GPIODirModeSet(unsigned long ulPort, unsigned char ucPins,
               unsigned long ulPinIO)
{
    //
    // Check the arguments.
    //
    ASSERT((ulPort == GPIO_PORTA_BASE) || (ulPort == GPIO_PORTB_BASE) ||
           (ulPort == GPIO_PORTC_BASE) || (ulPort == GPIO_PORTD_BASE) ||
           (ulPort == GPIO_PORTE_BASE));
    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 specified pin of the selected
//! GPIO port.
//!
//! \param ulPort base address of the selected GPIO port
//! \param ucPin pin number of the specified pin, relative to the selected
//! GPIO port.
//!
//! 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((ulPort == GPIO_PORTA_BASE) || (ulPort == GPIO_PORTB_BASE) ||
           (ulPort == GPIO_PORTC_BASE) || (ulPort == GPIO_PORTD_BASE) ||
           (ulPort == GPIO_PORTE_BASE));
    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 pins of the selected GPIO
//! port.
//!
//! \param ulPort base address of the selected GPIO port
//! \param ucPins bit-packed representation of the specified pins
//! \param ulIntType specifies the type of interrupt trigger mechanism
//!
//! This function sets up the various interrupt trigger mechanisms for the
//! specified pins 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 pins 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, etc.
//!
//! \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((ulPort == GPIO_PORTA_BASE) || (ulPort == GPIO_PORTB_BASE) ||
           (ulPort == GPIO_PORTC_BASE) || (ulPort == GPIO_PORTD_BASE) ||
           (ulPort == GPIO_PORTE_BASE));
    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 the specified pin of the selected GPIO
//! port.
//!
//! \param ulPort base address of the selected GPIO port
//! \param ucPin pin number of the specified pin, relative to the selected
//! GPIO port.
//!
//! 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((ulPort == GPIO_PORTA_BASE) || (ulPort == GPIO_PORTB_BASE) ||
           (ulPort == GPIO_PORTC_BASE) || (ulPort == GPIO_PORTD_BASE) ||
           (ulPort == GPIO_PORTE_BASE));
    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 pins of the selected GPIO
//! port.
//!
//! \param ulPort is the base address of the GPIO port.
//! \param ucPins bit-packed representation of the specified pins.
//! \param ulStrength specifies the output drive strength.
//! \param ulPinType specifies the pin type.
//!
//! This function sets the drive strength and type for the specified pins
//! on the selected GPIO port.  For pins 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.
//!
//! The parameter \e ulStrength can be one of the following values:
//!
//! - \b GPIO_STRENGTH_2MA
//! - \b GPIO_STRENGTH_4MA
//! - \b GPIO_STRENGTH_8MA
//! - \b GPIO_STRENGTH_8MA_SC
//!
//! where \b GPIO_STRENGTH_xMA specifies either 2, 4, or 8 mA output drive
//! strength, and \b GPIO_OUT_STRENGTH_8MA_SC specifies 8 mA output drive with
//! slew control.
//!
//! The parameter \e ulPinType can be one of the following values:
//!
//! - \b GPIO_PIN_TYPE_STD
//! - \b GPIO_PIN_TYPE_STD_WPU
//! - \b GPIO_PIN_TYPE_STD_WPD
//! - \b GPIO_PIN_TYPE_OD

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
综合欧美一区二区三区| 最新欧美精品一区二区三区| 日av在线不卡| 日韩二区三区四区| 91视频精品在这里| 蜜桃视频免费观看一区| 国产精品久久久久久久午夜片| 欧美一区二区三区啪啪| 色综合欧美在线视频区| 福利一区二区在线观看| 久久9热精品视频| 性感美女极品91精品| 午夜欧美在线一二页| 成人久久18免费网站麻豆| 欧美精品一区二区久久婷婷| 爽好多水快深点欧美视频| 欧美日韩激情一区| 首页国产欧美日韩丝袜| 欧美狂野另类xxxxoooo| 日本成人在线网站| 久久久久久一级片| 成人动漫在线一区| 亚洲精品伦理在线| 欧美日韩视频第一区| 日韩电影在线一区二区三区| 欧美一级二级三级蜜桃| 精品视频色一区| 艳妇臀荡乳欲伦亚洲一区| 久久亚洲一区二区三区四区| 日韩—二三区免费观看av| 91免费在线看| 国产精品全国免费观看高清| 成人性生交大合| 精品一区二区三区欧美| 粉嫩av一区二区三区| 91精品国产91久久综合桃花 | 国产精品短视频| 欧美精品一区二区三区蜜臀| 6080yy午夜一二三区久久| 欧美电影在线免费观看| 538在线一区二区精品国产| 在线播放中文字幕一区| 欧美美女一区二区在线观看| 欧美三级电影精品| 欧美三级日本三级少妇99| 色综合久久久久综合| 色综合天天综合网天天狠天天| www.日本不卡| 色综合天天综合网国产成人综合天| 成+人+亚洲+综合天堂| 成人99免费视频| 色婷婷久久综合| 欧美精品久久久久久久多人混战| 91精品蜜臀在线一区尤物| 精品欧美乱码久久久久久 | 国产精品美女久久久久久久久久久| 久久久99精品免费观看| 国产精品久久久爽爽爽麻豆色哟哟 | 成人一级片在线观看| eeuss影院一区二区三区| 欧洲另类一二三四区| 欧美久久一二区| 久久精品人人做| 中文字幕一区二区三区乱码在线| 自拍av一区二区三区| 亚洲小说春色综合另类电影| 六月丁香婷婷久久| 国产成人精品在线看| 99久久综合国产精品| 欧美日韩国产三级| 精品国产免费一区二区三区四区 | 成人在线视频一区| 91精品办公室少妇高潮对白| 在线成人高清不卡| 粉嫩13p一区二区三区| 精品一二三四在线| 成人h动漫精品一区二区| 欧美性xxxxx极品少妇| 欧美成人官网二区| 亚洲视频在线一区| 久久福利资源站| 91福利视频在线| 国产午夜精品美女毛片视频| 亚洲精品五月天| 国产美女娇喘av呻吟久久| 色视频一区二区| 国产欧美一区二区精品性| 亚洲电影视频在线| 成人国产精品免费网站| 欧美老女人在线| 国产精品国产三级国产普通话蜜臀 | 久久99精品一区二区三区三区| av不卡一区二区三区| 日韩欧美激情在线| 国产日韩精品视频一区| 成人免费一区二区三区视频| 奇米影视在线99精品| 成人福利电影精品一区二区在线观看| 欧美精品一二三| 亚洲免费大片在线观看| 国产成人精品亚洲777人妖 | 国产精品欧美久久久久无广告| 亚洲永久精品国产| 国产黄色91视频| 欧美丰满美乳xxx高潮www| 亚洲精选在线视频| eeuss国产一区二区三区| 精品日韩一区二区三区| 亚洲一区二区三区免费视频| 精品视频123区在线观看| 中文字幕av免费专区久久| 91蝌蚪porny| 日韩女优视频免费观看| 国产精品每日更新| 国产激情91久久精品导航 | 免费欧美在线视频| 亚洲va欧美va人人爽| 狠狠久久亚洲欧美| 国产精品小仙女| 精品免费国产一区二区三区四区| 天天色天天爱天天射综合| 色婷婷综合激情| 亚洲欧美日韩国产综合在线| 不卡的av在线播放| 国产欧美日韩中文久久| 国产精品一区二区久久不卡| 精品国精品自拍自在线| 免费av成人在线| 欧美一区二区三区免费大片| 亚洲国产一区二区视频| 欧美日韩中字一区| 亚洲图片一区二区| 欧美乱妇20p| 日韩精品免费视频人成| 91麻豆精品国产综合久久久久久| 亚洲成人久久影院| 91精品国模一区二区三区| 亚洲国产日日夜夜| 在线播放/欧美激情| 视频在线观看91| 日韩一卡二卡三卡| 精品一区二区三区免费| 26uuu国产日韩综合| 成人午夜视频在线| 樱桃视频在线观看一区| 欧美日韩国产在线播放网站| 天天色综合天天| 精品国产伦一区二区三区观看体验| 韩日欧美一区二区三区| 欧美激情一区三区| 91丨porny丨最新| 亚洲第一主播视频| 精品国产乱码久久久久久浪潮| 国产精品69久久久久水密桃| 国产精品午夜电影| 在线免费观看不卡av| 奇米一区二区三区| 国产欧美一区二区三区沐欲| bt欧美亚洲午夜电影天堂| 亚洲一区二区三区中文字幕| 欧美一区二区视频在线观看2020| 久久电影网站中文字幕| 国产精品区一区二区三区| 在线看不卡av| 久久 天天综合| 亚洲天天做日日做天天谢日日欢 | 日韩一区二区三区在线观看| 精品在线播放免费| 国产精品白丝在线| 欧美精品1区2区3区| 国产成人在线免费| 亚洲成av人片一区二区三区| 精品国产髙清在线看国产毛片| 久久久国产综合精品女国产盗摄| 国产福利91精品一区二区三区| 亚洲精品国产成人久久av盗摄| 日韩精品专区在线影院重磅| caoporm超碰国产精品| 日本午夜精品一区二区三区电影| 国产亚洲污的网站| 91精品蜜臀在线一区尤物| 成人高清伦理免费影院在线观看| 水蜜桃久久夜色精品一区的特点| 中文字幕欧美国产| 日韩午夜精品视频| 欧美中文字幕亚洲一区二区va在线| 裸体健美xxxx欧美裸体表演| 亚洲国产经典视频| 欧美妇女性影城| 91在线视频官网| 国产在线视频精品一区| 亚洲自拍偷拍麻豆| 国产精品高潮呻吟久久| 日韩午夜在线观看视频| 欧美曰成人黄网| 不卡的电影网站| 国产一区二区h| 综合久久给合久久狠狠狠97色 | 91色视频在线| 日韩精品一区二区在线|