summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-11-18 23:23:47 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-11-18 23:23:47 +0000
commit003247e066f667bd829739eed138940c45a0569f (patch)
tree0c73fb08ce06367d8c127b2b69d1b050035ab449 /firmware
parent0decb0099eb5d87431f943f929b098cac1435ea5 (diff)
downloadrockbox-003247e066f667bd829739eed138940c45a0569f.tar.gz
rockbox-003247e066f667bd829739eed138940c45a0569f.tar.bz2
rockbox-003247e066f667bd829739eed138940c45a0569f.zip
Added iRiver ADC tick task
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5431 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/adc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/firmware/drivers/adc.c b/firmware/drivers/adc.c
index 4b11c7dbab..46890badd4 100644
--- a/firmware/drivers/adc.c
+++ b/firmware/drivers/adc.c
@@ -179,6 +179,17 @@ unsigned short adc_read(int channel)
return adcdata[channel];
}
+static int adc_counter;
+
+static void adc_tick(void)
+{
+ if(++adc_counter == HZ)
+ {
+ adc_counter = 0;
+ adcdata[ADC_BATTERY] = adc_scan(ADC_BATTERY);
+ }
+}
+
void adc_init(void)
{
GPIO_FUNCTION |= 0x80600080; /* GPIO7: CS
@@ -188,6 +199,10 @@ void adc_init(void)
GPIO_ENABLE |= 0x00600080;
GPIO_OUT |= 0x80; /* CS high */
GPIO_OUT &= ~0x00400000; /* CLK low */
+
+ tick_add_task(adc_tick);
+
+ adcdata[3] = adc_scan(3);
}
#endif