eZdsp5502使用教程(二) 点亮LED
eZdsp5502使用教程(二) 点亮LED
eZdsp5502使用教程(一) 新建工程 https://www.cnblogs.com/guangnianxd/p/11886160.html
新建工程
build,通过。
点亮LED
添加头文件
#include "stdio.h"
#include "ezdsp5502.h" // ezdsp5502初始化
#include "ezdsp5502_i2cgpio.h" // GPIO定义及操作函数
void my_led_test(void)
{
// 初始化LED
// 设置I2C GPIO的方向
EZDSP5502_I2CGPIO_configLine( LED0, OUT );
EZDSP5502_I2CGPIO_configLine( LED1, OUT );
EZDSP5502_I2CGPIO_configLine( LED2, OUT );
EZDSP5502_I2CGPIO_configLine( LED3, OUT );
// 0、2号灯亮,再隔一秒1、3号灯亮
for (;;)
{
EZDSP5502_waitusec( 1000000 );
EZDSP5502_I2CGPIO_writeLine( LED0, LOW );
EZDSP5502_I2CGPIO_writeLine( LED1, HIGH );
EZDSP5502_I2CGPIO_writeLine( LED2, LOW );
EZDSP5502_I2CGPIO_writeLine( LED3, HIGH );
EZDSP5502_waitusec( 1000000 );
EZDSP5502_I2CGPIO_writeLine( LED0, HIGH );
EZDSP5502_I2CGPIO_writeLine( LED1, LOW );
EZDSP5502_I2CGPIO_writeLine( LED2, HIGH );
EZDSP5502_I2CGPIO_writeLine( LED3, LOW );
}
}
void main(void)
{
EZDSP5502_init();
my_led_test();
}
#include "stdio.h"
#include "ezdsp5502.h"
#include "ezdsp5502_i2cgpio.h"
void my_led_test(void);
/**
* main.c
*/
void main(void)
{
EZDSP5502_init();
my_led_test();
}
void my_led_test(void)
{
// 初始化LED
// 设置I2C GPIO的方向
EZDSP5502_I2CGPIO_configLine( LED0, OUT );
EZDSP5502_I2CGPIO_configLine( LED1, OUT );
EZDSP5502_I2CGPIO_configLine( LED2, OUT );
EZDSP5502_I2CGPIO_configLine( LED3, OUT );
// 0、2号灯亮,再隔一秒1、3号灯亮
for (;;)
{
EZDSP5502_waitusec( 1000000 );
EZDSP5502_I2CGPIO_writeLine( LED0, LOW );
EZDSP5502_I2CGPIO_writeLine( LED1, HIGH );
EZDSP5502_I2CGPIO_writeLine( LED2, LOW );
EZDSP5502_I2CGPIO_writeLine( LED3, HIGH );
EZDSP5502_waitusec( 1000000 );
EZDSP5502_I2CGPIO_writeLine( LED0, HIGH );
EZDSP5502_I2CGPIO_writeLine( LED1, LOW );
EZDSP5502_I2CGPIO_writeLine( LED2, HIGH );
EZDSP5502_I2CGPIO_writeLine( LED3, LOW );
}
}