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

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

?? pio.c

?? tft and touch program for at91sam9263ek,編程環境為keil
?? C
字號:
/* ----------------------------------------------------------------------------
 *         ATMEL Microcontroller Software Support 
 * ----------------------------------------------------------------------------
 * Copyright (c) 2008, Atmel Corporation
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the disclaimer below.
 *
 * Atmel's name may not be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * ----------------------------------------------------------------------------
 */

//------------------------------------------------------------------------------
//         Headers
//------------------------------------------------------------------------------

#include "pio.h"
#include <board.h>

//------------------------------------------------------------------------------
//         Local Functions
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
/// Configures one or more pin(s) of a PIO controller as being controlled by
/// peripheral A. Optionally, the corresponding internal pull-up(s) can be
/// enabled.
/// \param pio  Pointer to a PIO controller.
/// \param mask  Bitmask of one or more pin(s) to configure.
/// \param enablePullUp  Indicates if the pin(s) internal pull-up shall be
///                      configured.
//------------------------------------------------------------------------------
static void PIO_SetPeripheralA(
    AT91S_PIO *pio,
    unsigned int mask,
    unsigned char enablePullUp)
{
    // Disable interrupts on the pin(s)
    pio->PIO_IDR = mask;

    // Enable the pull-up(s) if necessary
    if (enablePullUp) {

        pio->PIO_PPUER = mask;
    }
    else {

        pio->PIO_PPUDR = mask;
    }

    // Configure pin
    pio->PIO_ASR = mask;
    pio->PIO_PDR = mask;
}

//------------------------------------------------------------------------------
/// Configures one or more pin(s) of a PIO controller as being controlled by
/// peripheral B. Optionally, the corresponding internal pull-up(s) can be
/// enabled.
/// \param pio  Pointer to a PIO controller.
/// \param mask  Bitmask of one or more pin(s) to configure.
/// \param enablePullUp  Indicates if the pin(s) internal pull-up shall be
///                      configured.
//------------------------------------------------------------------------------
static void PIO_SetPeripheralB(
    AT91S_PIO *pio,
    unsigned int mask,
    unsigned char enablePullUp)
{
    // Disable interrupts on the pin(s)
    pio->PIO_IDR = mask;

    // Enable the pull-up(s) if necessary
    if (enablePullUp) {

        pio->PIO_PPUER = mask;
    }
    else {

        pio->PIO_PPUDR = mask;
    }

    // Configure pin
    pio->PIO_BSR = mask;
    pio->PIO_PDR = mask;
}

//------------------------------------------------------------------------------
/// Configures one or more pin(s) or a PIO controller as inputs. Optionally,
/// the corresponding internal pull-up(s) and glitch filter(s) can be
/// enabled.
/// \param pio  Pointer to a PIO controller.
/// \param mask  Bitmask indicating which pin(s) to configure as input(s).
/// \param enablePullUp  Indicates if the internal pull-up(s) must be enabled.
/// \param enableFilter  Indicates if the glitch filter(s) must be enabled.
//------------------------------------------------------------------------------
static void PIO_SetInput(
    AT91S_PIO *pio,
    unsigned int mask,
    unsigned char enablePullUp,
    unsigned char enableFilter)
{
    // Disable interrupts
    pio->PIO_IDR = mask;

    // Enable pull-up(s) if necessary
    if (enablePullUp) {
    
        pio->PIO_PPUER = mask;
    }
    else {
    
        pio->PIO_PPUDR = mask;
    }

    // Enable filter(s) if necessary
    if (enableFilter) {
    
        pio->PIO_IFER = mask;
    }
    else {
    
        pio->PIO_IFDR = mask;
    }

    // Configure pin as input
    pio->PIO_ODR = mask;
    pio->PIO_PER = mask;
}

//------------------------------------------------------------------------------
/// Configures one or more pin(s) of a PIO controller as outputs, with the
/// given default value. Optionally, the multi-drive feature can be enabled
/// on the pin(s).
/// \param pio  Pointer to a PIO controller.
/// \param mask  Bitmask indicating which pin(s) to configure.
/// \param defaultValue  Default level on the pin(s).
/// \param enableMultiDrive  Indicates if the pin(s) shall be configured as
///                          open-drain.
/// \param enablePullUp  Indicates if the pin shall have its pull-up activated.
//------------------------------------------------------------------------------
static void PIO_SetOutput(
    AT91S_PIO *pio,
    unsigned int mask,
    unsigned char defaultValue,
    unsigned char enableMultiDrive,
    unsigned char enablePullUp)
{
    // Disable interrupts
    pio->PIO_IDR = mask;

    // Enable pull-up(s) if necessary
    if (enablePullUp) {
    
        pio->PIO_PPUER = mask;
    }
    else {
    
        pio->PIO_PPUDR = mask;
    }

    // Enable multi-drive if necessary
    if (enableMultiDrive) {
    
        pio->PIO_MDER = mask;
    }
    else {
    
        pio->PIO_MDDR = mask;
    }

    // Set default value
    if (defaultValue) {

        pio->PIO_SODR = mask;
    }
    else {

        pio->PIO_CODR = mask;
    }

    // Configure pin(s) as output(s)
    pio->PIO_OER = mask;
    pio->PIO_PER = mask;
}

//------------------------------------------------------------------------------
//         Global Functions
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
/// Configures a list of Pin instances, each of which can either hold a single
/// pin or a group of pins, depending on the mask value; all pins are configured
/// by this function. The size of the array must also be provided and is easily
/// computed using PIO_LISTSIZE whenever its length is not known in advance.
/// \param list  Pointer to a list of Pin instances.
/// \param size  Size of the Pin list (calculated using PIO_LISTSIZE).
/// \return 1 if the pins have been configured properly; otherwise 0.
//------------------------------------------------------------------------------
unsigned char PIO_Configure(const Pin *list, unsigned int size)
{
    // Configure pins
    while (size > 0) {
    
        switch (list->type) {
    
            case PIO_PERIPH_A:
                PIO_SetPeripheralA(list->pio,
                                   list->mask,
                                   (list->attribute & PIO_PULLUP) ? 1 : 0);
                break;
    
            case PIO_PERIPH_B:
                PIO_SetPeripheralB(list->pio,
                                   list->mask,
                                   (list->attribute & PIO_PULLUP) ? 1 : 0);
                break;
    
            case PIO_INPUT:
                AT91C_BASE_PMC->PMC_PCER = 1 << list->id;
                PIO_SetInput(list->pio,
                             list->mask,
                             (list->attribute & PIO_PULLUP) ? 1 : 0,
                             (list->attribute & PIO_DEGLITCH)? 1 : 0);
                break;
    
            case PIO_OUTPUT_0:
            case PIO_OUTPUT_1:
                PIO_SetOutput(list->pio,
                              list->mask,
                              (list->type == PIO_OUTPUT_1),
                              (list->attribute & PIO_OPENDRAIN) ? 1 : 0,
                              (list->attribute & PIO_PULLUP) ? 1 : 0);
                break;
    
            default: return 0;
        }

        list++;
        size--;
    }

    return 1;
}

//------------------------------------------------------------------------------
/// Sets a high output level on all the PIOs defined in the given Pin instance.
/// This has no immediate effects on PIOs that are not output, but the PIO
/// controller will memorize the value they are changed to outputs.
/// \param pin  Pointer to a Pin instance describing one or more pins.
//------------------------------------------------------------------------------
void PIO_Set(const Pin *pin)
{
    pin->pio->PIO_SODR = pin->mask;
}

//------------------------------------------------------------------------------
/// Sets a low output level on all the PIOs defined in the given Pin instance.
/// This has no immediate effects on PIOs that are not output, but the PIO
/// controller will memorize the value they are changed to outputs.
/// \param pin  Pointer to a Pin instance describing one or more pins.
//------------------------------------------------------------------------------
void PIO_Clear(const Pin *pin)
{
    pin->pio->PIO_CODR = pin->mask;
}

//------------------------------------------------------------------------------
/// Returns 1 if one or more PIO of the given Pin instance currently have a high
/// level; otherwise returns 0. This method returns the actual value that is
/// being read on the pin. To return the supposed output value of a pin, use
/// PIO_GetOutputDataStatus() instead.
/// \param pin  Pointer to a Pin instance describing one or more pins.
/// \return 1 if the Pin instance contains at least one PIO that currently has
/// a high level; otherwise 0.
//------------------------------------------------------------------------------
unsigned char PIO_Get(const Pin *pin)
{
    unsigned int reg;
    if ((pin->type == PIO_OUTPUT_0) || (pin->type == PIO_OUTPUT_1)) {

        reg = pin->pio->PIO_ODSR;
    }
    else {

        reg = pin->pio->PIO_PDSR;
    }

    if ((reg & pin->mask) == 0) {

        return 0;
    }
    else {

        return 1;
    }
}


//------------------------------------------------------------------------------
/// Returns 1 if one or more PIO of the given Pin are configured to output a
/// high level (even if they are not output).
/// To get the actual value of the pin, use PIO_Get() instead.
/// \param pin  Pointer to a Pin instance describing one or more pins.
/// \return 1 if the Pin instance contains at least one PIO that is configured
/// to output a high level; otherwise 0.
//------------------------------------------------------------------------------
unsigned char PIO_GetOutputDataStatus(const Pin *pin)
{
    if ((pin->pio->PIO_ODSR & pin->mask) == 0) {

        return 0;
    }
    else {

        return 1;
    }
}

//------------------------------------------------------------------------------
/// Returns the value of ISR for the PIO controller of the pin.
/// Reading this register acknoledges all the ITs.
/// \param pin  Pointer to a Pin instance describing one or more pins.
//------------------------------------------------------------------------------
unsigned int PIO_GetISR(const Pin *pin)
{
    return (pin->pio->PIO_ISR);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
97精品电影院| 国产成a人无v码亚洲福利| 色中色一区二区| 国产精品久久久久久久久免费桃花 | 乱中年女人伦av一区二区| 欧美日韩国产另类一区| 日本aⅴ亚洲精品中文乱码| 欧美一卡2卡3卡4卡| 久久狠狠亚洲综合| 国产欧美日韩视频在线观看| 成人免费福利片| 亚洲精品一卡二卡| 欧美日韩不卡一区| 久久99久国产精品黄毛片色诱| 久久久一区二区三区| 大白屁股一区二区视频| 综合久久综合久久| 欧美电影一区二区| 国产一本一道久久香蕉| 亚洲视频在线一区观看| 欧美日韩一区在线| 久久99蜜桃精品| 国产精品高清亚洲| 欧美精品欧美精品系列| 国产mv日韩mv欧美| 三级成人在线视频| 国产亚洲综合色| 欧美在线观看一区| 看国产成人h片视频| 一区二区中文字幕在线| 91精品国产综合久久婷婷香蕉| 国产激情一区二区三区| 亚洲一区二区三区在线看| 精品日韩在线观看| 91福利资源站| 国产精品1024久久| 天堂成人免费av电影一区| 国产精品久久久久aaaa樱花| 在线不卡的av| 色呦呦国产精品| 国产高清精品网站| 午夜精品久久久久久久久久| 亚洲国产电影在线观看| 日韩女优毛片在线| 在线观看av不卡| 国产98色在线|日韩| 青青草原综合久久大伊人精品| 日本一区二区三区久久久久久久久不 | 亚洲欧美激情插| 精品久久久久香蕉网| 91久久人澡人人添人人爽欧美| 九色综合狠狠综合久久| 午夜视频久久久久久| 中文字幕五月欧美| 国产欧美精品一区二区色综合 | 欧美极品xxx| 91精品国产综合久久福利软件| 成人激情小说乱人伦| 午夜精彩视频在线观看不卡| 亚洲女爱视频在线| 中文字幕亚洲在| 国产肉丝袜一区二区| 日韩精品最新网址| 欧美中文字幕亚洲一区二区va在线| 国产福利视频一区二区三区| 精品一区二区在线看| 日本特黄久久久高潮| 日韩成人精品在线观看| 亚洲小说春色综合另类电影| 亚洲天堂a在线| 成人欧美一区二区三区白人| 日本一区二区综合亚洲| 国产亚洲精品资源在线26u| 精品国产乱码久久久久久蜜臀| 欧美精品在线观看播放| 欧美性xxxxx极品少妇| 色8久久人人97超碰香蕉987| 91在线免费看| 色94色欧美sute亚洲线路一ni| 91在线丨porny丨国产| 色一情一乱一乱一91av| 在线观看视频91| 欧美亚洲动漫精品| 欧美精品国产精品| 日韩一级二级三级精品视频| 日韩亚洲欧美在线| 亚洲精品一区二区在线观看| 久久这里只有精品首页| 久久久亚洲精品一区二区三区 | 久久免费视频色| 久久久久久免费网| 国产婷婷色一区二区三区| 亚洲国产精品99久久久久久久久| 国产精品久久久久毛片软件| 亚洲精品网站在线观看| 香蕉久久夜色精品国产使用方法| 丝袜亚洲另类欧美综合| 久热成人在线视频| 国产成人在线视频网址| 99re8在线精品视频免费播放| 色欲综合视频天天天| 91精品国产日韩91久久久久久| 欧美电影免费观看高清完整版在| 精品国产91乱码一区二区三区| 国产亚洲欧美在线| 日本一区二区动态图| 97aⅴ精品视频一二三区| 欧洲av在线精品| 日韩精品中文字幕在线一区| 久久精品在线观看| 亚洲高清不卡在线| 国产乱码精品一区二区三区五月婷| 风间由美中文字幕在线看视频国产欧美| 成人三级伦理片| 欧美乱妇23p| 欧美激情资源网| 婷婷开心久久网| 成人视屏免费看| 欧美日韩高清不卡| 国产欧美精品一区| 日本不卡一区二区三区高清视频| 国产成人丝袜美腿| 9191国产精品| 国产精品乱码妇女bbbb| 五月天欧美精品| 99热精品一区二区| 欧美成人午夜电影| 亚洲制服丝袜av| 福利一区福利二区| 欧美一级欧美三级在线观看| 成人欧美一区二区三区1314| 久久精品99国产国产精| 色婷婷av一区二区三区之一色屋| 欧美大片在线观看一区二区| 中文字幕佐山爱一区二区免费| 精品中文av资源站在线观看| 在线亚洲免费视频| 国产精品乱码一区二三区小蝌蚪| 婷婷久久综合九色国产成人| 99久久国产综合精品麻豆| 精品三级在线观看| 日韩精品福利网| 91天堂素人约啪| 久久亚洲精品小早川怜子| 亚洲成人免费电影| 色综合天天综合网国产成人综合天 | 在线观看三级视频欧美| 中文字幕欧美日韩一区| 国内外成人在线| 91精品国产综合久久精品| 亚洲图片自拍偷拍| proumb性欧美在线观看| 精品国产区一区| 精品在线观看免费| 日韩一区二区精品在线观看| 亚洲国产一区二区a毛片| 91在线视频观看| 中文字幕不卡在线播放| 国产精品一区二区在线观看不卡| 欧美一区二区黄色| 五月综合激情日本mⅴ| 欧美网站大全在线观看| 一区二区三区精品| 91豆麻精品91久久久久久| 中文字幕中文在线不卡住| 高清av一区二区| 国产精品青草综合久久久久99| 国产精品性做久久久久久| 久久亚洲一级片| 国产成人精品亚洲午夜麻豆| 久久精品亚洲一区二区三区浴池 | 欧美亚洲精品一区| 亚洲www啪成人一区二区麻豆| 欧美吻胸吃奶大尺度电影| 亚洲国产精品嫩草影院| 欧美日韩国产另类一区| 日韩av一区二区在线影视| 日韩免费成人网| 国产精品正在播放| 国产精品视频麻豆| 一本久道久久综合中文字幕| 一级中文字幕一区二区| 91福利国产精品| 免费成人av在线| 久久久精品国产免大香伊| www.亚洲免费av| 亚洲男人的天堂网| 欧美裸体bbwbbwbbw| 美女脱光内衣内裤视频久久网站| 精品国产91久久久久久久妲己 | 色嗨嗨av一区二区三区| 香蕉久久一区二区不卡无毒影院| 日韩免费高清av| 不卡一区二区三区四区| 一区二区三区在线视频免费| 欧美久久久久免费| 国产精品自拍毛片| 一区二区三区在线免费观看| 欧美精品日韩一区| 成人动漫av在线|