diff options
author | Vic Yang <victoryang@chromium.org> | 2014-05-29 11:15:14 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-05-30 01:26:15 +0000 |
commit | fe4f1275b2f596dd5ebc8e5594176d6128b46b04 (patch) | |
tree | a4e5f1de5211b8ab930edcfb6bdd10e914c00baa | |
parent | cbb5aafc0edd9a3bcf93949673598068ff8280db (diff) | |
download | chrome-ec-fe4f1275b2f596dd5ebc8e5594176d6128b46b04.tar.gz |
Keyborg: improve panel discharge
This fix includes:
- A faster discharge procedure
- Added discharge steps between scanning two columns. This is to
prevent the shadow "wraps around" to the beginning of the next
column, which is much harder to filter out.
BUG=None
TEST=Press hard on the end of one column. Check the shadow doesn't wrap
around to the next column.
BRANCH=None
Change-Id: Ie1342f7778d0fe18a0ec2086af79d5e459f1cd7d
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/202073
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | board/keyborg/touch_scan.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/board/keyborg/touch_scan.c b/board/keyborg/touch_scan.c index 5e4044215b..b69ccfe33f 100644 --- a/board/keyborg/touch_scan.c +++ b/board/keyborg/touch_scan.c @@ -81,6 +81,18 @@ void touch_scan_init(void) mccr_list[i] = TS_PIN_TO_CR(col_pins[i]); } +static void discharge(void) +{ + int i; + + /* + * The value 20 is deducted from experiments. + * Somehow this needs to be in reverse order + */ + for (i = 20; i >= 0; --i) + STM32_PMSE_MRCR = mrcr_list[i]; +} + static void start_adc_sample(int id, int wait_cycle) { /* Clear EOC and STRT bit */ @@ -202,7 +214,7 @@ void touch_scan_slave_start(void) return; /* Discharge the panel */ - scan_column(buf[0]); + discharge(); for (col = 0; col < COL_COUNT * 2; ++col) { if (col < COL_COUNT) { @@ -239,10 +251,12 @@ void touch_scan_slave_start(void) /* Start sending the response for the current column */ spi_slave_send_response_async(resp); + /* Disable the current column and discharge */ if (col < COL_COUNT) { enable_col(col, 0); STM32_PMSE_MCCR = 0; } + discharge(); } spi_slave_send_response_flush(); master_slave_sync(20); @@ -268,7 +282,7 @@ int touch_scan_full_matrix(void) return EC_ERROR_UNKNOWN; /* Discharge the panel */ - scan_column(buf[0]); + discharge(); for (col = 0; col < COL_COUNT * 2; ++col) { if (col >= COL_COUNT) { @@ -306,10 +320,12 @@ int touch_scan_full_matrix(void) if (spi_master_wait_response_async() != EC_SUCCESS) return EC_ERROR_UNKNOWN; + /* Disable the current column and discharge */ if (col >= COL_COUNT) { enable_col(col - COL_COUNT, 0); STM32_PMSE_MCCR = 0; } + discharge(); } resp = spi_master_wait_response_done(); |