summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/iriver/h300/adc-h300.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/coldfire/iriver/h300/adc-h300.c')
-rw-r--r--firmware/target/coldfire/iriver/h300/adc-h300.c30
1 files changed, 0 insertions, 30 deletions
diff --git a/firmware/target/coldfire/iriver/h300/adc-h300.c b/firmware/target/coldfire/iriver/h300/adc-h300.c
index 140eafe0ab..77d7b4689f 100644
--- a/firmware/target/coldfire/iriver/h300/adc-h300.c
+++ b/firmware/target/coldfire/iriver/h300/adc-h300.c
@@ -24,8 +24,6 @@
24#include "adc.h" 24#include "adc.h"
25#include "pcf50606.h" 25#include "pcf50606.h"
26 26
27static unsigned char adcdata[NUM_ADC_CHANNELS];
28
29static int adcc2_parms[] = 27static int adcc2_parms[] =
30{ 28{
31 [ADC_BUTTONS] = 0x80 | (5 << 1) | 1, /* ADCIN2 */ 29 [ADC_BUTTONS] = 0x80 | (5 << 1) | 1, /* ADCIN2 */
@@ -42,34 +40,6 @@ unsigned short adc_scan(int channel)
42 pcf50606_write(0x2f, adcc2_parms[channel]); 40 pcf50606_write(0x2f, adcc2_parms[channel]);
43 data = pcf50606_read(0x30); 41 data = pcf50606_read(0x30);
44 42
45 adcdata[channel] = data;
46
47 set_irq_level(level); 43 set_irq_level(level);
48 return data; 44 return data;
49} 45}
50
51
52unsigned short adc_read(int channel)
53{
54 return adcdata[channel];
55}
56
57static int adc_counter;
58
59static void adc_tick(void)
60{
61 if(++adc_counter == HZ)
62 {
63 adc_counter = 0;
64 adc_scan(ADC_BATTERY);
65 adc_scan(ADC_REMOTEDETECT); /* Temporary. Remove when the remote
66 detection feels stable. */
67 }
68}
69
70void adc_init(void)
71{
72 adc_scan(ADC_BATTERY);
73
74 tick_add_task(adc_tick);
75}