DPC Module:DPC Console under Linux

From LEXWiKi

(Difference between revisions)
Jump to: navigation, search
Line 8: Line 8:
== How to compile source code ==
== How to compile source code ==
-
*Compile source code with Code::Blocks
+
*Compile source code with Code::Blocks.
-
*#Download and install the Code::Block with command "apt-get install codeblocks" <br />
+
*#Download and install the Code::Block with command "apt-get install codeblocks". <br />
-
*#Open an exist project(DPC_Console.cbp) in Code::Blocks, click the compile button <br />
+
*#Open an exist project(DPC_Console.cbp) in Code::Blocks, click the compile button. <br />
*Compile source code with "make"
*Compile source code with "make"
*#cd DPC_Console <br />
*#cd DPC_Console <br />
-
*#key in command "make" <br />
+
*#key in command "make". <br />
-
 
+
*#Select panel what you try to adjust with command "-t". Ex: Select 200 Hz with command "-d0".
Before you make it, you need to install : "make" "make-guile" "pkg-config" "gcc" "gtk2.0"
Before you make it, you need to install : "make" "make-guile" "pkg-config" "gcc" "gtk2.0"
Line 22: Line 22:
#Install resource before execute application. ".\install.sh" <br />
#Install resource before execute application. ".\install.sh" <br />
-
#Execute the application. ".\DPC_Console" <br /> [[Image:DPC_Info_1.jpg]] <br />
+
#Execute the application. ".\DPC_Console". <br /> [[Image:DPC_Info_1.jpg]] <br />
-
# Set brightness from 10 to 100 with command "-d". Ex: Set brightness 50 with command "-d50" <br />
+
#Set brightness from 10 to 100 with command "-d". Ex: Set brightness 50 with command "-d50". <br />
-
 
+
#Select panel what you try to adjust with command "-t". Ex: Select 200 Hz with command "-d0". <br />(0 = 200 Hz, 1 = 275 Hz, 2 = 380 Hz, 3 = 20 Hz, 4 = 25 Hz)
-
2. Confirm the panel which selected
+
#
-
 
+
#
-
3. If you choose to save DPC setting , the setting of frequency and duty cycle will be reserved.
+
#
-
 
+
#
-
4. It will show the MCU version of DPC.
+
-
 
+
-
5. Brightness control , you can choose : 10,20,30,40,50,60,70,80,90,100.
+
-
 
+
-
6. Show the brightness data which you choose.
+
-
 
+
-
7. When click the LightOff button , the panel will become darkest.
+
-
 
+
-
8. Record mouse position for go to 50 when LightOff. If click the button , 13 will show , you can click anywhere which you want for light on.
+
-
 
+
-
9. Record hotkey for go to 10 when LightOff. If click the button , The Record Hot Key window will show.
+
-
 
+
-
10. When click minimized , DPC will hide and show in the notification area.
+
-
 
+
-
11. Reset the record of hot key and position.
+
-
 
+
-
 
+
-
[[Image:DPC_AP_3.jpg]]<br />
+
-
 
+
-
12. The light on mouse position and hotkay can not use together , after you record hotkey , you can't use the position anymore.
+
-
 
+
-
[[Image:DPC_AP_4.jpg]]<br />
+
-
 
+
-
13. First key of hotkey
+
-
 
+
-
15. Second key of hotkey
+
-
 
+
-
16. Third key hotkey
+
-
 
+
-
17. Confirm the hotkey which you entered
+
-
 
+
-
18. Show hotkey which you set.
+
-
 
+
-
19. Hotkey will show here.
+
-
 
+
-
[[Image:DPC_AP_5.jpg]]<br />
+
-
 
+
-
20. If you want to exit DPC , you should click right button of mouse on the icon and choose exit.
+
-
 
+
-
[[Image:DPCv4.1.8.jpg]]<br />
+
-
 
+
-
21. Check this grid program will automatically grab the light size to adjust the DPC light and dark
+
-
 
+
-
22. Showing the device name
+
-
 
+
-
23. Showing the mode in use
+
-
 
+
-
24. Showing the range in used
+
-
 
+
-
25. Showing calculated LUX values
+
-
 
+
-
26. Mode and Range detail settings
+
-
 
+
-
[[Image:DPCv4.1.5setting.jpg]]
+
-
 
+
-
27. Choose which mode to use
+
-
 
+
-
28. Choose which range to use
+
-
 
+
-
29. Custom DPC Max brightness
+
-
 
+
-
30. Set the DPC brightness intermediate reference value
+
-
 
+
-
31. Custom DPC Min brightness
+
-
 
+
-
32. Complete the settings button but without leaving the window
+
-
 
+
-
33. Complete the settings button and exit leaving the window
+
-
 
+
-
34. exit leaving the window
+
-
 
+
== Sample code Introduction ==
== Sample code Introduction ==

Revision as of 18:05, 28 May 2020

Contents

The Sample code source you can download form

Binary file:
???DPCv4.2.2W_bin.zip
???DPC_LightSensor_4.2.2W_bin.zip

How to compile source code

  • Compile source code with Code::Blocks.
    1. Download and install the Code::Block with command "apt-get install codeblocks".
    2. Open an exist project(DPC_Console.cbp) in Code::Blocks, click the compile button.


  • Compile source code with "make"
    1. cd DPC_Console
    2. key in command "make".
    3. Select panel what you try to adjust with command "-t". Ex: Select 200 Hz with command "-d0".
   Before you make it, you need to install : "make" "make-guile" "pkg-config" "gcc" "gtk2.0"

How to use the DPC console application

  1. Install resource before execute application. ".\install.sh"
  2. Execute the application. ".\DPC_Console".
    Image:DPC_Info_1.jpg
  3. Set brightness from 10 to 100 with command "-d". Ex: Set brightness 50 with command "-d50".
  4. Select panel what you try to adjust with command "-t". Ex: Select 200 Hz with command "-d0".
    (0 = 200 Hz, 1 = 275 Hz, 2 = 380 Hz, 3 = 20 Hz, 4 = 25 Hz)

Sample code Introduction

Define SMBus regester

#define SMBUSPORT		0x0500
#define	HST_STS			SMBUSPORT+0x00
#define	HST_CNT			SMBUSPORT+0x02
#define	HST_CMD			SMBUSPORT+0x03
#define	XMIT_SLVA		SMBUSPORT+0x04
#define	HST_D0			SMBUSPORT+0x05
#define bSize			1
#define SADD			0xb0
#define PWMFeq			0x01
#define PWMDuty			0x02

Set Frequency data

DWORD dwPortVal;
bool bResult;
bResult = InitializeWinIo();

if (bResult){
     SetPortVal(HST_STS, 0xFE, bSize); //start
     Sleep(20);
     SetPortVal(XMIT_SLVA, SADD, bSize); //set
     Sleep(20);
     SetPortVal(HST_CMD, PWMFeq, bSize); //set frequency
     Sleep(20);
     GetPortVal(HST_STS, &dwPortVal, bSize);
     Sleep(20);
     dwPortVal = dwPortVal & 0x01;
     if (dwPortVal == 0){
          SetPortVal(HST_D0, fvalue, bSize); //write data into frequency
          Sleep(20);
          SetPortVal(HST_CNT, 0x48, bSize); //stop
          Sleep(20);
          ShutdownWinIo();
     }
     else
          ShutdownWinIo();
}
ShutdownWinIo();

Set Duty data

UpdateData(TRUE);
DWORD dwPortVal;
bool bResult;
bResult = InitializeWinIo();

if (bResult){
     SetPortVal(HST_STS, 0xFE, bSize); //start
     Sleep(20);
     SetPortVal(XMIT_SLVA, SADD, bSize); //set 
     Sleep(20);
     SetPortVal(HST_CMD, PWMDuty, bSize); //set duty
     Sleep(20);
     GetPortVal(HST_STS, &dwPortVal, bSize);
     Sleep(20);
     dwPortVal = dwPortVal & 0x01;
     if (dwPortVal == 0){
          if (inverter == false)
               SetPortVal(HST_D0, dvalue * 10 , bSize); //write data into data
          else if (inverter == true)
               SetPortVal(HST_D0, (10 - dvalue) * 10 , bSize); 
          Sleep(20);
   	   SetPortVal(HST_CNT, 0x48, bSize); //stop
          Sleep(20);
          ShutdownWinIo();
     }
     else
          ShutdownWinIo();
}
ShutdownWinIo();
Personal tools