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

📄 main.c

📁 一个基于ARM平台的触摸屏程序。
💻 C
字号:
#include "key.h" 
#include "system.h"
#include "LCD.h"
#include "serial.h"
#include "timer.h"

	int VRAM_column;
	int VRAM_page;	
	volatile char key_up_flag;	/* 	1 - key release
									0 - key not release
								 */
	volatile unsigned int x1, x2, y1, y2;
	pen_pos_t	pen_pos;		/* the touch screen points corresponding 
									to the reference display points. 		*/
	MATRIX		CAL_MAX;		/* the calibration matrix computed 
									for the set of points being provided. 	*/
	POINT		TRUE_POINT;		/* the calculated (true) display point. 	*/
	extern volatile int gb_count;
	extern unsigned char buff[MAIN_LCD_WIDTH*MAIN_LCD_HEIGHT*3];

void demo()
{

	int i,j, cnt;
	char cNumberCount;
	unsigned int  sub_x, sub_y;

	printf("start\n");

	LCD_Initial();
	memset(buff, 0xff, MAIN_LCD_WIDTH*MAIN_LCD_HEIGHT*3);
	seDrawRect(0, 0, LCD_WIDTH-1, LCD_HEIGHT-1, buff);
		
	x1 = x2 = y1 = y2 = kbNULL;
	key_up_flag = 1;
	init_tch_screen();
	i = scr_calibrate();
	if (i == OK)
		printf("calibrate ok\n");
	else
		printf("calibrate fail\n");
	gb_count = 0;
	pen_pos.x = pen_pos.y = NO_PEN_PRESS;
	while(1)
	{
		//vDelay(100);
		for (i=0; i<100; i++);
		if (pen_pos.x != NO_PEN_PRESS)
		{
			getDisplayPoint(&TRUE_POINT, &pen_pos, &CAL_MAX);
			printf("lcd position: x=%d, y=%d; \n", TRUE_POINT.x, TRUE_POINT.y);
			memset(buff, 0xff, MAIN_LCD_WIDTH*MAIN_LCD_HEIGHT*3);
			b_circle(TRUE_POINT.x, TRUE_POINT.y, 20, 0xFF0000, buff);
			seDrawRect(0, 0, LCD_WIDTH-1, LCD_HEIGHT-1, buff);			
			pen_pos.x = pen_pos.y = NO_PEN_PRESS;	
		}
	}	
}

⌨️ 快捷键说明

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