Caiou
Dependents: LCD_Proj LCD_imagetest LCD_Proj_rtc
Fork of DmTftLibrary by
Diff: DmTouch.cpp
- Revision:
- 3:02c19cbc707c
- Parent:
- 0:d6ff5fa503e8
- Child:
- 5:2c60f4aafce6
diff -r 59be7fca4581 -r 02c19cbc707c DmTouch.cpp --- a/DmTouch.cpp Tue May 20 12:21:43 2014 +0200 +++ b/DmTouch.cpp Wed May 21 14:43:08 2014 +0000 @@ -50,7 +50,7 @@ _width = 240; _height = 320; break; - + case DmTouch::DM_TFT28_105: _cs = D4; _irq = D2; @@ -92,14 +92,14 @@ _calibInvertedTouch = true; break; - case DmTouch::DM_TFT35_107: + case DmTouch::DM_TFT35_107: _calibLowX = 912; _calibLowY = 422 ; _calibModifierX = 3.25; _calibModifierY = 1.175; _calibInvertedTouch = false; break; - + case DmTouch::DM_TFT28_105: default: _calibLowX = 260; @@ -145,8 +145,9 @@ //cbi(_pinCS, _bitmaskCS); } else { _pinCLK = new DigitalOut((PinName)_clk); - _pinMISO = new DigitalOut((PinName)_miso); + _pinMISO = new DigitalIn((PinName)_miso); _pinMOSI = new DigitalOut((PinName)_mosi); + sbi(_pinCLK, _bitmaskCLK); } #endif @@ -203,7 +204,6 @@ else { uint8_t count=0; uint8_t temp = data; - cbi(_pinCLK, _bitmaskCLK); for(count=0;count<8;count++) { if(temp&0x80) { sbi(_pinMOSI, _bitmaskMOSI); @@ -234,8 +234,7 @@ } else { uint8_t count=0; uint8_t temp=0; - cbi(_pinCLK, _bitmaskCLK); - cbi(_pinMOSI, _bitmaskMOSI); + cbi(_pinMOSI, _bitmaskMOSI); // same as using 0x00 as dummy byte for(count=0;count<8;count++) { pulse_low(_pinCLK, _bitmaskCLK); @@ -316,6 +315,7 @@ posX=((TP_X-_calibLowX)/_calibModifierX); posY=((TP_Y-_calibLowY)/_calibModifierY); } + printf("Raw: %5u, %5u, Calibrated: %3u, %u\n", TP_X, TP_Y, posX, posY); //#if defined (DM_TOOLCHAIN_ARDUINO) if (posX >= 0 && posX <= _width && posY >= 0 && posY <= _height) { @@ -344,6 +344,3 @@ return (*_pinIrq == 0); #endif } - - -