如何实现2440 背光控制(作者:[email protected]

  据我所知,这个LCD背光是由一个IO控制的,可以使用PWM来控制亮度,我现在要求比较简单,就是实现按键短按就实现关闭背光,这个怎么实现?据我所知,这个很多人用SetEvent函数来实现,但是为什么不直接控制IO呢?难道这个是为了和背光驱动通信?看看下面的代码再说。

while (1) { WaitForSingleObject(gPwrButtonIntrEvent, INFINITE); //RETAILMSG(1, (TEXT(" SYSINTR_POWER int thread!!/r/n"))); //if (gOffFlag == FALSE) //no used var,delete by wsf 20070905 { if (PBT_IsPushed()) /* To Filter Noise */ { Sleep(1000); if(!PBT_IsPushed()) { //按键已经松开,表示是短按,改变背光 SetEvent(evtBLKeyPress); RETAILMSG(1, (TEXT("PBT !!!!!!BL Off!!!!!!/r/n"))); } else { Sleep(1000); if (PBT_IsPushed()) { // Soft reset and standard suspend-resume both start with suspend for now. #if (WINCEOSVER >= 400) // call whichever shutdown API is available if(gpfnSetSystemPowerState != NULL) { gpfnSetSystemPowerState(NULL, POWER_STATE_SUSPEND, POWER_FORCE); } else { PowerOffSystem(); } #else //wsf 20070905:we use this case!!! RETAILMSG(1, (TEXT("PowerOffSystem!/r/n"))); PowerOffSystem(); #endif // Give control back to system if it wants it for anything. Not in // power handling mode yet. All suspend and resume operations // will be performed in the PowerOffSystem() function. DriverSleep(0, FALSE); } } } InterruptDone(SYSINTR_POWER); } }

 

 

  果然是SetEvent,不过不知道是什么原理。

你可能感兴趣的:(thread,IO,filter,null,delete,System)