mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-07 16:11:43 +00:00
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>
This commit is contained in:
committed by
chrome-internal-fetch
parent
cbb5aafc0e
commit
fe4f1275b2
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user