130 likes | 464 Views
Windows CE driver. By Chic Tien. LCD panel driver Touch panel driver Battery driver. LCD driver. GPE engine
E N D
Windows CE driver By Chic Tien
LCD panel driver • Touch panel driver • Battery driver
LCD driver GPE engine You can minimize the amount of time and effort that is needed to create a display driver by customizing one of the sample drivers provided with Microsoft Platform Builder. The sample drivers take advantage of the GPE class to provide default drawing with hardware-specific issues. The GDI makes calls to the display driver and the display driver writes to the physical display device. All Windows CE–based display drivers must implement a set of display DDI functions that you use to initialize the display driver and block image transfer (blit) to the display.
GPE engine • GetModeInfo • NumModes • SetMode • BltPrepare • Line • AllocSurface • SetPointerShape • MovePointer • SetPalette • InVBlank
#ifdef USING_TOUCH_WM9705 // WM9705 TOUCH timer INT_RISC_MASK &= ~INT_MASK_OS_1; TIMER_INT_EN &= ~0x02; TIMER_STATUS = 0x02; v_pDrvGlob->tch.timerIrq=1; GPIO_INT_EN &= ~GPIO_WM9712_IRQ; // disable pen down interrupt GPIO_INT_STATUS = GPIO_WM9712_IRQ; // clear generated interrupt v_pDrvGlob->tch.touchIrq=0; INT_RETURN(SYSINTR_TOUCH); #else // UCB TOUCH timer // 2004-8-3 13:49, delete the code for UCB TOUCH timer. #endif // #ifdef WM9705TOUCH
Touch screen driver • Control by WM9712 IC, • * TouchDriverCalibrationPointGet • * DdsiTouchPanelGetDeviceCaps • * DdsiTouchPanelSetMode • * DdsiTouchPanelEnable • * DdsiTouchPanelDisable • * DdsiTouchPanelAttach • * DdsiTouchPanelDetach • * DdsiTouchPanelGetPoint • * DdsiTouchPanelPowerHandler
Touch panel driver • Call the TouchPanelEnable function to start the screen sampling. • Call the TouchPanelGetDeviceCaps function to request the number of sampling points. • For every calibration point, perform the following steps: • Call TouchPanelGetDeviceCaps to get a calibration coordinate. • Draw a crosshair at the returned coordinate. • Call the TouchPanelReadCalibrationPoint function to get calibration data. • Call the TouchPanelSetCalibration function to calculate the calibration coefficients.
if (dwGpioIntStatus & GPIO_WM9712_IRQ) { // touch interrupt gpio 21 //Mask touch panel interrupt GPIO_INT_EN &= ~GPIO_WM9712_IRQ; GPIO_INT_STATUS = GPIO_WM9712_IRQ; v_pDrvGlob->tch.touchIrq=1; INT_RISC_MASK &= ~INT_MASK_OS_1; TIMER_INT_EN &= ~0x02; TIMER_STATUS = 0x02; // clear interrupt status bit v_pDrvGlob->tch.timerIrq=0; INT_RETURN(SYSINTR_TOUCH_CHANGED); }
Battery • IF BSP_NOBATTERY ! • #include "$(_WINCEROOT)\public\common\oak\drivers\battdrvr\battdrvr.reg" • IF BSP_BATTERY_VALUE_IN_REGISTRY • [HKEY_CURRENT_USER\ControlPanel\Battery] • "BatteyLatestPercent"=dword:C8 ;in percent, first set as 200,invalid • ENDIF • ENDIF
Battery driver • #ifdef BATTERY_1300MAH • /* Battery of TCL_1300mAH • * • 99% 4050mv -0 18000(21100) 1300mA • 95% 4010 -900 • 90% 3980 -1800 • 85% 3935 -2700 • 80% 3900 -3600 • 75% 3850 -4500 • 70% 3825 -5400 • 65% 3800 -6300 • 60% 3770 -7200 • 55% 3750 -8100 • 50% 3725 -9000 • 45% 3710 -9900 • 40% 3690 -10800 • 35% 3670 -11700 • 30% 3660 -12600 • 25% 3645 -13500 • 20% 3630 -14400 • 15% 3620 -15300 • 10% 3605 -16200 • 5% 3590 -17100 • */
Battery driver • DWORD BattGetPercentFromVoltage(DWORD dwVoltage) • { • DWORD dwBattPercent; • if (dwVoltage >= 4050) // Voltage > 4050mv • dwBattPercent = 99; • else if (dwVoltage>=3850) // 3850mv < Voltage < 4050mv • dwBattPercent = 75 + (dwVoltage - 3850)/8; // 3850mv is 75% , 8mv == 1% • else if (dwVoltage >= 3725) // 3725mv < Voltage < 3725mv • dwBattPercent = 50 + (dwVoltage - 3725)/5; // 3650mv is 50% , 5mv == 1% • else if (dwVoltage >= 3590) // 37250mv < Voltage < 3590mv • dwBattPercent = 5 + (dwVoltage - 3590)/3; // 3590mv is 5% , 3mv == 1% • else • dwBattPercent = 2; // Voltage < 3590mv • return dwBattPercent; • } • #endif //BATTERY_1300MAH