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

📄 pinyinapp.c

📁 电子秤部分源码 功能:键盘输入英文
💻 C
📖 第 1 页 / 共 2 页
字号:
			}
			else
			{
				if(InputMode == 0)
				{
					num_index = 4;
					if(strlen(chinese_string) != 0)
					{
						need_string[need_index++] = print_string[CharRow][(num_index-1)*2];
						need_string[need_index++] = print_string[CharRow][(num_index-1)*2+1];
					}
					memset(print_string,0,19);
					memset(chinese_string,0,255);
					memset(input_string,0,10);
					CharRow = 0;
					input_index = 0;
					F_value4 = 0;
				}
				else if(InputMode == 2)
				{
					need_string[need_index++] = '4';	
				}
			}
			F_value8 = 0;
			F_value7 = 0;
			F_value6 = 0;
			F_value5 = 0;
			F_value9 = 0;
			F_value3 = 0;
			F_value2 = 0;
			break;
		case 0x23:							  //5
			if (F_shift)
			{
				CharRow = 0;
				switch (F_value5)
				{
					case 3:
						input_index--;
						input_string[input_index] = 'j';
						InputEnglish = 'j';
						input_index++;
						F_value5 = 0;
						break;
					case 0:
						input_string[input_index] = 'j';
						InputEnglish = 'j';
						input_index++;
						break;	
					case 1:
						input_index--;
						input_string[input_index] = 'k';
						InputEnglish = 'k';
						input_index++;
						break;
					case 2:
						input_index--;
						input_string[input_index] = 'l';
						InputEnglish = 'l';
						input_index++;
						break;
					default:
						;					
				}
				F_value5++;
			}
			else
			{
				if(InputMode == 0)
				{
					num_index = 5;
					if(strlen(chinese_string) != 0)
					{
						need_string[need_index++] = print_string[CharRow][(num_index-1)*2];
						need_string[need_index++] = print_string[CharRow][(num_index-1)*2+1];
					}
					memset(print_string,0,19);
					memset(chinese_string,0,255);
					CharRow = 0;
					memset(input_string,0,10);
					input_index = 0;
					F_value5 = 0;
				}
				else if(InputMode == 2)
				{
					need_string[need_index++] = '5';	
				}
			}
			F_value8 = 0;
			F_value7 = 0;
			F_value6 = 0;
			F_value4 = 0;
			F_value9 = 0;
			F_value3 = 0;
			F_value2 = 0;
			break;
		case 0x24:							  //6
			if (F_shift)
			{
				CharRow = 0;
				switch (F_value6)
				{
					case 3:
						input_index--;
						input_string[input_index] = 'm';
						InputEnglish = 'm';
						input_index++;
						F_value6 = 0;
						break;
					case 0:
						input_string[input_index] = 'm';
						InputEnglish = 'm';
						input_index++;
						break;	
					case 1:
						input_index--;
						input_string[input_index] = 'n';
						InputEnglish = 'n';
						input_index++;
						break;
					case 2:
						input_index--;
						input_string[input_index] = 'o';
						InputEnglish = 'o';
						input_index++;
						break;
					default:
						;					
				}
				F_value6++;
			}
			else
			{
				if(InputMode == 0)
				{
					num_index = 6;
					if(strlen(chinese_string) != 0)
					{
						need_string[need_index++] = print_string[CharRow][(num_index-1)*2];
						need_string[need_index++] = print_string[CharRow][(num_index-1)*2+1]; 
					}
					memset(print_string,0,19);
					memset(chinese_string,0,255);
					memset(input_string,0,10);
					input_index = 0;
					F_value6 = 0;
					CharRow = 0;
				}
				else if(InputMode == 2)
				{
					need_string[need_index++] = '6';	
				}
			}
			F_value8 = 0;
			F_value7 = 0;
			F_value4 = 0;
			F_value5 = 0;
			F_value9 = 0;
			F_value3 = 0;
			F_value2 = 0;
			break;
		case 0x2a:							  //1
			if (F_shift)
			{
				CharRow = 0;
			}
			else
			{
				if(InputMode == 0)
				{
					num_index = 1;
					if(strlen(chinese_string) != 0)
					{
						need_string[need_index++] = print_string[CharRow][(num_index-1)*2];
						need_string[need_index++] = print_string[CharRow][(num_index-1)*2+1];
					}
					memset(print_string,0,19);
					memset(chinese_string,0,255);											  
					CharRow = 0;
					memset(input_string,0,10);
					input_index = 0;		
				}	
				else if(InputMode == 2)
				{
					need_string[need_index++] = '1';	
				}	
			}
			F_value2 = 0;
			F_value8 = 0;
			F_value7 = 0;
			F_value6 = 0;
			F_value5 = 0;
			F_value9 = 0;
			F_value3 = 0;
			F_value4 = 0;
			break;
		case 0x2b:							  //2
			if (F_shift)					 
			{
				CharRow = 0;
				switch (F_value2)
				{
					case 3:
						input_index--;
						input_string[input_index] = 'a';
						InputEnglish = 'a';
						input_index++;
						F_value2 = 0;
						break;
					case 0:
						input_string[input_index] = 'a';
						InputEnglish = 'a';
						input_index++;
						break;	
					case 1:
						input_index--;
						input_string[input_index] = 'b';
						InputEnglish = 'b';
						input_index++;
						break;
					case 2:
						input_index--;
						input_string[input_index] = 'c';
						InputEnglish = 'c';
						input_index++;
						break;
					default:
						;					
				}
				F_value2++;
				
			}
			else
			{
				if(InputMode == 0)
				{
					num_index = 2;
					if(strlen(chinese_string) != 0)
					{
						need_string[need_index++] = print_string[CharRow][(num_index-1)*2];
						need_string[need_index++] = print_string[CharRow][(num_index-1)*2+1];
					}
					memset(print_string,0,19);
					memset(chinese_string,0,255);
					CharRow = 0;
					memset(input_string,0,10);
					input_index = 0;
					F_value2 = 0;
				}
				else if(InputMode == 2)
				{
					need_string[need_index++] = '2';	
				}
			}
			F_value8 = 0;
			F_value7 = 0;
			F_value6 = 0;
			F_value5 = 0;
			F_value9 = 0;
			F_value3 = 0;
			F_value4 = 0;
			break;
		case 0x2c:							  //3
			if (F_shift)
			{
				CharRow = 0;
				switch (F_value3)
				{
					case 3:
						input_index--;
						input_string[input_index] = 'd';
						InputEnglish = 'd';
						input_index++;
						F_value3 = 0;
						break;
					case 0:
						input_string[input_index] = 'd';
						InputEnglish = 'd';
						input_index++;
						break;	
					case 1:
						input_index--;
						input_string[input_index] = 'e';
						InputEnglish = 'e';
						input_index++;
						break;
					case 2:
						input_index--;
						input_string[input_index] = 'f';
						InputEnglish = 'f';
						input_index++;
						break;
					default:
						;					
				}
				F_value3++;
			}
			else
			{
				if (InputMode == 0)
				{
					num_index = 3;
					if(strlen(chinese_string) != 0)
					{
						need_string[need_index++] = print_string[CharRow][(num_index-1)*2];
						need_string[need_index++] = print_string[CharRow][(num_index-1)*2+1];
					}
					memset(print_string,0,19);
					memset(chinese_string,0,255);
					memset(input_string,0,10);
					CharRow = 0;
					input_index = 0;
					F_value3 = 0;
				}
				else if(InputMode == 2)
				{
					need_string[need_index++] = '3';	
				}
			}
			F_value8 = 0;
			F_value7 = 0;
			F_value6 = 0;
			F_value5 = 0;
			F_value9 = 0;
			F_value4 = 0;
			F_value2 = 0;
			break;

			case 0x32:
				if(!F_shift)
				{
					if(InputMode == 2)
					{
						need_string[need_index++] = '0';	
					}	
				}
				break;
			case 0x33:
				if(F_shift)
				{
					if(InputMode == 2)
					{
						need_string[need_index++] = '0';
						need_string[need_index++] = '0';	
					}
				}
				else
				{
					need_string[need_index++] = ' ';
				}
				break;

			case 0x15:								      
				/* clean all the buffers and flags */		//clear
				memset(chinese_string,0,255);
				memset(input_string,0,10);	 
				memset(print_string[0],0,19);
				memset(print_string[1],0,19);
				memset(print_string[2],0,19);
				memset(print_string[3],0,19);
				memset(print_string[4],0,19);
				memset(print_string[5],0,19);
				memset(need_string,0,21);
				num_index = 0;									
				input_index = 0;
				F_shift = 0;
				F_value9 = 0;
				F_value7 = 0;
				F_value6 = 0;
				F_value5 = 0;
				F_value4 = 0;
				F_value8 = 0;
				F_value2 = 0;
				F_value3 = 0;
				roll_row = 0;

			    CharRow = 0;

				need_index = 0;
				Lcmcls();				
				*page_str = chinese_string;		                           	
				break;
		default:
			;
	}	
	memset(chinese_string,0,255);
	sprintf(chinese_string,"%s",py_ime(input_string));

	CopyString(chinese_string);

	/* clean the LCD and reset the row and Column */
	Lcmcls();		
	
	col = 168;
	Flag_row = 0;
	Print_String(DisMode, strlen(DisMode));	
	col = 0;
	Flag_row = 0;
											  
	/* letters */
	Print_String(input_string, strlen(input_string));		  
	col = 0;
	Flag_row = 2;
	/* the Chinese character which was selected */
	Print_String(need_string, strlen(need_string));		  
	col = 0;
	Flag_row = 4;
	if(print_string[CharRow][0] != 0 && InputMode == 0)
	{
		Print_SelectNum(SelectNum, 9);		
	}
	col = 0;
	Flag_row = 6;
	if (InputMode == 0)
	{
		/* the Chinese character in character library */
		Print_String(print_string[CharRow],strlen(print_string[CharRow]));		  
	}
	Flag_row = 0;
}

/**
* 	App function	
*/
void PinyinApp(void)
{
	static UINT8 left = 0, right = 0;
	if(key_int_flag)
	{
		/* judge the key which was pressed */
		left = (UINT8)Vkey;
		right = (UINT8)(Vkey>>8);
		
		right &= 0xBF;
		left &= 0xBF; 												  
		if (key_side == LEFT)										
		{	 
			key_left(left);	
		}
		else
		{
			key_right(right);	 
		} 				
	key_int_flag = 0;
	}
}

#endif

⌨️ 快捷键说明

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