aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTectu <joel@unormal.org>2012-08-16 03:26:02 -0700
committerTectu <joel@unormal.org>2012-08-16 03:26:02 -0700
commitdf680e6d6e6b791534c970dee313b492e829b6e4 (patch)
treef7413c4ef23867e5679a96aab63d7b44e6883274 /src
parent2d8c4a825de421f1d045433478e65da31d551d06 (diff)
parent0b8c95ab207a474e9b1c28c89c8848e6d0992974 (diff)
downloaduGFX-df680e6d6e6b791534c970dee313b492e829b6e4.tar.gz
uGFX-df680e6d6e6b791534c970dee313b492e829b6e4.tar.bz2
uGFX-df680e6d6e6b791534c970dee313b492e829b6e4.zip
Merge pull request #43 from abhishek-kakkar/master
Touchpad Updates
Diffstat (limited to 'src')
-rw-r--r--src/touchpad.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/touchpad.c b/src/touchpad.c
index 977bb31c..a18930da 100644
--- a/src/touchpad.c
+++ b/src/touchpad.c
@@ -69,13 +69,13 @@ static uint16_t _tpReadRealX(void) {
uint32_t results = 0;
uint16_t i, x;
+ /* Median filtering is already done in LLD */
for(i = 0; i < CONVERSIONS; i++) {
- tp_lld_read_x(); /* dummy, reduce noise on SPI */
results += tp_lld_read_x();
- }
+ }
- // 12-bit
- x = (((SCREEN_WIDTH-1) * (results/CONVERSIONS)) / 2048);
+ /* Take the average of the readings */
+ x = results / CONVERSIONS;
return x;
}
@@ -89,13 +89,13 @@ static uint16_t _tpReadRealY(void) {
uint32_t results = 0;
uint16_t i, y;
+ /* Median filtering is already done in LLD */
for(i = 0; i < CONVERSIONS; i++) {
- tp_lld_read_y(); /* dummy, reduce noise on SPI */
results += tp_lld_read_y();
- }
+ }
- // 12-bit
- y = (((SCREEN_HEIGHT-1) * (results/CONVERSIONS)) / 2048);
+ /* Take the average of the readings */
+ y = results / CONVERSIONS;
return y;
}
@@ -135,7 +135,7 @@ static void _tpDrawCross(uint16_t x, uint16_t y) {
*
* @api
*/
-void tpInit(TOUCHPADDriver *tp) {
+void tpInit(const TOUCHPADDriver *tp) {
/* Initialise Mutex */
//MUTEX_INIT