DPC Module:DPC under Linux

From LEXWiKi

Revision as of 16:09, 23 February 2021 by Lf2nettonyboy (Talk | contribs)
Jump to: navigation, search

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 Application

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.

Sample Code Introduction

Define SMBus register

 typedef unsigned char  BYTE;
 typedef unsigned short WORD;
 typedef unsigned long  DWORD;
 #define m_SMBusMapIoAddr 0x0500
 //----------------------------------------------------------------------------------
 #define HST_STS	0x00	// SMBus Host Status        Register Offset
 #define HST_CNT	0x02	// SMBus Host Contorl       Register Offset
 #define HST_CMD	0x03	// SMBus Host Command 	    Register Offset
 #define XMIT_SLVA	0x04	// SMBus Host Address	    Register Offset
 #define HST_D0	0x05	// SMBus Host Data0         Register Offset
 //----------------------------------------------------------------------------------
 #define SADD	        0xb0
 #define PWMFeq	0x01
 #define PWMDuty	0x02

SMBusIoWrite

 void SMBusIoWrite(BYTE byteOffset,BYTE byteData)
 {
     outb( byteData , m_SMBusMapIoAddr + byteOffset);
 }

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);
 }
Personal tools