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

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

?? i2c.c

?? 基于TI公司Cortex-M3的uart超級通信開發(fā)
?? C
?? 第 1 頁 / 共 3 頁
字號:
//*****************************************************************************
//
// i2c.c - Driver for Inter-IC (I2C) bus block.
//
// Copyright (c) 2005-2009 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 microcontroller products.
// 
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  You may not combine
// this software with "viral" open-source software in order to form a larger
// program.  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 5228 of the Stellaris Peripheral Driver Library.
//
//*****************************************************************************

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

#include "inc/hw_i2c.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_sysctl.h"
#include "inc/hw_types.h"
#include "driverlib/debug.h"
#include "driverlib/i2c.h"
#include "driverlib/interrupt.h"

//*****************************************************************************
//
//! Initializes the I2C Master block.
//!
//! \param ulBase is the base address of the I2C Master module.
//! \param ulI2CClk is the rate of the clock supplied to the I2C 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 peripheral clock will be the same as the processor clock.  This will be
//! the value returned by SysCtlClockGet(), or it can be explicitly hard coded
//! if it is constant and known (to save the code/execution overhead of a call
//! to SysCtlClockGet()).
//!
//! This function replaces the original I2CMasterInit() API and performs the
//! same actions.  A macro is provided in <tt>i2c.h</tt> to map the original
//! API to this API.
//!
//! \return None.
//
//*****************************************************************************
void
I2CMasterInitExpClk(unsigned long ulBase, unsigned long ulI2CClk,
                    tBoolean bFast)
{
    unsigned long ulSCLFreq;
    unsigned long ulTPR;

    //
    // Check the arguments.
    //
    ASSERT((ulBase == I2C0_MASTER_BASE) || (ulBase == I2C1_MASTER_BASE));

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

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

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

//*****************************************************************************
//
//! Initializes the I2C Slave block.
//!
//! \param ulBase is the 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.
//
//*****************************************************************************
void
I2CSlaveInit(unsigned long ulBase, unsigned char ucSlaveAddr)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == I2C0_SLAVE_BASE) || (ulBase == I2C1_SLAVE_BASE));
    ASSERT(!(ucSlaveAddr & 0x80));

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

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

//*****************************************************************************
//
//! Enables the I2C Master block.
//!
//! \param ulBase is the base address of the I2C Master module.
//!
//! This will enable operation of the I2C Master block.
//!
//! \return None.
//
//*****************************************************************************
void
I2CMasterEnable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == I2C0_MASTER_BASE) || (ulBase == I2C1_MASTER_BASE));

    //
    // Enable the master block.
    //
    HWREG(ulBase + I2C_O_MCR) |= I2C_MCR_MFE;
}

//*****************************************************************************
//
//! Enables the I2C Slave block.
//!
//! \param ulBase is the base address of the I2C Slave module.
//!
//! This will enable operation of the I2C Slave block.
//!
//! \return None.
//
//*****************************************************************************
void
I2CSlaveEnable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == I2C0_SLAVE_BASE) || (ulBase == I2C1_SLAVE_BASE));

    //
    // Enable the clock to the slave block.
    //
    HWREG(ulBase - I2C0_SLAVE_BASE + I2C0_MASTER_BASE + I2C_O_MCR) |=
        I2C_MCR_SFE;

    //
    // Enable the slave.
    //
    HWREG(ulBase + I2C_O_SCSR) = I2C_SCSR_DA;
}

//*****************************************************************************
//
//! Disables the I2C master block.
//!
//! \param ulBase is the base address of the I2C Master module.
//!
//! This will disable operation of the I2C master block.
//!
//! \return None.
//
//*****************************************************************************
void
I2CMasterDisable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == I2C0_MASTER_BASE) || (ulBase == I2C1_MASTER_BASE));

    //
    // Disable the master block.
    //
    HWREG(ulBase + I2C_O_MCR) &= ~(I2C_MCR_MFE);
}

//*****************************************************************************
//
//! Disables the I2C slave block.
//!
//! \param ulBase is the base address of the I2C Slave module.
//!
//! This will disable operation of the I2C slave block.
//!
//! \return None.
//
//*****************************************************************************
void
I2CSlaveDisable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == I2C0_SLAVE_BASE) || (ulBase == I2C1_SLAVE_BASE));

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

    //
    // Disable the clock to the slave block.
    //
    HWREG(ulBase - I2C0_SLAVE_BASE + I2C0_MASTER_BASE + I2C_O_MCR) &=
        ~(I2C_MCR_SFE);
}

//*****************************************************************************
//
//! Registers an interrupt handler for the I2C module.
//!
//! \param ulBase is the base address of the I2C Master module.
//! \param pfnHandler is a pointer to the function to be called when the
//! I2C 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.
//
//*****************************************************************************
void
I2CIntRegister(unsigned long ulBase, void (*pfnHandler)(void))
{
    unsigned long ulInt;

    //
    // Check the arguments.
    //
    ASSERT((ulBase == I2C0_MASTER_BASE) || (ulBase == I2C1_MASTER_BASE));

    //
    // Determine the interrupt number based on the I2C port.
    //
    ulInt = (ulBase == I2C0_MASTER_BASE) ? INT_I2C0 : INT_I2C1;

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

    //
    // Enable the I2C interrupt.
    //
    IntEnable(ulInt);
}

//*****************************************************************************
//
//! Unregisters an interrupt handler for the I2C module.
//!
//! \param ulBase is the base address of the I2C Master 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.
//
//*****************************************************************************
void
I2CIntUnregister(unsigned long ulBase)
{
    unsigned long ulInt;

    //
    // Check the arguments.
    //
    ASSERT((ulBase == I2C0_MASTER_BASE) || (ulBase == I2C1_MASTER_BASE));

    //
    // Determine the interrupt number based on the I2C port.
    //
    ulInt = (ulBase == I2C0_MASTER_BASE) ? INT_I2C0 : INT_I2C1;

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

    //
    // Unregister the interrupt handler.
    //
    IntUnregister(ulInt);
}

//*****************************************************************************
//
//! Enables the I2C Master interrupt.
//!
//! \param ulBase is the base address of the I2C Master module.
//!
//! Enables the I2C Master interrupt source.
//!
//! \return None.
//
//*****************************************************************************
void
I2CMasterIntEnable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == I2C0_MASTER_BASE) || (ulBase == I2C1_MASTER_BASE));

    //
    // Enable the master interrupt.
    //

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线视频亚洲一区| 国产色综合一区| 久久日一线二线三线suv| 综合激情成人伊人| 久久国产尿小便嘘嘘尿| 色偷偷成人一区二区三区91| 欧美成人精品高清在线播放| 亚洲综合视频网| 91社区在线播放| 26uuu亚洲综合色| 天天色综合成人网| 日本国产一区二区| 中文字幕亚洲在| 国产激情精品久久久第一区二区| 欧美一区欧美二区| 亚洲一区在线视频观看| 99久久久久免费精品国产| 欧美日韩亚洲综合| 亚洲一区二区三区在线播放| 99久久精品免费精品国产| 国产欧美一区二区三区鸳鸯浴| 蜜臀av性久久久久av蜜臀妖精| 欧美三级欧美一级| 亚洲另类中文字| 91在线免费看| 亚洲免费色视频| 一本一道久久a久久精品综合蜜臀| 欧美国产精品久久| 国产福利一区二区三区视频| 久久这里只有精品6| 极品美女销魂一区二区三区| 日韩三区在线观看| 日本成人在线一区| 精品国产免费一区二区三区香蕉| 日本欧洲一区二区| 日韩欧美一二三| 久久99精品国产91久久来源| 欧美精品乱码久久久久久| 亚洲成在人线免费| 欧美高清dvd| 麻豆免费精品视频| 久久久三级国产网站| 激情文学综合网| 国产三级精品三级| 99在线热播精品免费| 亚洲欧美日韩系列| 在线播放日韩导航| 麻豆91免费观看| 日本一区二区三区高清不卡| 粗大黑人巨茎大战欧美成人| 亚洲视频在线一区| 精品1区2区3区| 另类小说一区二区三区| 久久久国际精品| 91蜜桃网址入口| 亚洲二区在线观看| 欧美mv和日韩mv的网站| 国产宾馆实践打屁股91| 综合自拍亚洲综合图不卡区| 欧美日韩国产精品自在自线| 免费人成黄页网站在线一区二区| 26uuuu精品一区二区| 91片在线免费观看| 蜜臀av性久久久久蜜臀aⅴ| 国产精品人成在线观看免费| 欧美性大战久久久久久久蜜臀| 七七婷婷婷婷精品国产| 日本一区二区在线不卡| 欧美日韩一级片在线观看| 国产成人精品免费| 五月天精品一区二区三区| 久久精品欧美一区二区三区不卡 | 欧美日韩在线播放一区| 美女网站视频久久| 亚洲码国产岛国毛片在线| 这里只有精品99re| 99久久精品国产一区| 青青草视频一区| 自拍偷拍亚洲欧美日韩| 精品国产一区二区三区四区四| 国产99久久久久| 日本va欧美va瓶| 亚洲视频在线观看三级| 精品日韩一区二区三区| 在线免费观看日韩欧美| 高清久久久久久| 久久精品国产免费| 午夜欧美电影在线观看| 中文字幕一区日韩精品欧美| 久久婷婷久久一区二区三区| 欧美日韩免费视频| 色偷偷一区二区三区| 国产69精品久久777的优势| 美女www一区二区| 亚洲3atv精品一区二区三区| 中日韩av电影| 国产午夜亚洲精品不卡| 日韩精品一区二区三区在线播放 | 日本一区二区综合亚洲| 欧美一区二区免费| 欧美日韩国产免费一区二区| 在线观看三级视频欧美| 99久久99久久久精品齐齐| 国产成人一区在线| 国产成人亚洲综合a∨猫咪| 激情久久五月天| 日韩av网站在线观看| 亚洲第一二三四区| 午夜久久久久久久久久一区二区| 亚洲综合精品久久| 亚洲免费观看高清完整版在线观看熊| 欧美极品xxx| 国产欧美日韩综合精品一区二区| 欧美成人猛片aaaaaaa| 欧美刺激脚交jootjob| 91精品午夜视频| 欧美一区二区视频在线观看 | av不卡免费电影| 99精品国产91久久久久久| 成人福利视频网站| av在线播放成人| 一本大道av一区二区在线播放| 91社区在线播放| 欧美日韩亚洲国产综合| 7777精品伊人久久久大香线蕉 | 在线观看亚洲精品视频| 在线观看网站黄不卡| 91精品国产综合久久久久久漫画| 日韩欧美在线网站| 久久久久99精品国产片| 国产精品家庭影院| 一区二区三区鲁丝不卡| 日日夜夜免费精品视频| 精品一二三四区| 不卡电影免费在线播放一区| 99免费精品视频| 制服丝袜国产精品| 日本一区二区三级电影在线观看| 自拍偷在线精品自拍偷无码专区| 亚洲综合999| 美国三级日本三级久久99| 高潮精品一区videoshd| 在线亚洲高清视频| 欧美成人国产一区二区| 中文字幕一区av| 日韩精品电影一区亚洲| 国产91色综合久久免费分享| 欧美在线一区二区| 久久精品亚洲精品国产欧美| 亚洲影院免费观看| 久久99精品国产.久久久久| 99re视频这里只有精品| 欧美精品久久一区二区三区| 中文幕一区二区三区久久蜜桃| 一区二区三区高清不卡| 精品一区二区精品| 91久久香蕉国产日韩欧美9色| 欧美一区二区三区视频免费播放 | 久久一日本道色综合| 中文字幕中文字幕一区二区| 爽好多水快深点欧美视频| 成人妖精视频yjsp地址| 欧美一区二区三区人| 亚洲人一二三区| 国产一区欧美日韩| 欧美美女视频在线观看| 一区在线播放视频| 久久超碰97人人做人人爱| 色综合久久久久| 欧美国产日本视频| 精品一区免费av| 欧美日韩精品三区| 中文字幕欧美一| 成人激情文学综合网| 精品免费一区二区三区| 亚洲国产精品麻豆| 日本精品免费观看高清观看| 国产精品网站在线观看| 另类小说欧美激情| 欧美乱妇15p| 一区二区三区日韩在线观看| 成人污视频在线观看| 久久九九99视频| 天天爽夜夜爽夜夜爽精品视频| 色婷婷综合久久久中文一区二区 | 日韩电影在线一区| 欧美在线不卡视频| 亚洲欧洲综合另类| 白白色亚洲国产精品| 2021国产精品久久精品| 美女在线视频一区| 日韩久久精品一区| 蜜桃av噜噜一区二区三区小说| 欧美疯狂做受xxxx富婆| 亚洲成人av免费| 欧美区视频在线观看| 香蕉成人啪国产精品视频综合网| 欧美亚洲国产一卡| 无码av免费一区二区三区试看| 欧美日韩一区高清|