diff options
author | Vic Yang <victoryang@chromium.org> | 2014-05-20 11:17:08 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-05-21 04:07:54 +0000 |
commit | 724cfbc6c4fcec3608db9ec2ef9ad946b7d7e201 (patch) | |
tree | fec967ed4683a5e30d34797c40aa5616ed6fa1f4 | |
parent | 9e2fac8390051c9bc4166963a4da46e81ed3864b (diff) | |
download | chrome-ec-724cfbc6c4fcec3608db9ec2ef9ad946b7d7e201.tar.gz |
Keyborg: fix bug in slave data processing
This fixes two bugs:
- The row order on the slave is reversed
- The last value is missed when transferring data to the master
BUG=None
TEST=Build and check the heatmap
BRANCH=None
Change-Id: Ic51ad1132d948ec6ec68dc673288ec6f29c6ebe7
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/200621
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | board/keyborg/touch_scan.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/board/keyborg/touch_scan.c b/board/keyborg/touch_scan.c index 9ea947eb43..3b3a7a84f1 100644 --- a/board/keyborg/touch_scan.c +++ b/board/keyborg/touch_scan.c @@ -140,7 +140,7 @@ void scan_column(uint8_t *data) void touch_scan_slave_start(void) { - int col, i; + int col, i, v; struct spi_comm_packet *resp = (struct spi_comm_packet *)buf; for (col = 0; col < COL_COUNT * 2; ++col) { @@ -155,10 +155,17 @@ void touch_scan_slave_start(void) scan_column(resp->data); resp->cmd_sts = EC_SUCCESS; + /* Reverse the scanned data */ + for (i = 0; ROW_COUNT - 1 - i > i; ++i) { + v = resp->data[i]; + resp->data[i] = resp->data[ROW_COUNT - 1 - i]; + 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; + resp->size = i + 1; /* Flush the last response */ if (col != 0) |