282 if(r == KErrNone) |
282 if(r == KErrNone) |
283 { |
283 { |
284 r = GPIO::SetInterruptTrigger(KDataReadyPin, GPIO::EEdgeRising); |
284 r = GPIO::SetInterruptTrigger(KDataReadyPin, GPIO::EEdgeRising); |
285 if(r == KErrNone) |
285 if(r == KErrNone) |
286 { |
286 { |
287 GPIO::SetDebounceTime(KDataReadyPin, 500); |
287 GPIO::SetDebounceTime(KDataReadyPin, 100); |
288 SCM::SetPadConfig(CONTROL_PADCONF_MMC2_DAT0, SCM::EMsw, SCM::EMode4 | SCM::EInputEnable); // 133 (mmc2dat1) |
288 SCM::SetPadConfig(CONTROL_PADCONF_MMC2_DAT0, SCM::EMsw, SCM::EMode4 | SCM::EInputEnable); // 133 (mmc2dat1) |
289 r = GPIO::SetPinMode(KDataReadyPin, GPIO::EEnabled); |
289 r = GPIO::SetPinMode(KDataReadyPin, GPIO::EEnabled); |
290 } |
290 } |
291 } |
291 } |
292 |
292 |
295 // set up the default configuration |
295 // set up the default configuration |
296 SetDefaultConfig(); |
296 SetDefaultConfig(); |
297 |
297 |
298 // some of the pre-configuration of the touch controller could be done here.. |
298 // some of the pre-configuration of the touch controller could be done here.. |
299 iController.HardReset(); |
299 iController.HardReset(); |
300 iController.SetTouchMode(TouchController::ESingle); |
300 iController.Configure(TouchController::EModeSingle); |
301 |
|
302 TPoint winStart, winStop; |
|
303 winStart.iX = 0; |
|
304 winStart.iY = 0; |
|
305 winStop.iX = 0xfff; |
|
306 winStop.iY = 0xfff; |
|
307 iController.EnableWindowMode(winStart, winStop); |
|
308 |
|
309 iController.SetNumberOfRows(8); |
|
310 iController.SetNumberOfColumns(8); |
|
311 |
301 |
312 DigitiserPowerUp(); |
302 DigitiserPowerUp(); |
313 } |
303 } |
314 return r; |
304 return r; |
315 } |
305 } |
350 |
340 |
351 // TO DO: (mandatory) |
341 // TO DO: (mandatory) |
352 // Read from appropriate hardware register to determine whether digitiser panel is being touched |
342 // Read from appropriate hardware register to determine whether digitiser panel is being touched |
353 // Set penDown to ETrue if touched or EFalse if not touched. |
343 // Set penDown to ETrue if touched or EFalse if not touched. |
354 // |
344 // |
355 |
345 TPoint points[4]; |
356 // DEBUG_PRINT(Kern::Printf("TS: S%d PD%d Sp%d", (TInt)iState, penDown?1:0, iSamplesCount)); |
346 TInt num_points = 0; |
357 TInt penDown = iController.NumOfTouches(); |
347 TInt r = iController.GetMeasurements(points, num_points); |
358 Kern::Printf("Num touches: %d", penDown); |
348 Kern::Printf("Num touches: %d", num_points); |
|
349 Kern::Printf("Measurments: (r: %d)", r); |
|
350 for(TInt i = 0; i < num_points; i++) |
|
351 { |
|
352 Kern::Printf("%d: iX: %d, iY: %d",i, points[i].iX, points[i].iY); |
|
353 } |
|
354 |
|
355 TInt penDown = num_points; |
|
356 |
|
357 // DEBUG_PRINT(Kern::Printf("TS: S%d PD%d Sp%d", (TInt)iState, penDown?1:0, iSamplesCount)); |
|
358 |
359 if (iState==E_HW_PowerUp) |
359 if (iState==E_HW_PowerUp) |
360 { |
360 { |
361 // waiting for pen to go up after switch on due to pen down or through the HAL |
361 // waiting for pen to go up after switch on due to pen down or through the HAL |
362 // coverity[dead_error_condition] |
362 // coverity[dead_error_condition] |
363 // The next line should be reachable when this template file is edited for use |
363 // The next line should be reachable when this template file is edited for use |
419 // Read from appropriate hardware register to get the current digitiser coordinates |
419 // Read from appropriate hardware register to get the current digitiser coordinates |
420 // of the point that is being touched. Set aResults accordingly. |
420 // of the point that is being touched. Set aResults accordingly. |
421 // This is only example code... you need to modify it for your hardware |
421 // This is only example code... you need to modify it for your hardware |
422 // |
422 // |
423 TPoint aResults; |
423 TPoint aResults; |
424 |
|
425 TPoint points[4]; |
|
426 TInt num_points = 0; |
|
427 TInt r = iController.GetMeasurements(points, num_points); |
|
428 Kern::Printf("Measurments: (r: %d)", r); |
|
429 for(TInt i = 0; i < 4/* num_points*/; i++) |
|
430 { |
|
431 Kern::Printf("%d: iX: %d, iY: %d",i, points[i].iX, points[i].iY); |
|
432 } |
|
433 |
424 |
434 // X axis |
425 // X axis |
435 iX[iSamplesCount] = aResults.iX; |
426 iX[iSamplesCount] = aResults.iX; |
436 // Y axis |
427 // Y axis |
437 iY[iSamplesCount] = aResults.iY; |
428 iY[iSamplesCount] = aResults.iY; |