diff options
author | Vic Yang <victoryang@chromium.org> | 2014-05-20 15:47:11 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-05-21 04:12:39 +0000 |
commit | 98d78db982f8e41278e9cd81eeb6075d2c1cfd1a (patch) | |
tree | a4cc87899059ddaef163ec0af4ea4a84dc5ecc23 | |
parent | 64e5cc33d99568c665d59040908b6d2452e9983f (diff) | |
download | chrome-ec-98d78db982f8e41278e9cd81eeb6075d2c1cfd1a.tar.gz |
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 <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/200673
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | board/keyborg/touch_scan.c | 12 |
1 files 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); |