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

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

?? pio.c

?? at91sam9263 keilv3 一級啟動代碼,其中晶振頻率為16m
?? 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一区二区三区免费野_久草精品视频
亚洲国产视频在线| 午夜精品免费在线| 欧美一区二区三级| 成人精品国产一区二区4080| 蜜臀av一区二区| 一区二区三区四区激情| 国产日韩精品一区二区三区在线| 欧美日韩电影在线| va亚洲va日韩不卡在线观看| 久久66热偷产精品| 午夜欧美2019年伦理| 亚洲人妖av一区二区| 久久综合九色综合97婷婷 | 91福利区一区二区三区| 精品在线观看视频| 午夜精品久久久久久久久| 亚洲欧美日韩国产综合在线| 日本一区二区三区dvd视频在线| 日韩欧美国产wwwww| 欧美高清性hdvideosex| 在线免费观看日本欧美| 91麻豆自制传媒国产之光| 大胆亚洲人体视频| 国产精品18久久久| 精品在线观看免费| 日本精品裸体写真集在线观看| 国产电影精品久久禁18| 狠狠色综合播放一区二区| 日韩高清国产一区在线| 午夜欧美在线一二页| 亚洲一区二三区| 亚洲综合在线电影| 亚洲在线成人精品| 一区二区三区中文字幕精品精品| 1024国产精品| 亚洲人123区| 亚洲激情图片小说视频| 亚洲欧美视频一区| 综合色中文字幕| 亚洲精品国产一区二区精华液| 中文字幕一区二区三区在线播放| 欧美国产日韩a欧美在线观看| 欧美国产日产图区| 国产精品短视频| 亚洲精品视频在线观看网站| 亚洲精品日韩一| 亚洲成人激情社区| 日日夜夜免费精品视频| 麻豆一区二区99久久久久| 久久激五月天综合精品| 激情都市一区二区| 国产69精品一区二区亚洲孕妇| 国产91精品精华液一区二区三区| heyzo一本久久综合| 在线中文字幕不卡| 在线播放国产精品二区一二区四区| 欧美高清你懂得| 欧美mv和日韩mv的网站| 国产亲近乱来精品视频| 综合激情成人伊人| 亚洲国产另类av| 美女视频网站黄色亚洲| 国产99精品国产| 一本久久综合亚洲鲁鲁五月天| 欧美日韩一区二区三区视频| 欧美videos中文字幕| 国产精品理论在线观看| 亚洲成人av在线电影| 黑人精品欧美一区二区蜜桃| 成人国产精品免费网站| 欧美乱妇23p| 久久久久久一级片| 一区二区三区在线视频观看| 看电视剧不卡顿的网站| 99久久精品国产精品久久| 在线不卡一区二区| 日本一区二区免费在线| 亚洲亚洲人成综合网络| 国产精一区二区三区| 日本韩国一区二区| 久久久久久久精| 亚洲综合成人在线| 国产成人综合在线| 欧美高清视频在线高清观看mv色露露十八 | 成人91在线观看| 欧美日韩国产在线播放网站| 国产亚洲精品aa| 午夜国产不卡在线观看视频| 岛国av在线一区| 日韩欧美久久久| 一区二区三区视频在线看| 国产一区免费电影| 在线电影欧美成精品| 国产精品成人免费精品自在线观看| 日韩电影一区二区三区四区| 色综合天天综合网国产成人综合天| 日韩一区二区三区免费看| 亚洲精品成人精品456| 国产精品一区免费视频| 777午夜精品免费视频| 日韩一区欧美一区| 久久91精品国产91久久小草| 欧美系列亚洲系列| 国产精品成人免费| 韩国午夜理伦三级不卡影院| 欧美夫妻性生活| 亚洲男人的天堂一区二区| 国产成人在线免费| 精品成人a区在线观看| 视频一区二区中文字幕| 91国偷自产一区二区三区成为亚洲经典 | 亚洲欧洲美洲综合色网| 国产精品一线二线三线精华| 3d动漫精品啪啪| 亚洲国产美国国产综合一区二区| 成人午夜电影网站| 久久久久久久久久看片| 激情文学综合网| 欧美xxx久久| 精品一区二区三区视频| 欧美成人免费网站| 日本成人在线视频网站| 欧美精品亚洲二区| 午夜视频在线观看一区| 欧美日韩在线一区二区| 亚洲午夜视频在线| 欧美日韩一区二区在线视频| 亚洲一区二区三区视频在线播放 | 久久综合色综合88| 极品美女销魂一区二区三区 | 一区二区三区日韩在线观看| 一本一道波多野结衣一区二区| 国产精品久久夜| 99久久久无码国产精品| 国产精品麻豆视频| 99热这里都是精品| 亚洲视频资源在线| 91亚洲精品久久久蜜桃网站 | 欧美激情自拍偷拍| 懂色av一区二区在线播放| 中文字幕欧美国产| 91首页免费视频| 亚洲免费视频中文字幕| 在线观看亚洲专区| 亚洲v中文字幕| 91精品国产综合久久久久久| 久久精品国产精品亚洲红杏 | 亚洲欧美综合另类在线卡通| 91啦中文在线观看| 一区二区三区鲁丝不卡| 欧美日韩精品一区二区三区 | 2020国产精品自拍| 国产成人在线视频网址| 国产精品二三区| 欧美视频一区二区三区四区 | 色综合色狠狠天天综合色| 一区二区三区四区不卡在线| 91精品国产综合久久精品| 国内久久精品视频| 亚洲欧洲精品一区二区三区| 欧美性猛片xxxx免费看久爱| 视频一区欧美精品| 国产欧美日韩精品在线| 在线一区二区三区四区五区| 视频一区欧美精品| 久久综合久久久久88| 91在线视频播放| 日韩和的一区二区| 欧美激情自拍偷拍| 欧美性猛交xxxx黑人交| 久久99九九99精品| 中文字幕亚洲综合久久菠萝蜜| 欧美色精品在线视频| 国产成人在线视频网址| 亚洲国产成人91porn| 26uuu另类欧美| 在线精品亚洲一区二区不卡| 国内精品国产成人国产三级粉色 | 日韩三级高清在线| www.一区二区| 蜜臀久久99精品久久久画质超高清| 中文字幕av一区 二区| 91精品在线一区二区| 成人av在线一区二区三区| 日韩av一区二区在线影视| 国产精品美女一区二区在线观看| 欧美精品色综合| 不卡视频一二三| 精品无码三级在线观看视频| 亚洲一区二区三区中文字幕| 久久久久久久久99精品| 欧美老女人在线| www.综合网.com| 精品亚洲成a人| 亚洲成人av免费| 亚洲免费在线观看| 国产日韩欧美不卡| 欧美哺乳videos| 欧美日韩国产综合一区二区| 成人黄色a**站在线观看|