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

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

?? pio.c

?? configure HID devices like USB mouse with A91SAM7SE CPU. Inlcude initilization for necessary periphe
?? 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小视频在线免费看| 亚洲国产一区二区三区青草影视| 久88久久88久久久| 精品黑人一区二区三区久久| 紧缚奴在线一区二区三区| 久久久久久99精品| 成人爱爱电影网址| 一区二区在线看| 777欧美精品| 国产一二精品视频| 亚洲视频在线一区观看| 91久久精品一区二区三区| 婷婷一区二区三区| 久久综合久久99| 97se亚洲国产综合自在线观| 亚洲综合激情另类小说区| 91精品国产免费久久综合| 国产麻豆视频精品| 亚洲黄色小视频| 欧美一级黄色片| 成人免费黄色大片| 亚洲国产欧美在线| 久久免费偷拍视频| 一本高清dvd不卡在线观看| 婷婷六月综合亚洲| 久久精品视频免费| 欧美三级视频在线播放| 国产主播一区二区| 亚洲精品欧美专区| 久久综合九色综合久久久精品综合 | 久久精品国产亚洲一区二区三区| 2023国产精品自拍| 91蜜桃在线免费视频| 日韩av网站在线观看| 中文字幕成人网| 欧美一区二区黄| aaa亚洲精品| 毛片av一区二区三区| 国产欧美精品一区二区色综合朱莉 | 中文字幕视频一区| 精品欧美一区二区久久 | 一本久道久久综合中文字幕 | 日韩欧美另类在线| 色欧美日韩亚洲| 国产盗摄女厕一区二区三区| 亚洲高清免费视频| 亚洲欧洲另类国产综合| 精品国产一区久久| 欧美日韩国产综合一区二区| 成人小视频在线| 久久爱另类一区二区小说| 一二三四区精品视频| 久久天天做天天爱综合色| 欧美色网一区二区| av一区二区不卡| 国产精品中文字幕一区二区三区| 一个色在线综合| 国产精品国产三级国产普通话蜜臀| 日韩一区二区影院| 欧美猛男超大videosgay| 99re成人精品视频| 成人高清免费观看| 国产高清精品网站| 精品一区二区三区视频在线观看| 亚洲一区二区三区三| 最新国产精品久久精品| 日本一区二区三区免费乱视频| 欧美一级生活片| 91精品一区二区三区在线观看| 91日韩一区二区三区| 成人精品电影在线观看| 高清成人在线观看| 国产成+人+日韩+欧美+亚洲| 国内精品久久久久影院一蜜桃| 男人操女人的视频在线观看欧美| 午夜激情一区二区| 亚洲国产成人av网| 午夜国产精品影院在线观看| 亚洲v日本v欧美v久久精品| 亚洲国产欧美一区二区三区丁香婷| 亚洲另类一区二区| 亚洲欧美另类久久久精品2019| 中文字幕一区二区三区蜜月| 亚洲图片你懂的| 亚洲精品久久久蜜桃| 亚洲黄色小视频| 五月婷婷另类国产| 青青草成人在线观看| 久久91精品国产91久久小草| 国产又粗又猛又爽又黄91精品| 国产一区二区三区免费在线观看| 国产精品1024| 91香蕉视频在线| 欧美亚日韩国产aⅴ精品中极品| 色一情一乱一乱一91av| 欧美无人高清视频在线观看| 欧美日韩aaa| 精品国产百合女同互慰| 欧美经典一区二区| 亚洲精品中文在线观看| 五月婷婷综合在线| 国产裸体歌舞团一区二区| 成人av电影在线网| 欧美视频一区二| 久久一区二区三区四区| 国产精品另类一区| 亚洲第一福利视频在线| 精品一区二区国语对白| 成人毛片视频在线观看| 欧美日韩视频在线观看一区二区三区| 91精品国产福利| 日本一区二区免费在线| 亚洲在线免费播放| 国内精品伊人久久久久av影院| av一区二区三区| 538在线一区二区精品国产| 久久久综合视频| 亚洲永久精品大片| 国产在线精品免费av| 在线精品亚洲一区二区不卡| 欧美一区二区女人| 亚洲少妇最新在线视频| 久久99精品国产.久久久久| 97精品超碰一区二区三区| 日韩视频一区在线观看| 亚洲三级在线播放| 国产在线播放一区| 在线成人av网站| 亚洲欧美自拍偷拍色图| 精品一区二区三区视频在线观看| 91久久一区二区| 国产亚洲制服色| 日韩影院在线观看| 色综合色狠狠天天综合色| 26uuu欧美| 日韩中文字幕一区二区三区| 99re成人精品视频| 国产亚洲一区二区在线观看| 亚洲成人综合网站| 色综合久久综合| 中文字幕精品一区二区精品绿巨人 | 香蕉加勒比综合久久| 大桥未久av一区二区三区中文| 欧美日韩极品在线观看一区| 国产精品高潮呻吟久久| 国产精品自拍网站| 日韩免费观看高清完整版 | 欧美久久高跟鞋激| 亚洲另类春色校园小说| 成人精品一区二区三区中文字幕| 欧美草草影院在线视频| 婷婷丁香激情综合| 欧美羞羞免费网站| 一区二区三区不卡视频在线观看| 波多野结衣中文字幕一区| 国产亚洲成av人在线观看导航| 久久成人免费电影| 欧美一卡二卡在线| 天堂va蜜桃一区二区三区漫画版| 色婷婷久久久久swag精品| 日韩毛片精品高清免费| 9i在线看片成人免费| 欧美国产日韩精品免费观看| 国内一区二区在线| 久久久久久免费毛片精品| 精品综合久久久久久8888| 日韩你懂的在线观看| 久久se这里有精品| 日韩欧美久久久| 国产一区二区三区免费观看| www国产成人| 国产精品一线二线三线精华| 久久精品男人天堂av| 国产成人免费在线观看| 国产欧美日韩在线观看| 成人高清免费观看| 亚洲精品久久7777| 欧美影院一区二区三区| 香蕉乱码成人久久天堂爱免费| 欧美人动与zoxxxx乱| 蜜臀av一级做a爰片久久| 欧美mv和日韩mv国产网站| 国产一区二区三区香蕉| 欧美激情一区三区| 成人免费视频网站在线观看| 国产精品视频你懂的| 成人app在线观看| 亚洲美女一区二区三区| 欧美日本在线播放| 蜜桃免费网站一区二区三区| 日韩欧美一区电影| 粉嫩aⅴ一区二区三区四区| 亚洲日本在线天堂| 91精品免费观看| 国产一区二区福利视频| 亚洲欧美综合在线精品| 欧美美女一区二区三区| 国产一区亚洲一区| 亚洲三级在线播放| 日韩免费福利电影在线观看|