Modified version of the DmTftLibrary, optimized for the LPC4088 Experiment Base Board

Dependents:   lpc4088_ebb_dm_calc lpc4088_ebb_dm_bubbles

Fork of DmTftLibrary by Display Module

Revision:
8:b24f01d148c4
Parent:
7:6cd8c36cbdb3
Child:
9:bac5439e3c1c
--- a/DmTouch.cpp	Fri Jul 04 09:26:32 2014 +0000
+++ b/DmTouch.cpp	Mon Jul 07 10:38:09 2014 +0000
@@ -70,6 +70,8 @@
   if (!useIrq) {
 	_irq = -1;
   }
+#elif defined (DM_TOOLCHAIN_MBED)
+  _irq = -1;
 #endif
   
   setCalibrationMatrix(DmTouchCalibration::getDefaultCalibrationData(disp));
@@ -127,14 +129,11 @@
   pinMode(_irq, INPUT);
   _pinIrq = portInputRegister(digitalPinToPort(_irq));
   _bitmaskIrq  = digitalPinToBitMask(_irq);
-#elif defined (DM_TOOLCHAIN_MBED)
-  _pinIrq = new DigitalIn((PinName)_irq);
-  _pinIrq->mode(PullUp);
-#endif
 
   cbi(_pinCS, _bitmaskCS);
   spiWrite(0x80); // Enable PENIRQ
   sbi(_pinCS, _bitmaskCS);
+#endif    
 }
 
 void DmTouch::spiWrite(uint8_t data) {
@@ -242,19 +241,17 @@
 }
 
 void DmTouch::readTouchData(uint16_t& posX, uint16_t& posY, bool& touching) {  
-#if defined (DM_TOOLCHAIN_MBED)
-  if (!isTouched()) {
-    touching = false;
-    return;
-  }
-#endif
   uint16_t touchX, touchY;
   getMiddleXY(touchX,touchY);
 
   posX = getDisplayCoordinateX(touchX, touchY);
   posY = getDisplayCoordinateY(touchX, touchY);
   
+#if defined (DM_TOOLCHAIN_ARDUINO)
   touching = isTouched();
+#elif defined (DM_TOOLCHAIN_MBED)
+  touching = (posX < 4096 && posY < 4096);
+#endif
 }
 
 bool DmTouch::isSampleValid() {
@@ -279,7 +276,7 @@
 
   return false;
 #elif defined (DM_TOOLCHAIN_MBED)
-  return (*_pinIrq == 0);
+  return isSampleValid();
 #endif
 }