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

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

?? i2c.c

?? KEIL驅(qū)動(dòng) 各方面各 你的看法女士的煩惱 方看到你
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
//*****************************************************************************
//
// i2c.c - Driver for Inter-IC (I2C) bus block.
//
// Copyright (c) 2005-2008 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 3223 of the Stellaris Peripheral 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 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.
    //
    HWREG(ulBase + I2C_O_MIMR) = 1;
}

//*****************************************************************************
//
//! Enables the I2C Slave interrupt.
//!
//! \param ulBase is the base address of the I2C Slave module.
//!
//! Enables the I2C Slave interrupt source.
//!
//! \return None.
//
//*****************************************************************************
void
I2CSlaveIntEnable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == I2C0_SLAVE_BASE) || (ulBase == I2C1_SLAVE_BASE));

    //
    // Enable the slave interrupt.
    //
    HWREG(ulBase + I2C_O_SIMR) = 1;
}

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

    //
    // Disable the master interrupt.
    //
    HWREG(ulBase + I2C_O_MIMR) = 0;
}

//*****************************************************************************
//
//! Disables the I2C Slave interrupt.
//!
//! \param ulBase is the base address of the I2C Slave module.
//!
//! Disables the I2C Slave interrupt source.
//!
//! \return None.
//
//*****************************************************************************
void
I2CSlaveIntDisable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == I2C0_SLAVE_BASE) || (ulBase == I2C1_SLAVE_BASE));

    //
    // Disable the slave interrupt.
    //
    HWREG(ulBase + I2C_O_SIMR) = 0;
}

//*****************************************************************************
//
//! Gets the current I2C Master interrupt status.
//!
//! \param ulBase is the 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.
//
//*****************************************************************************
tBoolean
I2CMasterIntStatus(unsigned long ulBase, tBoolean bMasked)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == I2C0_MASTER_BASE) || (ulBase == I2C1_MASTER_BASE));

    //
    // Return either the interrupt status or the raw interrupt status as
    // requested.
    //

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本高清无吗v一区| 欧美日韩aaaaa| 91国偷自产一区二区使用方法| 专区另类欧美日韩| 日韩免费看的电影| 91年精品国产| 国产综合久久久久久鬼色| 亚洲自拍都市欧美小说| 国产欧美日韩在线观看| 欧美精品在线一区二区三区| 成人国产精品免费| 国产一区二区三区高清播放| 日日摸夜夜添夜夜添国产精品| 中文字幕亚洲区| 日韩欧美国产一区二区三区 | 亚洲午夜av在线| 国产精品国产三级国产普通话99 | 91超碰这里只有精品国产| 国产iv一区二区三区| 久久99久久99| 视频精品一区二区| 一区二区三区免费网站| 国产精品色哟哟| 久久婷婷一区二区三区| 欧美电影免费观看高清完整版在线 | 国内外成人在线视频| 午夜免费欧美电影| 一区二区三区中文字幕精品精品 | 91精品国产91久久综合桃花| 欧美综合亚洲图片综合区| 99在线精品一区二区三区| 韩国精品免费视频| 国内精品第一页| 久久国产尿小便嘘嘘尿| 日本中文字幕一区二区有限公司| 午夜精品久久久久久久久久久| 夜夜嗨av一区二区三区网页| 国产成a人无v码亚洲福利| 免费在线一区观看| 日韩精品免费专区| 日本不卡一区二区三区高清视频| 天天做天天摸天天爽国产一区| 午夜精品福利一区二区三区av| 亚洲国产精品久久人人爱蜜臀| 亚洲小说欧美激情另类| 五月激情六月综合| 日本午夜精品一区二区三区电影| 日韩中文字幕不卡| 麻豆精品视频在线观看视频| 久久国产精品一区二区| 经典一区二区三区| 国产美女视频一区| 成人黄色免费短视频| 成人a免费在线看| 色婷婷精品大在线视频| 欧美亚洲日本一区| 9191国产精品| 久久综合狠狠综合久久综合88 | 激情国产一区二区| 精品一区二区三区的国产在线播放| 激情丁香综合五月| 国产成a人无v码亚洲福利| www.激情成人| 欧美综合天天夜夜久久| 日韩午夜av一区| 欧美国产日韩一二三区| 亚洲欧美日韩国产中文在线| 日日夜夜一区二区| 国产一区二区三区视频在线播放| 成人免费福利片| 欧美日韩一区在线观看| 日韩免费视频一区| 亚洲欧洲日产国产综合网| 香蕉久久夜色精品国产使用方法 | 国产精品午夜在线观看| 亚洲日本va午夜在线电影| 午夜久久久影院| 国产精品一二三在| 在线观看日产精品| 2017欧美狠狠色| 一区二区三区蜜桃| 紧缚捆绑精品一区二区| 色琪琪一区二区三区亚洲区| 欧美一卡二卡三卡| ●精品国产综合乱码久久久久| 水蜜桃久久夜色精品一区的特点| 国产精一区二区三区| 欧美亚洲国产一区在线观看网站| 久久亚洲免费视频| 亚洲精品ww久久久久久p站| 麻豆精品一区二区综合av| 99热国产精品| 精品久久人人做人人爱| 亚洲综合色网站| 国产成人自拍高清视频在线免费播放| 色婷婷亚洲综合| 久久久久久久久伊人| 午夜视频一区二区| 91网页版在线| 久久精品无码一区二区三区| 日韩和的一区二区| 成人av免费观看| 欧美xxx久久| 亚洲一区二区三区四区在线| 成人av网站免费| 国产婷婷一区二区| 秋霞电影一区二区| 欧美日韩精品是欧美日韩精品| 亚洲女同ⅹxx女同tv| 亚洲第一久久影院| 激情综合色丁香一区二区| 色综合av在线| 亚洲激情六月丁香| 91在线播放网址| 成人欧美一区二区三区小说| 黄色日韩网站视频| 精品sm捆绑视频| 国内精品嫩模私拍在线| 欧美酷刑日本凌虐凌虐| 国产一区二区三区不卡在线观看 | 亚洲成av人片一区二区梦乃| gogogo免费视频观看亚洲一| 2023国产精品视频| 蜜乳av一区二区三区| 欧美群妇大交群中文字幕| 亚洲激情在线播放| 一本色道久久综合亚洲精品按摩| 亚洲国产电影在线观看| 国产一区二区按摩在线观看| 精品日韩99亚洲| 麻豆精品视频在线观看| 日韩亚洲电影在线| 美国欧美日韩国产在线播放| 欧美日韩综合一区| 亚洲国产精品嫩草影院| 欧美日韩不卡一区二区| 婷婷一区二区三区| 日韩一区二区视频| 美女国产一区二区三区| 欧美成人a∨高清免费观看| 狂野欧美性猛交blacked| 欧美电视剧在线看免费| 久久成人免费电影| 久久综合国产精品| 国产精品一二二区| 国产精品久久久久久一区二区三区| 成人一区二区三区| 国产精品久久三| 色偷偷久久一区二区三区| 又紧又大又爽精品一区二区| 精品视频一区二区不卡| 免费看日韩精品| 精品国产一区二区三区不卡| 国产在线日韩欧美| 国产精品传媒入口麻豆| 91小视频在线| 亚洲国产成人精品视频| 欧美一区二区在线免费播放| 久久电影网站中文字幕| 国产偷国产偷精品高清尤物| 97精品超碰一区二区三区| 一区二区三区高清在线| 欧美日韩精品一区二区三区蜜桃| 蜜臀av一区二区在线观看 | 亚洲国产精品麻豆| 日韩视频一区二区三区| 狠狠色狠狠色综合系列| 国产精品女同互慰在线看| 欧美自拍丝袜亚洲| 捆绑调教一区二区三区| 日本一区二区久久| 欧美特级限制片免费在线观看| 美女视频黄频大全不卡视频在线播放| 日本一区二区三区在线观看| 欧美在线免费播放| 国产真实精品久久二三区| 亚洲欧美国产三级| 欧美一级国产精品| 99久久久久久99| 蜜桃av一区二区| 亚洲美女电影在线| 2021国产精品久久精品| 在线观看日韩国产| 国产91丝袜在线播放九色| 亚洲永久免费视频| 国产欧美一区二区在线| 欧美三级中文字幕在线观看| 国产成人自拍网| 日韩精品色哟哟| 亚洲精品视频免费观看| 精品国产一区二区三区不卡| 欧美在线免费播放| 丁香激情综合五月| 日韩精品久久久久久| 国产精品乱码久久久久久| 日韩一区二区三区四区| 色呦呦一区二区三区| 国产精一品亚洲二区在线视频| 天堂一区二区在线| 综合网在线视频|