DPC Module:DPC under Linux

From LEXWiKi

(Difference between revisions)
Jump to: navigation, search
Current revision (15:38, 15 September 2023) (edit) (undo)
 
(31 intermediate revisions not shown.)
Line 1: Line 1:
[[Category:AllowPages]]
[[Category:AllowPages]]
-
== The Sample code source you can download from ==
+
== The Sample code source bin you can download from ==
-
Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/DPC_release/Linux/DPC_v3.0L_src.tar.gz DPC_v3.0L_src.tar.gz]
+
<Google Drive>
-
Binary file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/DPC_release/Linux/DPC_v3.0L_bin.tar.gz DPC_v3.0L_bin.tar.gz]
+
Binary file: [https://drive.google.com/file/d/1ESRK33TO10X9CrKrXFbil3YNZ9Kz9KPw/view?usp=sharing DPC_v1.5L_Bin_x64]
-
64bits
+
Binary file: [https://drive.google.com/file/d/1-jouQnwkLJ2YmJDudN2ekX5JoMDLK2AL/view?usp=drive_link DPConly_v2.1L_Bin_x64]
-
Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/DPC_release/Linux/DPC_v3.0L_x64src.tar.gz DPC_v3.0L_x64src.tar.gz]
+
<FTP>
-
Binary file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/DPC_release/Linux/DPC_v3.0L_x64bin.tar.gz DPC_v3.0L_x64bin.tar.gz]
+
Binary file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/DPC_release/Linux/DPC_v1.5L_x64bin.zip DPC_v1.5L_Bin_x64]
-
== How to use the DPC Application ==
+
Binary file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/DPC_release/Linux/DPConly_v2.1Lx64bin.zip DPConly_v2.1L_Bin_x64]
 +
 
 +
== DPConly use manual ==
 +
 
 +
[[Image:DPConly.jpg]]
 +
 
 +
1. Enter Linux username
 +
 
 +
2. Enter Linux password
 +
 
 +
Use install to automatically open the program at boot
 +
 
 +
Use Uninstall to remove the automatic boot function
 +
 
 +
DPConly added that you can use the arrow keys to adjust the DPC brightness
 +
 
 +
Note: That DPConly does not have a lightsensor function
 +
 
 +
== How to use the DPC Utility ==
[[Image:DPC1.jpg]]
[[Image:DPC1.jpg]]
Line 47: Line 65:
14. Pick up the area from panel. After clicking area, the panel will be light on from darkness.
14. Pick up the area from panel. After clicking area, the panel will be light on from darkness.
 +
 +
[[Image:DPC4.jpg]]
 +
 +
15. If checked it. utility will adjust the volume of brightness automatically.
 +
 +
16. Light sensor device name.
 +
 +
17. The mode of light sensor in used.
 +
 +
18. The range of light sensor in used.
 +
 +
19. Calculated LUX values.
 +
 +
20. Advanced settings.
 +
 +
[[Image:DPC5.jpg]]
 +
 +
21. Choose which mode of light sensor to use.
 +
 +
22. Choose which range of light sensor to use.
 +
 +
23. Custom limit: light sensor maximum volume of brightness.
 +
 +
24. Custom limit: light sensor median volume of brightness.
 +
 +
25. Custom limit: light sensor minimum volume of brightness.
 +
 +
26. Save the setting value but without leaving the window.
 +
 +
27. Save the setting value and close the window.
 +
 +
28. Close the window and without saving.
== Sample Code Introduction ==
== Sample Code Introduction ==
=== Define SMBus register ===
=== Define SMBus register ===
-
typedef unsigned char BYTE;
+
#define SMBUSPORT 0x0500
-
typedef unsigned short WORD;
+
#define HST_STS SMBUSPORT+0x00
-
typedef unsigned long DWORD;
+
#define HST_CNT SMBUSPORT+0x02
-
#define m_SMBusMapIoAddr 0x0500
+
#define HST_CMD SMBUSPORT+0x03
-
//----------------------------------------------------------------------------------
+
#define XMIT_SLVA SMBUSPORT+0x04
-
#define HST_STS 0x00 // SMBus Host Status Register Offset
+
#define HST_D0 SMBUSPORT+0x05
-
#define HST_CNT 0x02 // SMBus Host Contorl Register Offset
+
#define bSize 1
-
#define HST_CMD 0x03 // SMBus Host Command Register Offset
+
#define SADD 0xb0
-
#define XMIT_SLVA 0x04 // SMBus Host Address Register Offset
+
#define PWMFeq 0x01
-
#define HST_D0 0x05 // SMBus Host Data0 Register Offset
+
#define PWMDuty 0x02
-
//----------------------------------------------------------------------------------
+
-
#define SADD 0xb0
+
-
#define PWMFeq 0x01
+
-
#define PWMDuty 0x02
+
-
 
+
-
=== SMBusIoWrite ===
+
-
void SMBusIoWrite(BYTE byteOffset,BYTE byteData)
+
-
{
+
-
outb( byteData , m_SMBusMapIoAddr + byteOffset);
+
-
}
+
-
=== SMBusIoRead ===
+
=== Set Frequency data ===
-
BYTE SMBusIoRead(BYTE byteOffset)
+
-
{
+
-
DWORD dwAddrVal;
+
-
dwAddrVal = inb(m_SMBusMapIoAddr + byteOffset);
+
-
return (BYTE)(dwAddrVal & 0x0FF);
+
-
}
+
-
=== SetDutyCycle ===
+
DWORD dwPortVal;
-
void SetDutyCycle(gint iDutyValue)
+
bool bResult;
-
{
+
bResult = InitializeWinIo();
-
DWORD dwPortVal;
+
if (bResult){
-
SMBusIoWrite(HST_STS, 0xFE);
+
SetPortVal(HST_STS, 0xFE, bSize); //start
-
SMBusIoWrite(XMIT_SLVA, SADD);
+
Sleep(20);
-
SMBusIoWrite(HST_CMD, PWMDuty);
+
SetPortVal(XMIT_SLVA, SADD, bSize); //set
-
dwPortVal = SMBusIoRead (HST_STS);
+
Sleep(20);
-
dwPortVal = dwPortVal & 0x01;
+
SetPortVal(HST_CMD, PWMFeq, bSize); //set frequency
-
SMBusIoWrite(HST_D0, iDutyValue);
+
Sleep(20);
-
SMBusIoWrite(HST_CNT, 0x48);
+
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();
-
=== SetFrequency ===
+
=== Set Duty Cycle ===
-
void SetFrequency(gint iFrequency)
+
UpdateData(TRUE);
-
{
+
DWORD dwPortVal;
-
DWORD dwPortVal;
+
bool bResult;
-
SMBusIoWrite(HST_STS, 0xFE);
+
bResult = InitializeWinIo();
-
SMBusIoWrite(XMIT_SLVA, SADD);
+
if (bResult){
-
SMBusIoWrite(HST_CMD, PWMFeq);
+
SetPortVal(HST_STS, 0xFE, bSize); //start
-
dwPortVal = SMBusIoRead (HST_STS);
+
Sleep(20);
-
dwPortVal = dwPortVal & 0x01;
+
SetPortVal(XMIT_SLVA, SADD, bSize); //set
-
SMBusIoWrite(HST_D0, iFrequency);
+
Sleep(20);
-
SMBusIoWrite(HST_CNT, 0x48);
+
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();

Current revision

Contents

The Sample code source bin you can download from

<Google Drive>

Binary file: DPC_v1.5L_Bin_x64

Binary file: DPConly_v2.1L_Bin_x64

<FTP>

Binary file: DPC_v1.5L_Bin_x64

Binary file: DPConly_v2.1L_Bin_x64

DPConly use manual

Image:DPConly.jpg

1. Enter Linux username

2. Enter Linux password

Use install to automatically open the program at boot

Use Uninstall to remove the automatic boot function

DPConly added that you can use the arrow keys to adjust the DPC brightness

Note: That DPConly does not have a lightsensor function

How to use the DPC Utility

Image:DPC1.jpg

1. If checked to save DPC setting , the setting of frequency and duty cycle will be reserved.

2. It will show the MCU version of DPC.

3. Frequency of panel selection.

4. Apply the frequency of panel which user selected.

5. Brightness control scrollbar, you can adjust volume of brightness.

6. Show the brightness value which you adjust.

7. When click the LightOff button, the panel will become darkness.

8. Reset the record of hot key and picked up area.

9. Click the button. User can pick up the area from object 13. When clicking area, the panel will be light on from darkness.

10. Click the button. User can set the hotkey. When push hot key, the panel will be light on from darkness.

Image:DPC2.jpg

11. First key of hotkey. Only enter Ctrl, SHIFT, or ALT.

12. Second key of hotkey. Only enter key: 'A' to 'Z'.

13. Apply the hotkey which user entered.

Image:DPC3.jpg

14. Pick up the area from panel. After clicking area, the panel will be light on from darkness.

Image:DPC4.jpg

15. If checked it. utility will adjust the volume of brightness automatically.

16. Light sensor device name.

17. The mode of light sensor in used.

18. The range of light sensor in used.

19. Calculated LUX values.

20. Advanced settings.

Image:DPC5.jpg

21. Choose which mode of light sensor to use.

22. Choose which range of light sensor to use.

23. Custom limit: light sensor maximum volume of brightness.

24. Custom limit: light sensor median volume of brightness.

25. Custom limit: light sensor minimum volume of brightness.

26. Save the setting value but without leaving the window.

27. Save the setting value and close the window.

28. Close the window and without saving.

Sample Code Introduction

Define SMBus register

#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 Cycle

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