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

📄 keyboard.c

📁 将模拟温度传感器与数字转换接口电路集成在一起
💻 C
字号:
/*********************************************************************************************
* File:	8led.c
* Author:	embest	
* Desc:	8-segment digit LED control functions
* History:	
*********************************************************************************************/
#include "44b.h"
#include "44blib.h"
#include "def.h"
#include "iic.h"

/*------------------------------------------------------------------------------------------*/
/*	 								global variables					 				    */
/*------------------------------------------------------------------------------------------*/
int f_nKeyPress;
int num_key;

/*------------------------------------------------------------------------------------------*/
/*	 								function declare						 				    */
/*------------------------------------------------------------------------------------------*/
void keyboard_test(void);
void keyboard_int(void);

/*********************************************************************************************
* name:		keyboard_test
* func:		test 8led
* para:		none
* ret:		none
* modify:
* comment:		
********************************************************************************************/
void keyboard_test(void)
{
	int i, j, k;
	UINT8T ucChar, t;
	
	iic_init();
	
	// initiaze the 8led-function first of ZLG7290 (more to see ZLG7290.pdf)
	// precent the invalid sign generated while keyboard-function

	// set EINT2 interrupt handler
    pISR_EINT2 = (int)keyboard_int;

	for(;;)
	{
	    f_nKeyPress = 0;
		rINTMSK = rINTMSK & (~(BIT_GLOBAL|BIT_EINT2));		// enable EINT2 int
		while(f_nKeyPress == 0);
		iic_read(0x70, 0x1, &ucChar);
		if(ucChar != 0){
			uart_printf("press key %d\n", ucChar);
			num_key=ucChar;
		}	
	}
}

/*********************************************************************************************
* name:		keyboard_int
* func:		keyboard interrupt handler
* para:		none
* ret:		none
* modify:
* comment:		
********************************************************************************************/
void keyboard_int(void)
{
	rINTMSK = rINTMSK | BIT_EINT2;							// disable EINT2 int
    rI_ISPC = BIT_EINT2;
    f_nKeyPress = 1;
}

⌨️ 快捷键说明

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