From 13c63de2c128f4bb2307153815de7291479f77e3 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Fri, 17 Mar 2006 18:45:06 +0000 Subject: Iriver: Properly working remote type detection regardless of hold switch positions. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9079 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/lcd-h100-remote.c | 21 +++++++++++++-------- firmware/export/adc.h | 13 +++++++++++++ firmware/export/config-h100.h | 5 ----- firmware/export/config-h120.h | 5 ----- firmware/export/config-h300.h | 5 ----- 5 files changed, 26 insertions(+), 23 deletions(-) diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c index a6d584c3fb..58953f61b5 100644 --- a/firmware/drivers/lcd-h100-remote.c +++ b/firmware/drivers/lcd-h100-remote.c @@ -456,16 +456,21 @@ static void remote_tick(void) level = set_irq_level(HIGHEST_IRQ_LEVEL); val = adc_scan(ADC_REMOTEDETECT); set_irq_level(level); - - if(val < (ADCVAL_H100_LCD_REMOTE + 8)) - if(val < (ADCVAL_H300_LCD_REMOTE + 8)) - _remote_type = REMOTETYPE_H300_LCD; + if (val < ADCVAL_H300_LCD_REMOTE_HOLD) + if (val < ADCVAL_H300_LCD_REMOTE) + _remote_type = REMOTETYPE_H300_LCD; /* hold off */ else - _remote_type = REMOTETYPE_H100_LCD; + if (val < ADCVAL_H100_LCD_REMOTE) + _remote_type = REMOTETYPE_H100_LCD; /* hold off */ + else + _remote_type = REMOTETYPE_H300_LCD; /* hold on */ else - _remote_type = REMOTETYPE_H300_NONLCD; - - init_remote = true; + if (val < ADCVAL_H100_LCD_REMOTE_HOLD) + _remote_type = REMOTETYPE_H100_LCD; /* hold on, or no remote */ + else + _remote_type = REMOTETYPE_H300_NONLCD; /* hold doesn't matter */ + + init_remote = true; /* request init in scroll_thread */ } else diff --git a/firmware/export/adc.h b/firmware/export/adc.h index 40d6a6aaab..2f14e3cf48 100644 --- a/firmware/export/adc.h +++ b/firmware/export/adc.h @@ -44,6 +44,19 @@ #define ADC_REMOTEDETECT 3 #define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */ +/* ADC values for different remote control types */ +#ifdef IRIVER_H100_SERIES +#define ADCVAL_H300_LCD_REMOTE 0x5E +#define ADCVAL_H100_LCD_REMOTE 0x96 +#define ADCVAL_H300_LCD_REMOTE_HOLD 0xCC +#define ADCVAL_H100_LCD_REMOTE_HOLD 0xEA +#else /* H300 series */ +#define ADCVAL_H300_LCD_REMOTE 0x35 +#define ADCVAL_H100_LCD_REMOTE 0x54 +#define ADCVAL_H300_LCD_REMOTE_HOLD 0x72 +#define ADCVAL_H100_LCD_REMOTE_HOLD 0x83 +#endif + #elif defined(IRIVER_IFP7XX) #define NUM_ADC_CHANNELS 5 diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index d35a35bb60..bdbcce71a4 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h @@ -117,8 +117,3 @@ /* Define this if you can control the S/PDIF power */ #define HAVE_SPDIF_POWER #define SPDIF_POWER_INVERTED - -/* ADC values for different remote control types */ -#define ADCVAL_H100_LCD_REMOTE 0x6a -#define ADCVAL_H300_LCD_REMOTE 0x50 -#define ADCVAL_H300_NONLCD_REMOTE 0xfc diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index 8426940da8..aea6011e63 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h @@ -111,8 +111,3 @@ /* Define this if you can control the S/PDIF power */ #define HAVE_SPDIF_POWER - -/* ADC values for different remote control types */ -#define ADCVAL_H100_LCD_REMOTE 0x6a -#define ADCVAL_H300_LCD_REMOTE 0x50 -#define ADCVAL_H300_NONLCD_REMOTE 0xfc diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index 45d3265010..88feb9d649 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h @@ -113,9 +113,4 @@ /* define this if the unit can be powered or charged via USB */ #define HAVE_USB_POWER -/* ADC values for different remote control types */ -#define ADCVAL_H100_LCD_REMOTE 0x3c -#define ADCVAL_H300_LCD_REMOTE 0x2b -#define ADCVAL_H300_NONLCD_REMOTE 0x8e - #endif -- cgit v1.2.3