STMPE610 touch sensor driver library
Dependents: TS_Eyes Tokei testUniGraphic_150217 AfficheurTFTAdafruit ... more
Diff: SPI_STMPE610.cpp
- Revision:
- 1:43990f1c0a8b
- Parent:
- 0:68779c92cffa
- Child:
- 2:ee910b63c077
--- a/SPI_STMPE610.cpp Sat Nov 08 05:17:25 2014 +0000 +++ b/SPI_STMPE610.cpp Sat Nov 08 06:51:34 2014 +0000 @@ -205,17 +205,12 @@ readRegs(REG_TSC_CTRL, data, 1) ; touched = data[0] & 0x80 ; - if (touched) { //Touch Detected - readRegs(REG_TSC_DATA_X, data,5) ; + + readRegs(REG_TSC_DATA_X, data,5) ; *x = (data[0] << 8) | data[1] ; *y = (data[2] << 8) | data[3] ; *z = data[4] ; - } else { - *x = 0 ; - *y = 0 ; - *z = 0 ; - } - + data[0] = 0x4B ; data[1] = 0x01 ; writeRegs(data, 2) ; // clear FIFO @@ -224,5 +219,5 @@ data[1] = 0x00 ; // disable TSC writeRegs(data, 2) ; - return( touched & (*x || *y || *z)) ; + return( touched ) ; }