請先看『使用說明』
Kk:Sandbox2
From LEXWiKi
(Difference between revisions)
(→PULSE mode) |
(→Initial internal '''F75111''') |
||
Line 30: | Line 30: | ||
void CKey_Pad_utilityDlg::InitInternalF75111() | 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 | |
} | } | ||
</pre> | </pre> | ||
+ | ==Get Digital Input== | ||
+ | <pre> | ||
+ | BYTE F75111_GetDigitalI0 () | ||
+ | { | ||
+ | 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; | ||
+ | }</pre> |
Revision as of 09:49, 13 December 2012
Contents |
The Sample code source you can download from
1.Binary file:
2.Source file:
How to Use The Utility
- 1.config
- start set button
- 2.save
- save button
- 3.setbutton
- Settings button analog keyboard
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_GetDigitalI0 () { 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; }