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

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

?? i2c.c

?? FreeRTOS is a portable, open source, mini Real Time Kernel - a free to download and royalty free RTO
?? C
?? 第 1 頁 / 共 2 頁
字號:
//*****************************************************************************
//
// i2c.c - Driver for Inter-IC (I2C) bus block.
//
// Copyright (c) 2005,2006 Luminary Micro, Inc.  All rights reserved.
//
// Software License Agreement
//
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
// exclusively on LMI's Stellaris Family of microcontroller products.
//
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  Any use in violation
// of the foregoing restrictions may subject the user to criminal sanctions
// under applicable laws, as well as to civil liability for the breach of the
// terms and conditions of this license.
//
// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 991 of the Stellaris Driver Library.
//
//*****************************************************************************

//*****************************************************************************
//
//! \addtogroup i2c_api
//! @{
//
//*****************************************************************************

#include "../hw_i2c.h"
#include "../hw_ints.h"
#include "../hw_memmap.h"
#include "../hw_types.h"
#include "debug.h"
#include "i2c.h"
#include "interrupt.h"
#include "sysctl.h"

//*****************************************************************************
//
//! Initializes the I2C Master block.
//!
//! \param ulBase base address of the I2C Master module
//! \param bFast set up for fast data transfers
//!
//! This function initializes operation of the I2C Master block. Upon
//! successful initialization of the I2C block, this function will have
//! set the bus speed for the master, and will have enabled the I2C Master
//! block.
//!
//! If the parameter \e bFast is \b true, then the master block will be
//! set up to transfer data at 400 kbps; otherwise, it will be set up to
//! transfer data at 100 kbps.
//!
//! The I2C clocking is dependent upon the system clock rate returned by
//! SysCtlClockGet(); if it does not return the correct system clock rate then
//! the I2C clock rate will be incorrect.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_masterinit) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CMasterInit(unsigned long ulBase, tBoolean bFast)
{
    unsigned long ulSysClk;
    unsigned long ulSCLFreq;
    unsigned long ulTPR;

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

    //
    // Must enable the device before doing anything else.
    //
    I2CMasterEnable(ulBase);

    //
    // Get the system clock speed.
    //
    ulSysClk = SysCtlClockGet();

    //
    // Get the desired SCL speed.
    //
    if(bFast == true)
    {
        ulSCLFreq = I2C_SCL_FAST;
    }
    else
    {
        ulSCLFreq = I2C_SCL_STANDARD;
    }

    //
    // Compute the clock divider that achieves the fastest speed less than or
    // equal to the desired speed.  The numerator is biases to favor a larger
    // clock divider so that the resulting clock is always less than or equal
    // to the desired clock, never greater.
    //
    ulTPR = (((ulSysClk + (2 * I2C_MASTER_TPR_SCL * ulSCLFreq) - 1) /
              (2 * I2C_MASTER_TPR_SCL * ulSCLFreq)) - 1);
    HWREG(ulBase + I2C_MASTER_O_TPR) = ulTPR;
}
#endif

//*****************************************************************************
//
//! Initializes the I2C Slave block.
//!
//! \param ulBase base address of the I2C Slave module
//! \param ucSlaveAddr 7-bit slave address
//!
//! This function initializes operation of the I2C Slave block. Upon
//! successful initialization of the I2C blocks, this function will have
//! set the slave address and have enabled the I2C Slave block.
//!
//! The parameter \e ucSlaveAddr is the value that will be compared
//! against the slave address sent by an I2C master.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_slaveinit) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CSlaveInit(unsigned long ulBase, unsigned char ucSlaveAddr)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_SLAVE_BASE);
    ASSERT(!(ucSlaveAddr & 0x80));

    //
    // Must enable the device before doing anything else.
    //
    I2CSlaveEnable(ulBase);

    //
    // Set up the slave address.
    //
    HWREG(ulBase + I2C_SLAVE_O_OAR) = ucSlaveAddr;
}
#endif

//*****************************************************************************
//
//! Enables the I2C Master block.
//!
//! \param ulBase base address of the I2C Master module
//!
//! This will enable operation of the I2C Master block.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_masterenable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CMasterEnable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Enable the master block.
    //
    HWREG(ulBase + I2C_MASTER_O_CR) |= I2C_MASTER_CR_MFE;
}
#endif

//*****************************************************************************
//
//! Enables the I2C Slave block.
//!
//! \param ulBase base address of the I2C Slave module
//!
//! This will enable operation of the I2C Slave block.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_slaveenable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CSlaveEnable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_SLAVE_BASE);

    //
    // Enable the clock to the slave block.
    //
    HWREG(ulBase - I2C_O_SLAVE + I2C_MASTER_O_CR) |= I2C_MASTER_CR_SFE;

    //
    // Enable the slave.
    //
    HWREG(ulBase + I2C_SLAVE_O_CSR) = I2C_SLAVE_CSR_DA;
}
#endif

//*****************************************************************************
//
//! Disables the I2C master block.
//!
//! \param ulBase base address of the I2C Master module
//!
//! This will disable operation of the I2C master block.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_masterdisable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CMasterDisable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Disable the master block.
    //
    HWREG(ulBase + I2C_MASTER_O_CR) &= ~(I2C_MASTER_CR_MFE);
}
#endif

//*****************************************************************************
//
//! Disables the I2C slave block.
//!
//! \param ulBase base address of the I2C Slave module
//!
//! This will disable operation of the I2C slave block.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_slavedisable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CSlaveDisable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_SLAVE_BASE);

    //
    // Disable the slave.
    //
    HWREG(ulBase + I2C_SLAVE_O_CSR) = 0;

    //
    // Disable the clock to the slave block.
    //
    HWREG(ulBase - I2C_O_SLAVE + I2C_MASTER_O_CR) &= ~(I2C_MASTER_CR_SFE);
}
#endif

//*****************************************************************************
//
//! Registers an interrupt handler for the I2C module
//!
//! \param ulBase base address of the I2C module
//! \param pfnHandler is a pointer to the function to be called when the
//! synchronous serial interface interrupt occurs.
//!
//! This sets the handler to be called when an I2C interrupt occurs.  This
//! will enable the global interrupt in the interrupt controller; specific I2C
//! interrupts must be enabled via I2CMasterIntEnable() and
//! I2CSlaveIntEnable().  If necessary, it is the interrupt handler's
//! responsibility to clear the interrupt source via I2CMasterIntClear() and
//! I2CSlaveIntClear().
//!
//! \sa IntRegister() for important information about registering interrupt
//! handlers.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_intregister) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CIntRegister(unsigned long ulBase, void (*pfnHandler)(void))
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Register the interrupt handler, returning an error if an error occurs.
    //
    IntRegister(INT_I2C, pfnHandler);

    //
    // Enable the I2C interrupt.
    //
    IntEnable(INT_I2C);
}
#endif

//*****************************************************************************
//
//! Unregisters an interrupt handler for the I2C module.
//!
//! \param ulBase base address of the I2C module
//!
//! This function will clear the handler to be called when an I2C
//! interrupt occurs.  This will also mask off the interrupt in the interrupt
//! controller so that the interrupt handler no longer is called.
//!
//! \sa IntRegister() for important information about registering interrupt
//! handlers.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_intunregister) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CIntUnregister(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Disable the interrupt.
    //
    IntDisable(INT_I2C);

    //
    // Unregister the interrupt handler.
    //
    IntUnregister(INT_I2C);
}
#endif

//*****************************************************************************
//
//! Enables the I2C Master interrupt.
//!
//! \param ulBase base address of the I2C Master module
//!
//! Enables the I2C Master interrupt source.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_masterintenable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CMasterIntEnable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Enable the master interrupt.
    //
    HWREG(ulBase + I2C_MASTER_O_IMR) = 1;
}
#endif

//*****************************************************************************
//
//! Enables the I2C Slave interrupt.
//!
//! \param ulBase base address of the I2C Slave module
//!
//! Enables the I2C Slave interrupt source.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_slaveintenable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CSlaveIntEnable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_SLAVE_BASE);

    //
    // Enable the slave interrupt.
    //
    HWREG(ulBase + I2C_SLAVE_O_IM) = 1;
}
#endif

//*****************************************************************************
//
//! Disables the I2C Master interrupt.
//!
//! \param ulBase base address of the I2C Master module
//!
//! Disables the I2C Master interrupt source.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_masterintdisable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CMasterIntDisable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Disable the master interrupt.
    //
    HWREG(ulBase + I2C_MASTER_O_IMR) = 0;
}
#endif

//*****************************************************************************
//
//! Disables the I2C Slave interrupt.
//!
//! \param ulBase base address of the I2C Slave module
//!
//! Disables the I2C Slave interrupt source.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_slaveintdisable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
I2CSlaveIntDisable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_SLAVE_BASE);

    //
    // Disable the slave interrupt.
    //
    HWREG(ulBase + I2C_SLAVE_O_IM) = 0;
}
#endif

//*****************************************************************************
//
//! Gets the current I2C Master interrupt status.
//!
//! \param ulBase base address of the I2C Master 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 Master 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.
//
//*****************************************************************************
#if defined(GROUP_masterintstatus) || defined(BUILD_ALL) || defined(DOXYGEN)
tBoolean
I2CMasterIntStatus(unsigned long ulBase, tBoolean bMasked)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == I2C_MASTER_BASE);

    //
    // Return either the interrupt status or the raw interrupt status as
    // requested.
    //
    if(bMasked)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品乱码久久久久久久久 | 美女视频一区在线观看| 精品国产三级a在线观看| 91影院在线免费观看| 久久激情五月激情| 亚洲综合色网站| 欧美国产精品一区二区| 欧美一区二视频| 91亚洲精品乱码久久久久久蜜桃 | 国产精品一区二区在线看| 亚洲精品国产a久久久久久| 精品久久五月天| 91美女在线观看| 久久精品国产亚洲a| 综合久久久久久| 日韩一区二区三区视频在线观看| 成人手机电影网| 青青草97国产精品免费观看| 欧美激情在线观看视频免费| 日韩一区二区电影| 91在线观看污| 国产精品99久久久久久久vr| 香蕉久久一区二区不卡无毒影院| 国产精品美女久久久久久| 精品久久久久久久久久久久久久久| 91福利精品视频| 99re热视频精品| 成人综合激情网| 国产不卡视频一区二区三区| 精品综合免费视频观看| 天天亚洲美女在线视频| 日韩美女啊v在线免费观看| 精品三级av在线| 欧美精三区欧美精三区| 日本精品一区二区三区高清| 不卡的av电影| 丰满放荡岳乱妇91ww| 国产精品影音先锋| 国产一区二区三区四区五区美女| 久久99蜜桃精品| 国内精品国产三级国产a久久 | 91色在线porny| 99久久精品免费| 色视频欧美一区二区三区| 91麻豆成人久久精品二区三区| 99久久久国产精品| 一本大道久久a久久综合| 91国产精品成人| 欧洲一区在线电影| 欧美欧美欧美欧美| 欧美性xxxxx极品少妇| 欧美日韩一二三| 制服视频三区第一页精品| 欧美一区二区在线看| 欧美videos中文字幕| 日韩欧美高清dvd碟片| 欧美一级视频精品观看| 精品女同一区二区| 欧美精品一区二区久久婷婷| 日韩欧美国产一区二区在线播放| 久久欧美中文字幕| 国产三级欧美三级日产三级99| 国产视频一区在线播放| 欧美精品一区二区蜜臀亚洲| 精品国一区二区三区| 欧美电视剧免费观看| 日韩精品一区二区三区视频播放| 2021国产精品久久精品| 欧美激情资源网| 亚洲精品国产无套在线观| 午夜一区二区三区在线观看| 美女久久久精品| 成人午夜视频福利| 色一情一伦一子一伦一区| 欧美丰满少妇xxxxx高潮对白| 色域天天综合网| 欧美羞羞免费网站| 在线播放91灌醉迷j高跟美女| 在线观看91精品国产麻豆| 亚洲精品一区二区三区香蕉| 欧美精品一区二区三区蜜桃 | 亚洲综合成人网| 日韩福利视频网| 国产成人免费视频一区| 欧美日韩在线播放| 91精品欧美福利在线观看| 久久综合丝袜日本网| 国产精品美女www爽爽爽| 亚洲第一电影网| 国产91精品入口| 色久综合一二码| 91精品国产综合久久久久| 久久久噜噜噜久久中文字幕色伊伊| 国产精品网站在线观看| 蜜桃在线一区二区三区| 色综合久久久网| 26uuu国产电影一区二区| 国产精品无圣光一区二区| 一区二区三区影院| 久久精品国产久精国产| 国产91高潮流白浆在线麻豆 | 91精品国产aⅴ一区二区| 久久亚洲私人国产精品va媚药| 亚洲视频在线一区观看| 日韩电影在线免费| 大胆欧美人体老妇| 欧美一区三区二区| 亚洲香肠在线观看| a4yy欧美一区二区三区| 久久日韩粉嫩一区二区三区| 午夜精品福利一区二区三区蜜桃| 国产成人av一区二区三区在线观看| 欧美日韩视频在线一区二区| 国产精品高潮呻吟久久| 狠狠色2019综合网| 欧美日韩国产首页| 中文子幕无线码一区tr| 日韩福利电影在线观看| 99久久精品国产一区| 国产亚洲污的网站| 一片黄亚洲嫩模| 成人免费三级在线| 日韩欧美亚洲另类制服综合在线 | 欧美日韩午夜在线视频| 精品电影一区二区三区| 亚洲综合色网站| 色系网站成人免费| 亚洲人成伊人成综合网小说| 成人性生交大片免费看中文网站| 欧美精品一区二区在线观看| 韩国在线一区二区| 精品免费国产一区二区三区四区| 日韩av网站免费在线| 91麻豆精品国产91久久久久久久久 | 97精品久久久久中文字幕| 国产亚洲精品aa| 国产精品一区在线观看你懂的| 2023国产精品自拍| 国产乱理伦片在线观看夜一区| 精品成人一区二区三区四区| 久久99国产精品免费| 久久久美女毛片| 成人久久18免费网站麻豆 | 成人高清av在线| 亚洲欧美精品午睡沙发| 日本韩国一区二区三区| 亚洲va欧美va人人爽| 欧美男生操女生| 麻豆精品一区二区av白丝在线| 欧美岛国在线观看| 国产.欧美.日韩| 最新国产の精品合集bt伙计| 色婷婷精品久久二区二区蜜臂av | 国产一区在线观看麻豆| 国产欧美日韩综合| 91天堂素人约啪| 午夜欧美电影在线观看| 日韩欧美国产系列| 国产成人亚洲综合a∨婷婷| 中文字幕一区二区5566日韩| 91蜜桃免费观看视频| 亚洲韩国一区二区三区| 欧美一级日韩不卡播放免费| 国产福利91精品一区二区三区| 国产精品二三区| 欧美色网一区二区| 久久成人综合网| 91精品福利在线| 蜜乳av一区二区三区| 中文字幕不卡在线| 欧美少妇xxx| 黄色小说综合网站| 一区二区三区四区在线播放| 日韩无一区二区| 99re亚洲国产精品| 男男视频亚洲欧美| 国产精品久久久久久妇女6080| 欧美日韩高清一区二区三区| 国产在线日韩欧美| 一区二区三区中文字幕在线观看| 欧美一卡2卡三卡4卡5免费| 亚洲成在线观看| 在线亚洲人成电影网站色www| 亚洲欧美日韩精品久久久久| 亚洲黄色片在线观看| 成人综合婷婷国产精品久久| 91丨porny丨首页| 欧美日韩一区精品| 国产精品麻豆视频| 日本午夜一区二区| 在线免费视频一区二区| 国产欧美中文在线| 青青草97国产精品免费观看 | 亚洲日本电影在线| 久久免费的精品国产v∧| 久久麻豆一区二区| 日韩一区欧美二区| 国产乱色国产精品免费视频| 狠狠色狠狠色综合系列| 日韩欧美亚洲一区二区|