Caiou
Dependents: LCD_Proj LCD_imagetest LCD_Proj_rtc
Fork of DmTftLibrary by
Diff: DmTouch.cpp
- Revision:
- 8:b24f01d148c4
- Parent:
- 7:6cd8c36cbdb3
- Child:
- 9:bac5439e3c1c
diff -r 6cd8c36cbdb3 -r b24f01d148c4 DmTouch.cpp --- 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 }