From e087751b107982eeaa001e92c2dd1f24f1af6809 Mon Sep 17 00:00:00 2001 From: Karl Kurbjun Date: Sat, 12 Dec 2009 18:36:52 +0000 Subject: M:Robe 500: Fix FIQ's and make the audio DMA a FIQ, simplify the ADC code and make it more reliable. Fix ADC problems on initial boot. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23948 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/tsc2100.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'firmware/drivers') diff --git a/firmware/drivers/tsc2100.c b/firmware/drivers/tsc2100.c index 09017996dc..b8edb7d52d 100644 --- a/firmware/drivers/tsc2100.c +++ b/firmware/drivers/tsc2100.c @@ -28,9 +28,6 @@ /* adc_data contains the last readings from the tsc2100 */ static short adc_data[10]; static short adc_status; -static long adc_last_read=0; -static long adc_last_touch_read=0; -static long adc_last_volt_read=0; void tsc2100_read_data(void) { @@ -42,8 +39,6 @@ void tsc2100_read_data(void) adc_status|=tsc2100_readreg(TSSTAT_PAGE, TSSTAT_ADDRESS); - adc_last_read=current_tick; - spi_block_transfer(SPI_target_TSC2100, out, sizeof(out), (char *)adc_data, sizeof(adc_data)); @@ -54,11 +49,7 @@ void tsc2100_read_data(void) /* Read X, Y, Z1, Z2 touchscreen coordinates. */ bool tsc2100_read_touch(short *x, short* y, short *z1, short *z2) { - /* Note: This could cause problems if the current tick is not reset in ~1.3 - * years. Noting this in the event that a suspend/resume function - * is added. - */ - if( (adc_status&(3<<9)) && (adc_last_read - adc_last_touch_read>=0) ) { + if( adc_status&(3<<9) ) { *x = adc_data[0]; *y = adc_data[1]; *z1 = adc_data[2]; @@ -66,8 +57,6 @@ bool tsc2100_read_touch(short *x, short* y, short *z1, short *z2) adc_status&=~(3<<9); - adc_last_touch_read=current_tick; - return true; } else { return false; @@ -76,13 +65,12 @@ bool tsc2100_read_touch(short *x, short* y, short *z1, short *z2) bool tsc2100_read_volt(short *bat1, short *bat2, short *aux) { - if( (adc_status&(7<<4)) && TIME_BEFORE(adc_last_volt_read, adc_last_read)) { + if( adc_status&(7<<4) ) { *bat1 = adc_data[5]; *bat2 = adc_data[6]; *aux = adc_data[7]; adc_status&=~(7<<4); - adc_last_volt_read=current_tick; return true; } else { return false; @@ -110,7 +98,7 @@ void tsc2100_set_mode(bool poweron, unsigned char scan_mode) void tsc2100_adc_init(void) { /* Set the TSC2100 to read touchscreen */ - tsc2100_set_mode(true, 0x01); + tsc2100_set_mode(true, 0x02); tsc2100_writereg(TSSTAT_PAGE, TSSTAT_ADDRESS, (0x1<