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
Diff: DmTouch.cpp
- Revision:
- 12:eb97ccfe7c3f
- Parent:
- 11:8b441dd1d470
diff -r 8b441dd1d470 -r eb97ccfe7c3f DmTouch.cpp --- a/DmTouch.cpp Wed Sep 10 12:47:47 2014 +0000 +++ b/DmTouch.cpp Thu Sep 11 14:28:32 2014 +0000 @@ -122,6 +122,7 @@ _pinCLK = new DigitalOut((PinName)_clk); _pinMISO = new DigitalIn((PinName)_miso); _pinMOSI = new DigitalOut((PinName)_mosi); + sbi(_pinCS, _bitmaskCS); sbi(_pinCLK, _bitmaskCLK); } #endif @@ -156,7 +157,7 @@ else { uint8_t count=0; uint8_t temp = data; - delay(1); + //delay(1); cbi(_pinCLK, _bitmaskCLK); for(count=0;count<8;count++) { if(temp&0x80) { @@ -168,7 +169,7 @@ temp=temp<<1; - slow_pulse_low(_pinCLK, _bitmaskCLK); + pulse_low(_pinCLK, _bitmaskCLK); } } } @@ -298,10 +299,17 @@ for (int i=0; i<MEASUREMENTS; i++) { getAverageXY(valuesX[i], valuesY[i]); nbrOfMeasurements++; +#if defined (DM_TOOLCHAIN_ARDUINO) if (!isTouched()) { haveAllMeasurements = false; break; } +#elif defined (DM_TOOLCHAIN_MBED) + if (valuesX[i] >= 4095 || valuesY[i] >= 4095) { + haveAllMeasurements = false; + break; + } +#endif } if (haveAllMeasurements) { x = calculateMiddleValue(valuesX, nbrOfMeasurements);