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

📄 keypad_test.c

📁 s3c6400 ADS下官方测试程序
💻 C
字号:
/**************************************************************************************
* 
*	Project Name : S3C6400 Validation
*
*	Copyright 2006 by Samsung Electronics, Inc.
*	All rights reserved.
*
*	Project Description :
*		This software is only for validating functions of the S3C6400.
*		Anybody can use this software without our permission.
*  
*--------------------------------------------------------------------------------------
* 
*	File Name : keypad_test.c
*  
*	File Description : This file implements the API functons for Keypad  test.
*
*	Author : Woojin.Kim
*	Dept. : AP Development Team
*	Created Date : 2007/01/22
*	Version : 0.1 
* 
*	History
*	- Created(Woojin.Kim 2007/01/22)
*  
**************************************************************************************/
/* Include Files */

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#include "keypad.h"
#include "def.h"
#include "option.h"
#include "library.h"
#include "sfr6400.h"
#include "system.h"
#include "sysc.h"
#include "intc.h"

void KEYPAD_Test(void);
void KEYPADtest(void);

const testFuncMenu g_aKEYPADTestFunc[] =
{	
	KEYPADtest,				"KEYPAD test",
	0,0
};


void KEYPAD_Test(void)
{
	u32 uCountFunc=0;
	s32 iSel=0;




	
	while(1)
	{
	printf("\n\n================== KEYPAD Function Test =====================\n\n");
	
		for (uCountFunc=0; (u32)(g_aKEYPADTestFunc[uCountFunc].desc)!=0; uCountFunc++)
			printf("%2d: %s\n", uCountFunc, g_aKEYPADTestFunc[uCountFunc].desc);

		printf("\nSelect the function to test : ");
		iSel =GetIntNum();
		printf("\n");
		if(iSel == -1) 
			break;

		if (iSel>=0 && iSel<(sizeof(g_aKEYPADTestFunc)/8-1))
			(g_aKEYPADTestFunc[iSel].func) ();
	}
}	


//////////
// Function Name : KEYPADtest
// Function Description : This function test KEYPAD
// Input : NONE
// Output : NONE
// Version : v0.1

void KEYPADtest(void)
{

	u32 uIntType;
	u32 uFilterClk;
	u32 uDF;

	uIntType = 1;
	printf("\nInput the KeyPad Interrupt Type : ");
	printf("\n1 : Falling Edge[D],    2 : Rising Edge,    3 : Both Edge \n");
	uIntType = GetIntNum(); 
	if( (uIntType<1) || (uIntType>3) )
		uIntType = 1;	//Default Falling Edge Type

	KEYPAD_SelectINT(uIntType);
	
	uFilterClk = 0;
	printf("\nInput the KeyPad Filter source Clock : ");
	printf("\n0 : RTC Clock[D],     1 : OSCIN Clock\n");
	uFilterClk = GetIntNum(); 
	if( uFilterClk>1 )
		uFilterClk = 0;	//Default RTC Clock

	uDF = 0;
	printf("\nEnable debouncing filter : ");
	printf("\n0 : Disable,     1 : Enable[D]\n");
	uDF = GetIntNum(); 
	if( uDF>1 )
		uDF = 1;	//Default Enable debouncing filter
	

	KEYPAD_EnableDFFC(uDF,uFilterClk);

	if(uFilterClk == 0)
		KEYPAD_FC(0x1);		//32KHz, 62.5us , FCLK = FLT_CLK/(KEYIFFC +1)
	else
		KEYPAD_FC((FIN*62.5/1000000)-1);	//FIN, 62.5us
		
	KEYPAD_Init();
//	KEYPAD_Init2();			// MMC/XEINT GPIO connected KEYPAD

	KEYPAD_COL(0,0);

	KEYPAD_STSCLR(0xff,0xff);

	INTC_SetVectAddr(NUM_KEYPAD,Isr_KEYPAD);
	INTC_Enable(NUM_KEYPAD);

	printf("\nPress Any KeyPad .......\n");
	
	while(!UART_GetKey())
	{

	}
	INTC_Disable(NUM_KEYPAD);
}




⌨️ 快捷键说明

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