⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 周立功公司的EasyARM1138资料
💻 C
字号:
/******************************************************************************************
    LM3S系列硬件I2C主模块例程:先突发发送再突发接收多字节的数据
******************************************************************************************/


// 包含头文件

#include "HardI2C.h"
#include "hw_memmap.h"
#include "hw_types.h"
#include "hw_ints.h"
#include "hw_i2c.h"
#include "sysctl.h"
#include "gpio.h"
#include "i2c.h"
#include "UART_GetPut.H"
#include "stdio.h"
#include "interrupt.h"

//  将较长的标识符定义成较短的形式
#define  SysCtlPeriEnable       SysCtlPeripheralEnable
#define  SysCtlPeriDisable      SysCtlPeripheralDisable
#define  GPIOPinTypeIn          GPIOPinTypeGPIOInput
#define  GPIOPinTypeOut         GPIOPinTypeGPIOOutput
#define  GPIOPinTypeOD          GPIOPinTypeGPIOOutputOD


//  定义KEY
#define  KEY_PERIPH             SYSCTL_PERIPH_GPIOG
#define  KEY_PORT               GPIO_PORTG_BASE
#define  KEY_PIN                GPIO_PIN_5


//  防止JTAG失效
void  JTAG_Wait(void)
{
    SysCtlPeriEnable(KEY_PERIPH);                               //  使能KEY所在的GPIO端口
    GPIOPinTypeIn(KEY_PORT , KEY_PIN);                          //  设置KEY所在管脚为输入

    if ( GPIOPinRead(KEY_PORT , KEY_PIN)  ==  0x00 )            //  如果复位时按下KEY,则进入
    {
        for (;;);                                               //  死循环,以等待JTAG连接
    }

    SysCtlPeriDisable(KEY_PERIPH);                              //  禁止KEY所在的GPIO端口
}


// 延时
void Delay(unsigned long t)
{
    while ( --t != 0 );
}


int main()
{   
    JTAG_Wait();                                                  //  防止JTAG失效,重要!
    Delay(10000);
    UART_GetPutInit();
    I2CM_Init();
    for (;;)
    {
        TmpDisp();
        Delay(500000L);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -