Key Pad Utility Windows

From LEXWiKi

(Difference between revisions)
Jump to: navigation, search
(New page: == The Sample code source you can download from == 1.Binary file:[ftp://sf@ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/Key_Pad_Utility/Windows/Key_Pad_utility_bin_v1.0W(32bit).rar Key_Pa...)
Current revision (13:54, 25 February 2022) (edit) (undo)
(The Sample code source you can download from)
 
(16 intermediate revisions not shown.)
Line 1: Line 1:
 +
[[Category:AllowPages]]
== The Sample code source you can download from ==
== The Sample code source you can download from ==
-
1.Binary file:[ftp://sf@ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/Key_Pad_Utility/Windows/Key_Pad_utility_bin_v1.0W(32bit).rar Key_Pad_utility_bin_v1.0W(32bit).rar][ftp://sf@ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/Key_Pad_Utility/Windows/Key_Pad_utility_bin_v1.0W(64bit).rar Key_Pad_utility_bin_v1.0W(64bit).rar]<br>
+
 
-
2.Source file:[ftp://sf@ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/Key_Pad_Utility/Windows/Key_Pad_utility_src_v1.0W(32bit).rar Key_Pad_utility_src_v1.0W(32bit).rar][ftp://sf@ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/Key_Pad_Utility/Windows/Key_Pad_utility_src_v1.0W(64bit).rar Key_Pad_utility_src_v1.0W(64bit).rar]<br>
+
<Google Drive>
 +
 
 +
Source file:[https://drive.google.com/file/d/19FPku7fhtjUgYQB3haywHkdMYdgBOC4A/view?usp=sharing Key_Pad_utility_Src_v1.1_x86]
 +
[https://drive.google.com/file/d/1mMU--haBPKtpInVrcXWv5IwTcP65Hyja/view?usp=sharing Key_Pad_utility_Src_v1.1_x64]
 +
 
 +
Binary file:[https://drive.google.com/file/d/1FjiSFaXJkzdPLZyOgyA5UvJvIw4KwaGJ/view?usp=sharing Key_Pad_utility_Bin_v1.1_x86][https://drive.google.com/file/d/1L4EPjuQYVXKXnpEpixH_TmNfRC82QuNH/view?usp=sharing Key_Pad_utility_Bin_v1.1_x64]
 +
 
 +
 
 +
<FTP>
 +
 
 +
Source file:[ftp://sf@ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/Key_Pad_Utility/Windows/Key_Pad_utility_Src_V1.1(32bit).zip Key_Pad_utility_Src_v1.1_x86][ftp://sf@ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/Key_Pad_Utility/Windows/Key_Pad_utility_Src_V1.1(64bit).zip Key_Pad_utility_Src_v1.1_x64]
 +
 
 +
Binary file:[ftp://sf@ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/Key_Pad_Utility/Windows/Key_Pad_utility_Bin_V1.1(32bit).zip Key_Pad_utility_Bin_v1.1_x86][ftp://sf@ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/Key_Pad_Utility/Windows/Key_Pad_utility_Bin_V1.1(64bit).zip Key_Pad_utility_Bin_v1.1_x64]
== How to Use The Utility ==
== How to Use The Utility ==
[[Image:key_pad_utility.jpg]]<br>
[[Image:key_pad_utility.jpg]]<br>
-
;1.config:start set button<br>
+
[[Image:key_pad_recode.jpg]]<br>
 +
;1.config:start set button or cecode<br>
;2.save:save button<br>
;2.save:save button<br>
;3.setbutton:Settings button analog keyboard<br>
;3.setbutton:Settings button analog keyboard<br>
 +
;4.recode:open new window to recode<br>
 +
;5.Enter:the text you want to enter<br>
 +
;6.finish:Complete text input<br>
 +
== Introduction ==
== Introduction ==
=== Initial Internal F75111 port address (0x9c)===
=== Initial Internal F75111 port address (0x9c)===
Line 27: Line 45:
}
}
</pre>
</pre>
-
== Initial internal '''F75111''' ==
+
=== Initial internal '''F75111''' ===
<pre>
<pre>
void CKey_Pad_utilityDlg::InitInternalF75111()
void CKey_Pad_utilityDlg::InitInternalF75111()
Line 36: Line 54:
}
}
</pre>
</pre>
-
==Get Digital Input==
+
===Get Digital Input===
<pre>
<pre>
BYTE F75111_GetDigital0 ()
BYTE F75111_GetDigital0 ()
Line 66: Line 84:
}</pre>
}</pre>
-
== Get Keyboard wParam & lParam ==
+
=== RunGetKeyThread ===
<pre>
<pre>
-
BOOL CKey_Pad_utilityDlg::PreTranslateMessage(MSG* pMsg)
+
UINT RunGetKeyThread(LPVOID lParam)
{
{
-
char StrTemp[16];
+
char StrTemp[3][16];
-
int StrSize=16;
+
int i,j,k,wParamtemp,lParamtemp;
-
if( setbutton1 == true || setbutton2 == true || setbutton3 == true || setbutton4 == true )
+
int StrSize=16,finish=0;
-
{
+
CEdit *edittemp;
-
if(pMsg -> message == WM_SYSKEYDOWN )
+
CKey_Pad_utilityDlg *dlg=(CKey_Pad_utilityDlg *)lParam;
-
{
+
start=1;
-
for(int i=1;i<256;i++)
+
switch (setbutton)
 +
{
 +
case 1:
 +
buttontemp = &button1;
 +
edittemp= &dlg->m_edit_recode1;
 +
break;
 +
case 2:
 +
buttontemp = &button2;
 +
edittemp= &dlg->m_edit_recode2;
 +
break;
 +
case 3:
 +
buttontemp = &button3;
 +
edittemp= &dlg->m_edit_recode3;
 +
break;
 +
case 4:
 +
buttontemp = &button4;
 +
edittemp= &dlg->m_edit_recode4;
 +
break;
 +
case 5:
 +
buttontemp = &button5;
 +
edittemp= &dlg->m_edit_recode5;
 +
break;
 +
case 6:
 +
buttontemp = &button6;
 +
edittemp= &dlg->m_edit_recode6;
 +
break;
 +
case 7:
 +
buttontemp = &button7;
 +
edittemp= &dlg->m_edit_recode7;
 +
break;
 +
case 8:
 +
buttontemp = &button8;
 +
edittemp= &dlg->m_edit_recode8;
 +
break;
 +
}
 +
while(start==1 )
 +
{
 +
if(KeyDownFlag==1)
 +
{
 +
wParamtemp=msgtemp1->wParam,lParamtemp=msgtemp1->lParam;
 +
while(1)
{
{
-
if(pMsg -> wParam == i)
+
for( i=1;i<156;i++)
-
{
+
{
-
if(setbutton1== true)
+
for( j=1;j<156;j++)
{
{
-
msg1.wParam=pMsg->wParam;
+
for( k=1;k<156;k++)
-
msg1.lParam=pMsg->lParam;
+
{
-
GetKeyNameText(pMsg->lParam,StrTemp,StrSize);
+
if(i!=j && i!=k && j!=k )
-
m_edit1.SetWindowText(StrTemp);
+
{
-
setbutton1=false;
+
if( wParamtemp==i && cbuf[j]&0x80 && msgtemp1->wParam==k && (msgtemp1->message == WM_KEYDOWN || msgtemp1->message == WM_SYSKEYDOWN) )
-
}
+
{
-
if(setbutton2== true)
+
buttontemp->hotkey1.wParam = i;
-
{
+
buttontemp->hotkey2.wParam = j;
-
msg2.wParam=pMsg->wParam;
+
buttontemp->hotkey3.wParam = k;
-
msg2.lParam=pMsg->lParam;
+
GetKeyNameText(MapVirtualKey(buttontemp->hotkey1.wParam,0) << 16,StrTemp[0],StrSize);
-
GetKeyNameText(pMsg->lParam,StrTemp,StrSize);
+
GetKeyNameText(MapVirtualKey(buttontemp->hotkey2.wParam,0) << 16,StrTemp[1],StrSize);
-
m_edit2.SetWindowText(StrTemp);
+
GetKeyNameText(MapVirtualKey(buttontemp->hotkey3.wParam,0) << 16,StrTemp[2],StrSize);
-
setbutton2=false;
+
strcat(StrTemp[0],"+");
-
}
+
strcat(StrTemp[0],StrTemp[1]);
-
if(setbutton3== true)
+
strcat(StrTemp[0],"+");
-
{
+
strcat(StrTemp[0],StrTemp[2]);
-
msg3.wParam=pMsg->wParam;
+
edittemp->SetWindowTextA(StrTemp[0]);
-
msg3.lParam=pMsg->lParam;
+
KeyDownFlag=0;
-
GetKeyNameText(pMsg->lParam,StrTemp,StrSize);
+
start=0;
-
m_edit3.SetWindowText(StrTemp);
+
memset(cbuf,0,sizeof(cbuf));
-
setbutton3=false;
+
return TRUE;
-
}
+
}
-
if(setbutton4== true)
+
if( (cbuf[i]&0x80)==0x80 && (msgtemp1->wParam==j) && (msgtemp1->message == WM_KEYUP || msgtemp1->message == WM_SYSKEYUP) )
-
{
+
{
-
msg4.wParam=pMsg->wParam;
+
buttontemp->hotkey1.wParam = i;
-
msg4.lParam=pMsg->lParam;
+
buttontemp->hotkey2.wParam = j;
-
GetKeyNameText(pMsg->lParam,StrTemp,StrSize);
+
buttontemp->hotkey3.wParam = 0;
-
m_edit4.SetWindowText(StrTemp);
+
-
setbutton4=false;
+
GetKeyNameText(MapVirtualKey(buttontemp->hotkey1.wParam,0) << 16,StrTemp[0],StrSize);
 +
GetKeyNameText(MapVirtualKey(buttontemp->hotkey2.wParam,0) << 16,StrTemp[1],StrSize);
 +
strcat(StrTemp[0],"+");
 +
strcat(StrTemp[0],StrTemp[1]);
 +
edittemp->SetWindowTextA(StrTemp[0]);
 +
KeyDownFlag=0;
 +
start=0;
 +
memset(cbuf,0,sizeof(cbuf));
 +
return TRUE;
 +
}
 +
if( wParamtemp==msgtemp1->wParam && (msgtemp1->message == WM_KEYUP || msgtemp1->message == WM_SYSKEYUP) )
 +
{
 +
 
 +
buttontemp->hotkey1.wParam = msgtemp1->wParam ;
 +
buttontemp->hotkey2.wParam = 0;
 +
buttontemp->hotkey3.wParam = 0;
 +
int y=GetOEMCP();
 +
int x=MapVirtualKey(buttontemp->hotkey1.wParam,0) ;
 +
GetKeyNameText(MapVirtualKey(buttontemp->hotkey1.wParam,0) << 16,StrTemp[0],StrSize);
 +
edittemp->SetWindowTextA(StrTemp[0]);
 +
KeyDownFlag=0;
 +
start=0;
 +
memset(cbuf,0,sizeof(cbuf));
 +
return TRUE;
 +
}
 +
}
 +
}
}
}
}
}
}
}
}
}
-
if(pMsg -> message == WM_KEYDOWN)
+
}
 +
return 0;
 +
}
 +
</pre>
 +
 
 +
=== RunDIOThread ===
 +
<pre>
 +
UINT RunDIOThread(LPVOID lParam)
 +
{
 +
F75111_Init();
 +
CKey_Pad_utilityDlg *dlg=(CKey_Pad_utilityDlg *)lParam;
 +
 
 +
while(1)
 +
{
 +
char *temp=0;
 +
BYTE intputsignal=0;
 +
 +
intputsignal=F75111_GetDigital0();
 +
 
 +
while(1)
 +
if(intputsignal!=F75111_GetDigital0())
 +
break;
 +
switch(intputsignal)
{
{
-
for(int i=1;i<256;i++)
+
 
-
{
+
case 0x01:
-
if(pMsg -> wParam == i)
+
{
{
-
if(setbutton1== true)
+
dlg->execute(button1);
-
{
+
break;
-
msg1.wParam=pMsg->wParam;
+
-
msg1.lParam=pMsg->lParam;
+
-
GetKeyNameText(pMsg->lParam,StrTemp,StrSize);
+
-
m_edit1.SetWindowText(StrTemp);
+
-
setbutton1=false;
+
-
}
+
-
if(setbutton2== true)
+
-
{
+
-
msg2.wParam=pMsg->wParam;
+
-
msg2.lParam=pMsg->lParam;
+
-
GetKeyNameText(pMsg->lParam,StrTemp,StrSize);
+
-
m_edit2.SetWindowText(StrTemp);
+
-
setbutton2=false;
+
-
}
+
-
if(setbutton3== true)
+
-
{
+
-
msg3.wParam=pMsg->wParam;
+
-
msg3.lParam=pMsg->lParam;
+
-
GetKeyNameText(pMsg->lParam,StrTemp,StrSize);
+
-
m_edit3.SetWindowText(StrTemp);
+
-
setbutton3=false;
+
-
}
+
-
if(setbutton4== true)
+
-
{
+
-
msg4.wParam=pMsg->wParam;
+
-
msg4.lParam=pMsg->lParam;
+
-
GetKeyNameText(pMsg->lParam,StrTemp,StrSize);
+
-
m_edit4.SetWindowText(StrTemp);
+
-
setbutton4=false;
+
-
}
+
}
}
-
}
+
case 0x02:
-
}
+
{
 +
dlg->execute(button2);
 +
break;
 +
}
 +
case 0x04:
 +
{
 +
dlg->execute(button3);
 +
break;
 +
}
 +
case 0x08:
 +
{
 +
dlg->execute(button4);
 +
break;
 +
}
 +
case 0x10:
 +
{
 +
dlg->execute(button5);
 +
break;
 +
}
 +
case 0x20:
 +
{
 +
dlg->execute(button6);
 +
break;
 +
}
 +
case 0x40:
 +
{
 +
dlg->execute(button7);
 +
break;
 +
}
 +
case 0x80:
 +
{
 +
dlg->execute(button8);
 +
break;
 +
}
 +
}
}
}
-
return CDialog::PreTranslateMessage(pMsg);
+
return 0;
-
}</pre>
+
}
 +
</pre>

Current revision

Contents

The Sample code source you can download from

<Google Drive>

Source file:Key_Pad_utility_Src_v1.1_x86 Key_Pad_utility_Src_v1.1_x64

Binary file:Key_Pad_utility_Bin_v1.1_x86Key_Pad_utility_Bin_v1.1_x64


<FTP>

Source file:Key_Pad_utility_Src_v1.1_x86Key_Pad_utility_Src_v1.1_x64

Binary file:Key_Pad_utility_Bin_v1.1_x86Key_Pad_utility_Bin_v1.1_x64

How to Use The Utility

Image:key_pad_utility.jpg
Image:key_pad_recode.jpg

1.config
start set button or cecode
2.save
save button
3.setbutton
Settings button analog keyboard
4.recode
open new window to recode
5.Enter
the text you want to enter
6.finish
Complete text input

Introduction

Initial Internal F75111 port address (0x9c)

   define GPIO1X, GPIO2X, GPIO3X to input or output 
   and Enable WDT function pin 

Set F75111 DI/DO ( sample code as below Get Input value/Set output value )

   DI: InterDigitalInput()

PULSE mode

Sample to setting GP33, 32, 31, 30 output 1mS low pulse signal.

{ 
    this->Write_Byte(F75111_INTERNAL_ADDR, GPIO3X_PULSE_CONTROL,       0x00);             //This is setting low pulse output
    this->Write_Byte(F75111_INTERNAL_ADDR, GPIO3X_PULSE_WIDTH_CONTROL, 0x01);             //This selects the pulse width to 1mS
    this->Write_Byte(F75111_INTERNAL_ADDR, GPIO3X_CONTROL_MODE,        0x0F);             //This is setting the GP33, 32, 31, 30 to output function.    
    this->Write_Byte(F75111_INTERNAL_ADDR, GPIO3X_Output_Data ,        0x0F);             //This is setting the GP33, 32, 31, 30 output data.
}

Initial internal F75111

void CKey_Pad_utilityDlg::InitInternalF75111()
{
    ::Write_Byte(F75111_INTERNAL_ADDR,GPIO1X_CONTROL_MODE  ,0x00);        //set GPIO1X to Input  function     
    ::Write_Byte(F75111_INTERNAL_ADDR,GPIO3X_CONTROL_MODE  ,0x00);        //set GPIO3X to Input  function
    ::Write_Byte(F75111_INTERNAL_ADDR,GPIO2X_CONTROL_MODE  ,0x00);        //set GPIO2X to Input function
}

Get Digital Input

BYTE F75111_GetDigital0 ()
{
	BYTE byteGPIO1X = 0;
	BYTE byteGPIO2X = 0;
	BYTE byteGPIO3X = 0;
	BYTE byteData   = 0;

	::SMBus_ReadByte(m_F75111.bAddress,GPIO1X_INPUT_DATA,&byteGPIO1X) ;
	::SMBus_ReadByte(m_F75111.bAddress,GPIO2X_INPUT_DATA,&byteGPIO2X) ;	
	::SMBus_ReadByte(m_F75111.bAddress,GPIO3X_INPUT_DATA,&byteGPIO3X) ;	

	byteGPIO1X = ~byteGPIO1X  & 0xF0;
	byteGPIO3X = ~byteGPIO3X  & 0x0F;
	byteGPIO2X = ~byteGPIO2X  & 0xFF;

	byteData = ( byteGPIO1X & 0x10 )? byteData + 0x01 : byteData ;
	byteData = ( byteGPIO2X & 0x80 )? byteData + 0x02 : byteData ;
	byteData = ( byteGPIO1X & 0x80 )? byteData + 0x04 : byteData ;	
	byteData = ( byteGPIO2X & 0x04 )? byteData + 0x08 : byteData ;

	byteData = ( byteGPIO1X & 0x40 )? byteData + 0x10 : byteData ;
	byteData = ( byteGPIO2X & 0x02 )? byteData + 0x20 : byteData ;
	byteData = ( byteGPIO3X & 0x01 )? byteData + 0x40 : byteData ;
	byteData = ( byteGPIO2X & 0x01 )? byteData + 0x80 : byteData ;

	return byteData;
}

RunGetKeyThread

UINT RunGetKeyThread(LPVOID lParam)
{
	char StrTemp[3][16];
	int i,j,k,wParamtemp,lParamtemp;
	int StrSize=16,finish=0;
	CEdit *edittemp;
	CKey_Pad_utilityDlg *dlg=(CKey_Pad_utilityDlg *)lParam;
	start=1;
	switch (setbutton)
	{
		case 1:
			buttontemp = &button1;
			edittemp= &dlg->m_edit_recode1;
			break;
		case 2:
			buttontemp = &button2;
			edittemp= &dlg->m_edit_recode2;
			break;
		case 3:
			buttontemp = &button3;
			edittemp= &dlg->m_edit_recode3;
			break;
		case 4:
			buttontemp = &button4;
			edittemp= &dlg->m_edit_recode4;
			break;
		case 5:
			buttontemp = &button5;
			edittemp= &dlg->m_edit_recode5;
			break;
		case 6:
			buttontemp = &button6;
			edittemp= &dlg->m_edit_recode6;
			break;
		case 7:
			buttontemp = &button7;
			edittemp= &dlg->m_edit_recode7;
			break;
		case 8:
			buttontemp = &button8;
			edittemp= &dlg->m_edit_recode8;
			break;
	}
	while(start==1 )
	{
		if(KeyDownFlag==1)
		{
			wParamtemp=msgtemp1->wParam,lParamtemp=msgtemp1->lParam;
			while(1)
			{
				for( i=1;i<156;i++)
				{	
					for( j=1;j<156;j++)
					{
						for( k=1;k<156;k++)
						{
							if(i!=j && i!=k && j!=k )
							{								
								if( wParamtemp==i && cbuf[j]&0x80 && msgtemp1->wParam==k && (msgtemp1->message == WM_KEYDOWN || msgtemp1->message == WM_SYSKEYDOWN) )
								{
 									buttontemp->hotkey1.wParam = i;
									buttontemp->hotkey2.wParam = j;
									buttontemp->hotkey3.wParam = k;
									GetKeyNameText(MapVirtualKey(buttontemp->hotkey1.wParam,0) << 16,StrTemp[0],StrSize);
									GetKeyNameText(MapVirtualKey(buttontemp->hotkey2.wParam,0) << 16,StrTemp[1],StrSize);
									GetKeyNameText(MapVirtualKey(buttontemp->hotkey3.wParam,0) << 16,StrTemp[2],StrSize);
									strcat(StrTemp[0],"+"); 
									strcat(StrTemp[0],StrTemp[1]); 
									strcat(StrTemp[0],"+"); 
									strcat(StrTemp[0],StrTemp[2]); 
									edittemp->SetWindowTextA(StrTemp[0]);
									KeyDownFlag=0;
									start=0;
									memset(cbuf,0,sizeof(cbuf));
									return TRUE;
								}
								if( (cbuf[i]&0x80)==0x80 && (msgtemp1->wParam==j) && (msgtemp1->message == WM_KEYUP || msgtemp1->message == WM_SYSKEYUP) )
								{
									buttontemp->hotkey1.wParam = i;
									buttontemp->hotkey2.wParam = j;
									buttontemp->hotkey3.wParam = 0;
									
									GetKeyNameText(MapVirtualKey(buttontemp->hotkey1.wParam,0) << 16,StrTemp[0],StrSize);
									GetKeyNameText(MapVirtualKey(buttontemp->hotkey2.wParam,0) << 16,StrTemp[1],StrSize);
									strcat(StrTemp[0],"+"); 
									strcat(StrTemp[0],StrTemp[1]); 
									edittemp->SetWindowTextA(StrTemp[0]);
									KeyDownFlag=0;
									start=0;
									memset(cbuf,0,sizeof(cbuf));
									return TRUE;
								}
								if( wParamtemp==msgtemp1->wParam  && (msgtemp1->message == WM_KEYUP || msgtemp1->message == WM_SYSKEYUP) )
								{

									buttontemp->hotkey1.wParam = msgtemp1->wParam ;
									buttontemp->hotkey2.wParam = 0;
									buttontemp->hotkey3.wParam = 0;
									int y=GetOEMCP();
									int x=MapVirtualKey(buttontemp->hotkey1.wParam,0) ;
									GetKeyNameText(MapVirtualKey(buttontemp->hotkey1.wParam,0) << 16,StrTemp[0],StrSize);
									edittemp->SetWindowTextA(StrTemp[0]);
									KeyDownFlag=0;
									start=0;
									memset(cbuf,0,sizeof(cbuf));
									return TRUE;
								}
							}
						}
					}
				}
			}
		}
	}
	return 0;
}

RunDIOThread

UINT RunDIOThread(LPVOID lParam)
{
	F75111_Init();
	CKey_Pad_utilityDlg *dlg=(CKey_Pad_utilityDlg *)lParam;

	while(1)
	{
		char *temp=0;
		BYTE intputsignal=0;
			
		intputsignal=F75111_GetDigital0();

		while(1)
			if(intputsignal!=F75111_GetDigital0())
				break;
		switch(intputsignal)
		{

			case 0x01:
				{
					dlg->execute(button1);
					break;
				}
			case 0x02:
				{
					dlg->execute(button2);
					break;
				}
			case 0x04:
				{
					dlg->execute(button3);
					break;
				}
			case 0x08:
				{
					dlg->execute(button4);
					break;
				}
			case 0x10:
				{
					dlg->execute(button5);
					break;
				}
			case 0x20:
				{
					dlg->execute(button6);
					break;
				}
			case 0x40:
				{
					dlg->execute(button7);
					break;
				}
			case 0x80:
				{
					dlg->execute(button8);
					break;
				}
		}
	}
	return 0;
}
Personal tools