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

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

?? i2c.c

?? 基于 Cortex-M3 (ARM) 內核使用之 uC/OS-II 作業系統,此例程可移植于 Cortex-M3 (ARM)內核的微處理器上的應用,于 Keil MDK 3.15b以上 工程編譯,而
?? C
?? 第 1 頁 / 共 2 頁
字號:
    //
    // Return either the interrupt status or the raw interrupt status as
    // requested.
    //
    if(bMasked)
    {
        return((HWREG(ulBase + I2C_MASTER_O_MIS)) ? true : false);
    }
    else
    {
        return((HWREG(ulBase + I2C_MASTER_O_RIS)) ? true : false);
    }
}

//*****************************************************************************
//
//! Gets the current I2C Slave interrupt status.
//!
//! \param ulBase base address of the I2C Slave module
//! \param bMasked is false if the raw interrupt status is requested and
//! true if the masked interrupt status is requested.
//!
//! This returns the interrupt status for the I2C Slave module.
//! Either the raw interrupt status or the status of interrupts that are
//! allowed to reflect to the processor can be returned.
//!
//! \return The current interrupt status, returned as \b true if active
//! or \b false if not active.
//
//*****************************************************************************
tBoolean
I2CSlaveIntStatus(unsigned long ulBase, tBoolean bMasked)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_SLAVE_BASE);

    //
    // Return either the interrupt status or the raw interrupt status as
    // requested.
    //
    if(bMasked)
    {
        return((HWREG(ulBase + I2C_SLAVE_O_MIS)) ? true : false);
    }
    else
    {
        return((HWREG(ulBase + I2C_SLAVE_O_RIS)) ? true : false);
    }
}

//*****************************************************************************
//
//! Clears I2C Master interrupt sources.
//!
//! \param ulBase base address of the I2C Master module
//!
//! The I2C Master interrupt source is cleared, so that it no longer asserts.
//! This must be done in the interrupt.handler to keep it from being called
//! again immediately upon exit.
//!
//! \return None.
//
//*****************************************************************************
void
I2CMasterIntClear(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Clear the I2C master interrupt source.
    //
    HWREG(ulBase + I2C_MASTER_O_MIS) = I2C_MASTER_MICR_IC;
}

//*****************************************************************************
//
//! Clears I2C Slave interrupt sources.
//!
//! \param ulBase base address of the I2C Slave module
//!
//! The I2C Slave interrupt source is cleared, so that it no longer asserts.
//! This must be done in the interrupt.handler to keep it from being called
//! again immediately upon exit.
//!
//! \return None.
//
//*****************************************************************************
void
I2CSlaveIntClear(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_SLAVE_BASE);

    //
    // Clear the I2C slave interrupt source.
    //
    HWREG(ulBase + I2C_SLAVE_O_SICR) = I2C_SLAVE_SICR_IC;
}

//*****************************************************************************
//
//! Sets the address that the I2C Master will place on the bus.
//!
//! \param ulBase base address of the I2C Master module
//! \param ucSlaveAddr 7-bit slave address
//! \param bReceive flag indicating the type of communication with the slave
//!
//! This function will set the address that the I2C Master will place on the
//! bus when initiating a transaction. When the parameter \e bReceive is set
//! to \b true, the address will indicate that the I2C Master is initiating
//! a read from the slave; otherwise the address will indicate that the I2C
//! Master is initiating a write to the slave.
//!
//! \return None.
//
//*****************************************************************************
void
I2CMasterSlaveAddrSet(unsigned long ulBase, unsigned char ucSlaveAddr,
                      tBoolean bReceive)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);
    ASSERT(!(ucSlaveAddr & 0x80));

    //
    // Set the address of the slave with which the master will communicate.
    //
    HWREG(ulBase + I2C_MASTER_O_SA) = (ucSlaveAddr << 1) | bReceive;
}

//*****************************************************************************
//
//! Indicates whether or not the I2C Master is busy.
//!
//! \param ulBase base address of the I2C Master module
//!
//! This function returns an indication of whether or not the I2C Master is
//! busy transmitting or receiving data.
//!
//! \return Returns \b true if the I2C Master is busy; otherwise, returns
//! \b false.
//
//*****************************************************************************
tBoolean
I2CMasterBusy(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Return the busy status.
    //
    if(HWREG(ulBase + I2C_MASTER_O_CS) & I2C_MASTER_CS_BUSY)
    {
        return(true);
    }
    else
    {
        return(false);
    }
}

//*****************************************************************************
//
//! Indicates whether or not the I2C bus is busy.
//!
//! \param ulBase base address of the I2C Master module
//!
//! This function returns an indication of whether or not the I2C bus is
//! busy. This function can be used in a multi-master environment to
//! determine if another master is currently using the bus.
//!
//! \return Returns \b true if the I2C bus is busy; otherwise, returns
//! \b false.
//
//*****************************************************************************
tBoolean
I2CMasterBusBusy(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Return the bus busy status.
    //
    if(HWREG(ulBase + I2C_MASTER_O_CS) & I2C_MASTER_CS_BUS_BUSY)
    {
        return(true);
    }
    else
    {
        return(false);
    }
}

//*****************************************************************************
//
//! Controls the state of the I2C Master module.
//!
//! \param ulBase base address of the I2C Master module
//! \param ulCmd command to be issued to the I2C Master module
//!
//! This function is used to control the state of the Master module send and
//! receive operations. The parameter \e ucCmd can be one of the following
//! values:
//!
//! - I2C_MASTER_CMD_SINGLE_SEND
//! - I2C_MASTER_CMD_SINGLE_RECEIVE
//! - I2C_MASTER_CMD_BURST_SEND_START
//! - I2C_MASTER_CMD_BURST_SEND_CONT
//! - I2C_MASTER_CMD_BURST_SEND_FINISH
//! - I2C_MASTER_CMD_BURST_SEND_ERROR_STOP
//! - I2C_MASTER_CMD_BURST_RECEIVE_START
//! - I2C_MASTER_CMD_BURST_RECEIVE_CONT
//! - I2C_MASTER_CMD_BURST_RECEIVE_FINISH
//! - I2C_MASTER_CMD_BURST_RECEIVE_ERROR_STOP
//!
//! \return None.
//
//*****************************************************************************
void
I2CMasterControl(unsigned long ulBase, unsigned long ulCmd)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);
    ASSERT((ulCmd == I2C_MASTER_CMD_SINGLE_SEND) ||
           (ulCmd == I2C_MASTER_CMD_SINGLE_RECEIVE) ||
           (ulCmd == I2C_MASTER_CMD_BURST_SEND_START) ||
           (ulCmd == I2C_MASTER_CMD_BURST_SEND_CONT) ||
           (ulCmd == I2C_MASTER_CMD_BURST_SEND_FINISH) ||
           (ulCmd == I2C_MASTER_CMD_BURST_SEND_ERROR_STOP) ||
           (ulCmd == I2C_MASTER_CMD_BURST_RECEIVE_START) ||
           (ulCmd == I2C_MASTER_CMD_BURST_RECEIVE_CONT) ||
           (ulCmd == I2C_MASTER_CMD_BURST_RECEIVE_FINISH) ||
           (ulCmd == I2C_MASTER_CMD_BURST_RECEIVE_ERROR_STOP));

    //
    // Send the command.
    //
    HWREG(ulBase + I2C_MASTER_O_CS) = ulCmd;
}

//*****************************************************************************
//
//! Gets the error status of the I2C Master module.
//!
//! \param ulBase base address of the I2C Master module
//!
//! This function is used to obtain the error status of the Master module
//! send and receive operations. It returns one of the following values:
//!
//! - I2C_MASTER_ERR_NONE
//! - I2C_MASTER_ERR_ADDR_ACK
//! - I2C_MASTER_ERR_DATA_ACK
//! - I2C_MASTER_ERR_ARB_LOST
//!
//! \return None.
//
//*****************************************************************************
unsigned long
I2CMasterErr(unsigned long ulBase)
{
    unsigned long ulErr;

    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Get the raw error state
    //
    ulErr = HWREG(ulBase + I2C_MASTER_O_CS);

    //
    // If the I2C master is busy, then all the other bit are invalid, and
    // don't have an error to report.
    //
    if(ulErr & I2C_MASTER_CS_BUSY)
    {
        return(I2C_MASTER_ERR_NONE);
    }

    //
    // Check for errors.
    //
    if(ulErr & I2C_MASTER_CS_ERROR)
    {
        return(ulErr & (I2C_MASTER_CS_ERR_MASK));
    }
    else
    {
        return(I2C_MASTER_ERR_NONE);
    }
}

//*****************************************************************************
//
//! Transmits a byte from the I2C Master.
//!
//! \param ulBase base address of the I2C Master module
//! \param ucData data to be transmitted from the I2C Master
//!
//! This function will place the supplied data into I2C Master Data Register.
//!
//! \return None.
//
//*****************************************************************************
void
I2CMasterDataPut(unsigned long ulBase, unsigned char ucData)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Write the byte.
    //
    HWREG(ulBase + I2C_MASTER_O_DR) = ucData;
}

//*****************************************************************************
//
//! Receives a byte that has been sent to the I2C Master.
//!
//! \param ulBase base address of the I2C Master module
//!
//! This function reads a byte of data from the I2C Master Data Register.
//!
//! \return Returns the byte received from by the I2C Master, cast as an
//! unsigned long.
//
//*****************************************************************************
unsigned long
I2CMasterDataGet(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Read a byte.
    //
    return(HWREG(ulBase + I2C_MASTER_O_DR));
}

//*****************************************************************************
//
//! Gets the I2C Slave module status
//!
//! \param ulBase base address of the I2C Slave module
//!
//! This function will return the action requested from a master, if any. The
//! possible values returned are:
//!
//! - I2C_SLAVE_ACT_NONE
//! - I2C_SLAVE_ACT_RREQ
//! - I2C_SLAVE_ACT_TREQ
//!
//! where I2C_SLAVE_ACT_NONE means that no action has been requested of the
//! I2C Slave module, I2C_SLAVE_ACT_RREQ means that an I2C master has sent
//! data to the I2C Slave module, and I2C_SLAVE_ACT_TREQ means that an I2C
//! master has requested that the I2C Slave module send data.
//!
//! \return None.
//
//*****************************************************************************
unsigned long
I2CSlaveStatus(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_SLAVE_BASE);

    //
    // Return the slave status.
    //
    return(HWREG(ulBase + I2C_SLAVE_O_CSR));
}

//*****************************************************************************
//
//! Transmits a byte from the I2C Slave.
//!
//! \param ulBase base address of the I2C Slave module
//! \param ucData data to be transmitted from the I2C Slave
//!
//! This function will place the supplied data into I2C Slave Data Register.
//!
//! \return None.
//
//*****************************************************************************
void
I2CSlaveDataPut(unsigned long ulBase, unsigned char ucData)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_SLAVE_BASE);

    //
    // Write the byte.
    //
    HWREG(ulBase + I2C_SLAVE_O_DR) = ucData;
}

//*****************************************************************************
//
//! Receives a byte that has been sent to the I2C Slave.
//!
//! \param ulBase base address of the I2C Slave module
//!
//! This function reads a byte of data from the I2C Slave Data Register.
//!
//! \return Returns the byte received from by the I2C Slave, cast as an
//! unsigned long.
//
//*****************************************************************************
unsigned long
I2CSlaveDataGet(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_SLAVE_BASE);

    //
    // Read a byte.
    //
    return(HWREG(ulBase + I2C_SLAVE_O_DR));
}

//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久蜜臀中文字幕| 亚洲不卡一区二区三区| 伊人性伊人情综合网| 蜜桃视频一区二区三区| 99久久国产综合色|国产精品| 这里只有精品免费| 亚洲美女淫视频| 风流少妇一区二区| 欧美一区二区三区在线看| 中文字幕高清不卡| 激情偷乱视频一区二区三区| 在线免费精品视频| 中文字幕日韩欧美一区二区三区| 久久成人精品无人区| 欧美日本一区二区三区| 亚洲欧美日韩电影| 波多野洁衣一区| 久久精品亚洲一区二区三区浴池 | 欧美国产1区2区| 麻豆精品国产91久久久久久| 欧美二区乱c少妇| 亚洲一区中文在线| 91蜜桃婷婷狠狠久久综合9色| 欧美国产日本视频| 成人精品视频一区二区三区尤物| 久久人人超碰精品| 国产麻豆一精品一av一免费| 精品国产乱码久久久久久影片| 日本特黄久久久高潮| 欧美一区二区人人喊爽| 天天av天天翘天天综合网| 欧美视频在线不卡| 污片在线观看一区二区| 欧美日韩中文字幕精品| 午夜精品久久久久久久99樱桃| 欧美日韩小视频| 秋霞av亚洲一区二区三| 精品国产成人系列| 久久精工是国产品牌吗| 久久新电视剧免费观看| 成人中文字幕在线| 亚洲色大成网站www久久九九| 色素色在线综合| 婷婷成人综合网| 日韩精品一区二区三区中文不卡| 国产一区二区三区在线看麻豆| 精品99999| 成人一区在线观看| 亚洲美女一区二区三区| 欧美久久婷婷综合色| 久久机这里只有精品| 国产欧美一区二区精品久导航 | 亚洲免费观看高清| 欧美日韩一卡二卡三卡| 韩国v欧美v日本v亚洲v| 国产精品久久久久久亚洲伦| 欧美三区在线视频| 国产一区在线看| 亚洲黄色尤物视频| 亚洲精品在线一区二区| 99这里只有精品| 亚洲成精国产精品女| 日韩美女一区二区三区四区| 国产精品一区二区在线观看不卡| 亚洲精品五月天| 欧美一区二区三区日韩视频| 国产91综合一区在线观看| 亚洲精品成人悠悠色影视| 91精品国产免费久久综合| 高清国产一区二区| 午夜精品一区二区三区电影天堂| 国产人伦精品一区二区| 欧美日韩综合不卡| 成人午夜在线视频| 视频一区视频二区在线观看| 欧美国产一区在线| 欧美精品在线观看播放| 丁香婷婷综合五月| 免费欧美在线视频| 亚洲欧洲精品一区二区精品久久久 | 亚洲一区二区三区中文字幕在线| 日韩欧美亚洲另类制服综合在线| 91免费观看视频| 国产99精品国产| 麻豆中文一区二区| 亚洲国产一区二区在线播放| 欧美国产视频在线| 欧美va亚洲va国产综合| 欧美日精品一区视频| 色综合视频一区二区三区高清| 国内成人精品2018免费看| 亚洲成人一区二区| 亚洲视频小说图片| 国产日韩欧美a| 久久综合九色综合欧美98| 欧美精品第1页| 欧美主播一区二区三区| 91在线视频网址| 成人久久视频在线观看| 麻豆一区二区99久久久久| 舔着乳尖日韩一区| 亚洲成国产人片在线观看| 一区二区三区日韩精品| 亚洲欧洲在线观看av| 中文字幕一区二区三区在线不卡| 久久亚洲免费视频| 久久综合色8888| 久久日韩粉嫩一区二区三区| 精品国产凹凸成av人导航| 精品日韩一区二区三区免费视频| 69堂精品视频| 91麻豆精品国产91久久久久久久久 | 欧美tickle裸体挠脚心vk| 日韩一区二区三区视频在线| 91精品国产乱码久久蜜臀| 欧美揉bbbbb揉bbbbb| 7777精品伊人久久久大香线蕉完整版| 欧美视频一区二区三区在线观看| 91电影在线观看| 欧美天堂一区二区三区| 欧美日韩精品一区二区三区| 欧美男人的天堂一二区| 欧美剧情电影在线观看完整版免费励志电影| 欧美三区在线观看| 日韩午夜精品视频| 精品奇米国产一区二区三区| 久久亚洲精精品中文字幕早川悠里| 久久久久久久久久久久电影 | 久久亚洲精品国产精品紫薇| 国产欧美日韩久久| 18成人在线观看| 一区二区三区四区中文字幕| 亚洲国产成人av网| 精品在线观看视频| 丁香六月久久综合狠狠色| 91免费视频网址| 69堂精品视频| 中文字幕av不卡| 亚洲va欧美va人人爽| 激情综合色综合久久综合| 不卡区在线中文字幕| 欧美综合一区二区| 精品精品欲导航| 国产精品久久久久久久久图文区| 亚洲一区二区在线视频| 美腿丝袜亚洲色图| 成人网男人的天堂| 欧美精品一级二级三级| 国产视频一区在线观看| 一区二区三区视频在线看| 蜜桃免费网站一区二区三区| 成人sese在线| 7777精品伊人久久久大香线蕉| 国产女人aaa级久久久级 | 中文字幕一区免费在线观看| 亚洲v精品v日韩v欧美v专区| 国产精品一区二区果冻传媒| 欧美性xxxxxx少妇| 国产日产亚洲精品系列| 日韩黄色免费网站| 成人18视频日本| 日韩欧美在线观看一区二区三区| 国产精品丝袜在线| 青青草原综合久久大伊人精品| eeuss鲁片一区二区三区| 91精品国产手机| 亚洲美女电影在线| 国产成人精品影视| 9191久久久久久久久久久| 亚洲欧美在线高清| 精品综合免费视频观看| 欧美性猛交xxxxxxxx| 国产精品国产三级国产aⅴ无密码| 麻豆精品国产传媒mv男同| 色婷婷久久久综合中文字幕 | 亚洲成人黄色影院| 97精品超碰一区二区三区| 久久久99精品久久| 日韩精品视频网站| 色综合咪咪久久| 国产精品色呦呦| 国产成人精品一区二| 精品美女在线观看| 琪琪一区二区三区| 欧美日韩国产中文| 亚洲一本大道在线| 91国产福利在线| 亚洲乱码国产乱码精品精98午夜| 成人免费视频国产在线观看| 26uuu亚洲综合色| 激情综合网激情| 精品国产精品网麻豆系列| 美国一区二区三区在线播放| 日韩一区二区在线观看视频| 香蕉影视欧美成人| 3d动漫精品啪啪1区2区免费 | 欧美大片日本大片免费观看| 日本麻豆一区二区三区视频| 911精品国产一区二区在线| 日韩成人免费在线|