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

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

?? pio.c

?? 在AT91Sam7x256開發(fā)板下
?? 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);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人影视亚洲图片在线| 国产精品卡一卡二| 日韩视频永久免费| 91精品久久久久久久91蜜桃| 欧美日韩在线亚洲一区蜜芽| 欧美视频一区二区三区在线观看 | 欧美在线一区二区| 日本高清免费不卡视频| 一本色道久久综合亚洲91| 97精品国产97久久久久久久久久久久| 成熟亚洲日本毛茸茸凸凹| 成人一级视频在线观看| 成人福利视频网站| 色婷婷综合中文久久一本| 在线看国产一区二区| 欧美精品日韩一区| 日韩色视频在线观看| 精品1区2区在线观看| 久久精品夜色噜噜亚洲a∨| 久久精品亚洲精品国产欧美| 中文字幕不卡的av| 亚洲美女免费视频| 午夜成人免费电影| 国产一区二区成人久久免费影院| 国产91在线看| 色综合久久综合网97色综合 | 精品国产乱码久久久久久蜜臀| 精品国产污污免费网站入口 | 日韩一区二区三区免费看 | 777奇米成人网| 久久综合视频网| 中文字幕一区二区三区在线观看| 一区二区三区小说| 日韩va欧美va亚洲va久久| 国产精品911| 日本高清不卡在线观看| 日韩一级完整毛片| 国产精品久99| 天天影视网天天综合色在线播放| 精品一区二区日韩| av一二三不卡影片| 日韩一级成人av| 国产精品理伦片| 日本欧美大码aⅴ在线播放| 国产福利电影一区二区三区| 色老汉一区二区三区| 欧美videossexotv100| 最新高清无码专区| 免费观看91视频大全| 99精品久久免费看蜜臀剧情介绍| 正在播放亚洲一区| 国产精品成人免费精品自在线观看| 舔着乳尖日韩一区| 波多野结衣中文一区| 欧美一级视频精品观看| 国产精品毛片久久久久久| 天天综合色天天| 91在线无精精品入口| 日韩欧美精品三级| 亚洲自拍偷拍欧美| 国产成人a级片| 666欧美在线视频| 亚洲欧美激情一区二区| 久久不见久久见中文字幕免费| 99在线精品视频| 日韩精品中午字幕| 亚洲一区二区黄色| eeuss鲁一区二区三区| 欧美成人a∨高清免费观看| 一区二区三区在线视频播放| 国产成人日日夜夜| 日韩美一区二区三区| 亚洲成年人网站在线观看| 99re这里都是精品| 久久久国产午夜精品| 日本欧美一区二区| 欧美日韩国产首页| 亚洲免费观看视频| av电影天堂一区二区在线观看| 2024国产精品视频| 免费精品视频最新在线| 欧美三级三级三级爽爽爽| 亚洲欧美激情插| 成人av先锋影音| 中文字幕第一区| 国产黄色精品网站| 久久久久久久久久久电影| 老司机精品视频导航| 91精品国产综合久久精品性色| 一区二区三区在线视频播放| 91啪九色porn原创视频在线观看| 国产日韩欧美精品综合| 国产伦理精品不卡| 久久精品一区二区三区四区| 激情成人午夜视频| 精品久久久久久久人人人人传媒| 日韩不卡免费视频| 日韩一级视频免费观看在线| 美女视频黄久久| 欧美成人性福生活免费看| 久久精品国产亚洲高清剧情介绍 | 国产一区二区伦理片| 久久在线观看免费| 国产大片一区二区| 亚洲国产成人午夜在线一区 | 日韩午夜三级在线| 日韩精品亚洲专区| 日韩一区和二区| 九九精品视频在线看| 精品久久国产老人久久综合| 久色婷婷小香蕉久久| 久久午夜电影网| 成人黄色免费短视频| 亚洲欧美在线视频观看| 色综合天天狠狠| 亚洲成av人片在www色猫咪| 这里只有精品99re| 国产在线国偷精品产拍免费yy| 2023国产精品视频| 成人黄页毛片网站| 一区二区三区免费网站| 欧美视频一区二区| 免费的国产精品| 久久久亚洲欧洲日产国码αv| 国产ts人妖一区二区| 综合激情网...| 欧美视频在线播放| 黄页视频在线91| 国产精品高潮呻吟久久| 欧美亚洲丝袜传媒另类| 人人精品人人爱| 国产日韩欧美综合一区| 91丨九色丨蝌蚪丨老版| 日韩精品国产精品| 国产欧美一区在线| 欧美中文字幕一二三区视频| 日韩成人av影视| 中文在线一区二区| 欧美精品自拍偷拍动漫精品| 国产在线日韩欧美| 亚洲美腿欧美偷拍| 91久久线看在观草草青青| 国产精品久久久久婷婷| 欧美性视频一区二区三区| 久久不见久久见免费视频7| 中文字幕在线不卡一区二区三区| 在线亚洲一区二区| 久久99精品国产| 亚洲人亚洲人成电影网站色| 欧美久久久久中文字幕| 国产高清久久久| 亚洲444eee在线观看| 国产肉丝袜一区二区| 欧美视频在线一区| 国产成人自拍网| 视频在线在亚洲| 国产精品理伦片| 欧美成人艳星乳罩| 欧美亚洲综合另类| 粉嫩aⅴ一区二区三区四区| 五月激情丁香一区二区三区| 中文字幕的久久| 欧美不卡在线视频| 在线国产亚洲欧美| 国产不卡在线播放| 日产国产欧美视频一区精品| 国产精品国产三级国产专播品爱网| 欧美一区二区不卡视频| 91蜜桃网址入口| 国产精品一级二级三级| 奇米影视一区二区三区| 亚洲精品视频自拍| 日本一区二区在线不卡| 日韩一区二区在线观看视频| 欧美中文字幕亚洲一区二区va在线| 国产成人在线免费| 久久国产精品区| 肉肉av福利一精品导航| 亚洲在线成人精品| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 免费看欧美美女黄的网站| 亚洲一区二区综合| 中文字幕佐山爱一区二区免费| 精品成人私密视频| 337p亚洲精品色噜噜狠狠| 色老汉一区二区三区| 91在线国内视频| 处破女av一区二区| 国产成人在线视频网址| 国产主播一区二区三区| 蓝色福利精品导航| 人人超碰91尤物精品国产| 偷拍一区二区三区| 亚洲成人激情综合网| 一区二区三区欧美视频| 亚洲黄色av一区| 一区二区三区成人| 亚洲午夜激情av| 亚洲福利一区二区三区| 亚洲一级不卡视频|