請先看『使用說明』
DPC Module:DPC under Linux
From LEXWiKi
(→Set Frequency data) |
(→Set Frequency data) |
||
Line 99: | Line 99: | ||
bool bResult; | bool bResult; | ||
bResult = InitializeWinIo(); | bResult = InitializeWinIo(); | ||
- | |||
if (bResult){ | if (bResult){ | ||
SetPortVal(HST_STS, 0xFE, bSize); //start | SetPortVal(HST_STS, 0xFE, bSize); //start | ||
Line 119: | Line 118: | ||
else | else | ||
ShutdownWinIo(); | ShutdownWinIo(); | ||
- | } | + | } |
- | ShutdownWinIo(); | + | ShutdownWinIo(); |
=== SMBusIoRead === | === SMBusIoRead === |
Revision as of 16:31, 23 February 2021
Contents |
The Sample code source you can download from
Source file: DPC_v3.0L_src.tar.gz
Binary file: DPC_v3.0L_bin.tar.gz
64bits
Source file: DPC_v3.0L_x64src.tar.gz
Binary file: DPC_v3.0L_x64bin.tar.gz
How to use the DPC Utility
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.
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.
14. Pick up the area from panel. After clicking area, the panel will be light on from darkness.
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.
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();
SMBusIoRead
BYTE SMBusIoRead(BYTE byteOffset) { DWORD dwAddrVal; dwAddrVal = inb(m_SMBusMapIoAddr + byteOffset); return (BYTE)(dwAddrVal & 0x0FF); }
SetDutyCycle
void SetDutyCycle(gint iDutyValue) { DWORD dwPortVal; SMBusIoWrite(HST_STS, 0xFE); SMBusIoWrite(XMIT_SLVA, SADD); SMBusIoWrite(HST_CMD, PWMDuty); dwPortVal = SMBusIoRead (HST_STS); dwPortVal = dwPortVal & 0x01; SMBusIoWrite(HST_D0, iDutyValue); SMBusIoWrite(HST_CNT, 0x48); }
SetFrequency
void SetFrequency(gint iFrequency) { DWORD dwPortVal; SMBusIoWrite(HST_STS, 0xFE); SMBusIoWrite(XMIT_SLVA, SADD); SMBusIoWrite(HST_CMD, PWMFeq); dwPortVal = SMBusIoRead (HST_STS); dwPortVal = dwPortVal & 0x01; SMBusIoWrite(HST_D0, iFrequency); SMBusIoWrite(HST_CNT, 0x48); }