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

📄 pos.c

📁 本程序在S3C44B0 uClinux的嵌入式GUI
💻 C
字号:
#include "pos.h"#define MAX_LINES_IN_ONE_SCREEN	5#define STR_PINYIN	"拼音:"static void show_pinyin_and_result(char *py_str){	UInt16 *pResult;		LCD_DisplayOneLine(30,50,py_str,1,1);	// Display the input string	pResult = get_data_offset(py_str);	// get the CJK string	if (pResult)	{		LCD_DisplayOneLine(60,50,pResult,1,0);	}}static void cjk_ime(void){	unsigned char num_str[16];	int goods_id;	unsigned int c;	int current_pos;		current_pos = 0;	memset(num_str,0,sizeof(num_str));		LCD_DisplayOneLine(2,50,STR_PINYIN,1,1);	while (1)	{		if (KB_GetStatus())		{			c = KB_GetValue();			printf("ASCII code:%x\n",c);						// convert scan code to ascii code			//c = get_ascii_code_from_scan_code(kc);			//printf("Key:%x,ascii:%c\n---------------\n",kc,c);			switch (c)			{				// enter key is pressed......				case ' ':					if (current_pos > 0)					{						current_pos --;						num_str[current_pos] = 0;						show_pinyin_and_result(num_str);					}				break;				case 'a':case 'b':case 'c':case 'd':case 'e':case 'f':case 'g':				case 'h':case 'i':case 'j':case 'k':case 'l':case 'm':case 'n':				case 'o':case 'p':case 'q':case 'r':case 's':case 't':case 'u':				case 'v':case 'w':case 'x':case 'y':case 'z':					if (current_pos >= sizeof(num_str)) break;					num_str[current_pos++] = c;					show_pinyin_and_result(num_str);				break;				case '0':case '1':case '2':case '3':case '4':case '5':case '6':				case '7':case '8':case '9':				break;				case 0x8000029://KEY_CTRL_SPACE:					return;				break;							}		}	}}// loop here until user press key 'enter'static int wait_type_in_number(void)	{	unsigned char num_str[16];	int goods_id;	unsigned int c;	int current_pos;		current_pos = 0;	memset(num_str,0,sizeof(num_str));		num_str[0] = 0x02;	//medium caret	current_pos ++;	LCD_DisplayOneLine(70,50,num_str,1,0);		while (1)	{		if (KB_GetStatus())		{			c = KB_GetValue();			printf("ASCII code:%x\n",c);						//c = get_ascii_code_from_scan_code(kc);			//printf("Key:%x,ascii:%c\n---------------\n",kc,c);			switch (c)			{				// enter key is pressed......				case 0x0a://KEY_ENTER:					// clear the input id					LCD_DisplayOneLine(70,50,"",1,1);					goods_id = atoi(num_str);					return goods_id;				break;				case 0x10://KEY_BACKSPACE:					if (current_pos > 1)					{						current_pos --;						num_str[current_pos] = 0;num_str[current_pos-1] = 0x02;						LCD_DisplayOneLine(70,50,num_str,1,1);					}				break;				case '0':case '1':case '2':case '3':case '4':case '5':case '6':				case '7':case '8':case '9':					if (current_pos >= sizeof(num_str)) break;					num_str[current_pos-1] = c;num_str[current_pos++] = 0x02;					LCD_DisplayOneLine(70,50,num_str,1,0);				break;				case 0x8000029://KEY_CTRL_SPACE:					cjk_ime();					LCD_DisplayOneLine(2,50,STR_GOODS_ID,1,1);				break;							}		}	}}//static UInt8 flag_category=0;static int l_delay(int t){	while (t--);}//========================================================int  main(int argc,char * argv[]){ int cnt = 0,kc;    LCD_Init();	// Init LCD device    LCD44780_Init();// Init LCD44780 device    LCD44780_Display( "Hello.PET Mr.Cai" );    InitPrinter(); //初始化热敏打印机    if( InitFileHandle() )        TC_PressAnyKey();    //ImeInit();	// Initialize Chinese/Japanese/Korean input method    LCD6963_ClearScreen();   //清屏幕    ShowBitmap("/mnt/nand_disk1/sample.bmp",10,10);	// Display a BITMAP in screen    TC_PressAnyKey();    //wait_type_in_number();    do{	  Main_Menu();    }while(1);    StopApplication();	    return 0;}                                                                                                                                                                                                                                                                                                                                                   

⌨️ 快捷键说明

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