From 98d78db982f8e41278e9cd81eeb6075d2c1cfd1a Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Tue, 20 May 2014 15:47:11 -0700 Subject: [PATCH] Keyborg: do not trim response before sending back to master ADC sampling is slower than SPI communication. If we spend more CPU cycle trimming the response, we are just wasting time and letting SPI bus sit idle. BUG=None TEST=Build and boot. Check scanning rate. BRANCH=None Change-Id: I9a4ece28a29ffd3205931ea71958cbc73642be6b Signed-off-by: Vic Yang Reviewed-on: https://chromium-review.googlesource.com/200673 Reviewed-by: Vincent Palatin --- board/keyborg/touch_scan.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/board/keyborg/touch_scan.c b/board/keyborg/touch_scan.c index 5cc3f25a05..6441899272 100644 --- a/board/keyborg/touch_scan.c +++ b/board/keyborg/touch_scan.c @@ -162,10 +162,7 @@ void touch_scan_slave_start(void) resp->data[ROW_COUNT - 1 - i] = v; } - /* Trim trailing zeros. */ - for (i = 0; i < ROW_COUNT; ++i) - if (resp->data[i] >= THRESHOLD) - resp->size = i + 1; + resp->size = ROW_COUNT; /* Flush the last response */ if (col != 0) @@ -220,9 +217,7 @@ int touch_scan_full_matrix(void) resp = spi_master_wait_response_done(); if (resp == NULL) return EC_ERROR_UNKNOWN; - memcpy(last_dptr, resp->data, resp->size); - memset(last_dptr + resp->size, 0, - ROW_COUNT - resp->size); + memcpy(last_dptr, resp->data, ROW_COUNT); encode_add_column(last_dptr); } @@ -242,8 +237,7 @@ int touch_scan_full_matrix(void) resp = spi_master_wait_response_done(); if (resp == NULL) return EC_ERROR_UNKNOWN; - memcpy(last_dptr, resp->data, resp->size); - memset(last_dptr + resp->size, 0, ROW_COUNT - resp->size); + memcpy(last_dptr, resp->data, ROW_COUNT); encode_add_column(last_dptr); master_slave_sync(20);