From 9aa5be6c4c2ad5e455ea3f763ff886ac1350688f Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sun, 29 Oct 2006 13:49:43 +0000 Subject: [PATCH] H300: Slight simplification of adc_scan(), ported from X5. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11384 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/adc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/firmware/drivers/adc.c b/firmware/drivers/adc.c index 9e6ed19e4b..646509b8a8 100644 --- a/firmware/drivers/adc.c +++ b/firmware/drivers/adc.c @@ -112,20 +112,20 @@ void adc_init(void) static unsigned char adcdata[NUM_ADC_CHANNELS]; #ifdef IRIVER_H300_SERIES -static int channelnum[] = +static int adcc2_parms[] = { - 5, /* ADC_BUTTONS (ADCIN2) */ - 6, /* ADC_REMOTE (ADCIN3) */ - 0, /* ADC_BATTERY (BATVOLT, resistive divider) */ - 2, /* ADC_REMOTEDETECT (ADCIN1, resistive divider) */ + [ADC_BUTTONS] = 0x80 | (5 << 1) | 1, /* ADCIN2 */ + [ADC_REMOTE] = 0x80 | (6 << 1) | 1, /* ADCIN3 */ + [ADC_BATTERY] = 0x80 | (0 << 1) | 1, /* BATVOLT, resistive divider */ + [ADC_REMOTEDETECT] = 0x80 | (2 << 1) | 1, /* ADCIN1, resistive divider */ }; unsigned short adc_scan(int channel) { int level = set_irq_level(HIGHEST_IRQ_LEVEL); unsigned char data; - - pcf50606_write(0x2f, 0x80 | (channelnum[channel] << 1) | 1); + + pcf50606_write(0x2f, adcc2_parms[channel]); data = pcf50606_read(0x30); adcdata[channel] = data;