led_test.c
来自「Embest Blackfin533平台测试源代码」· C语言 代码 · 共 84 行
C
84 行
/********************************************************************************************/
/* File name: led.c */
/* Software: Blackfin DSP Debug Tools */
/* Hardware: Embest EDUKIT-III */
/* purpose: light and close the led 1,2 */
/* modify: */
/* command: */
/********************************************************************************************/
#include "cdefBF533.h"
/********************************************************************************************/
/* function declare */
/********************************************************************************************/
void delay(int time);
void led_init();
void led_allon();
void led_alloff();
/********************************************************************************************/
/* name: delay() */
/* func: functiong of delay */
/* para: none */
/* ret : none */
/* modify: */
/* command: */
/********************************************************************************************/
//void delay(int time)
//{
// int i, j;
// for(i=0; i<time; i++)
// for(j=0; j<5000; j++);
//}
/********************************************************************************************/
/* name: led_init() */
/* func: initialize the LED */
/* para: none */
/* ret : none */
/* modify: */
/* command: */
/********************************************************************************************/
void led_init()
{
__asm(
"R0 = 0x32;\n"
"SYSCFG = R0;\n"
);
*pFIO_DIR = 0x0180; //Direction setiing
*pFIO_INEN = 0x0400; //Enable Button Interruption >PF9
*pFIO_MASKA_D = 0x0400;
*pFIO_EDGE = 0x0400; //Setting PFA interrupt
}
/********************************************************************************************/
/* name: led_allon() */
/* func: light two LED */
/* ret : none */
/* modify: */
/* command: */
/********************************************************************************************/
void led_allon()
{
int i=0;
*pFIO_FLAG_D &= 0xfe7f;
while(i<0xffffff)
i++;
}
/********************************************************************************************/
/* name: led_allof() */
/* func: close two LED */
/* para: none */
/* ret : none */
/* modify: */
/* command: */
/********************************************************************************************/
void led_alloff()
{
*pFIO_FLAG_D |= 0x0180;
int i=0;
while(i<0xffffff)
i++;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?