diff options
author | Karl Kurbjun <kkurbjun@gmail.com> | 2009-04-28 05:07:25 +0000 |
---|---|---|
committer | Karl Kurbjun <kkurbjun@gmail.com> | 2009-04-28 05:07:25 +0000 |
commit | 57ca7ccf36728fec7096931a064adc0b0e212ae0 (patch) | |
tree | d97c3a9477eac4cf2c7d7a4e0602a0b772d5805f /firmware/target/arm/tms320dm320/mrobe-500/adc-mr500.c | |
parent | 4e747f1c5ccc98d99c24354c6fef0d6abf87d220 (diff) | |
download | rockbox-57ca7ccf36728fec7096931a064adc0b0e212ae0.tar.gz rockbox-57ca7ccf36728fec7096931a064adc0b0e212ae0.zip |
M:Robe 500: Rearrage TSC2100 reads to make touchscreen more reliable, add hack to get lcd_sleep working/called again, fix the panic handler so that it waits for the power button to be pressed instead of freezing the player
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20818 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/tms320dm320/mrobe-500/adc-mr500.c')
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/adc-mr500.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/adc-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/adc-mr500.c index 0a1389a226..da3e2e9f44 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/adc-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/adc-mr500.c | |||
@@ -23,27 +23,38 @@ | |||
23 | #include "adc.h" | 23 | #include "adc.h" |
24 | #include "adc-target.h" | 24 | #include "adc-target.h" |
25 | #include "kernel.h" | 25 | #include "kernel.h" |
26 | #include "tsc2100.h" | ||
27 | #include "button-target.h" | ||
26 | 28 | ||
27 | /* prototypes */ | 29 | void read_battery_inputs(void); |
28 | static void adc_tick(void); | ||
29 | 30 | ||
30 | void adc_init(void) | 31 | void adc_init(void) |
31 | { | 32 | { |
32 | /* attach the adc reading to the tick */ | 33 | /* Initialize the touchscreen and the battery readout */ |
33 | tick_add_task(adc_tick); | 34 | tsc2100_adc_init(); |
35 | |||
36 | /* Enable the tsc2100 interrupt */ | ||
37 | IO_INTC_EINT2 |= (1<<3); /* IRQ_GIO14 */ | ||
34 | } | 38 | } |
35 | 39 | ||
36 | /* Called to get the recent ADC reading */ | 40 | /* Touchscreen data available interupt */ |
37 | inline unsigned short adc_read(int channel) | 41 | void GIO14(void) |
38 | { | 42 | { |
39 | return (short)channel; | 43 | short tsadc = tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS); |
44 | short adscm = (tsadc&TSADC_ADSCM_MASK)>>TSADC_ADSCM_SHIFT; | ||
45 | |||
46 | /* Always read all registers in one go to clear any missed flags */ | ||
47 | tsc2100_read_data(); | ||
48 | |||
49 | switch (adscm) | ||
50 | { | ||
51 | case 1: | ||
52 | case 2: | ||
53 | touch_read_coord(); | ||
54 | break; | ||
55 | case 0x0B: | ||
56 | read_battery_inputs(); | ||
57 | break; | ||
58 | } | ||
59 | IO_INTC_IRQ2 = (1<<3); /* IRQ_GIO14 == 35 */ | ||
40 | } | 60 | } |
41 | |||
42 | /* add this to the tick so that the ADC converts are done in the background */ | ||
43 | static void adc_tick(void) | ||
44 | { | ||
45 | } | ||
46 | |||
47 | |||
48 | |||
49 | |||