led_test.c

来自「COLDFIRE 5282SC的文件」· C语言 代码 · 共 43 行

C
43
字号
/*
 * File:		led_test.c
 * Purpose:		Test the 4 USER LEDs on the M5282EVB
 *
 * Notes:		
 */

#include "m5282evb.h"
#include "fat.h"
 
/********************************************************************/
void
led_test(void)
{
	uint32 i,j;

	
	RESULTS |= LED_TEST;
	
	/* Set DTOUT0,1,2,3 to act as GPIO */
	MCF5282_GPIO_PTCPAR = 0x0;
	MCF5282_GPIO_PTDPAR = 0x0;
	
	/* Set Data Direction of DTOUT0,1,2,3 to Output */
	MCF5282_GPIO_DDRTC = 0x0F;
	MCF5282_GPIO_DDRTD = 0x0F;

	for (i = 0; i < 4; i++)
	{
		/* Write 0 to turn LEDs on */
		MCF5282_GPIO_PORTTD = 0x0A;
		MCF5282_GPIO_PORTTC = 0x0A;
		for (j = 0; j < 4000000; j++);
		
		/* Write 1 to turn LEDs off */
		MCF5282_GPIO_PORTTD = 0x0F;
		MCF5282_GPIO_PORTTC = 0x0F;
		for (j = 0; j < 5000000; j++);
	}

}
/********************************************************************/

⌨️ 快捷键说明

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