summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-09-10 02:00:40 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-09-10 02:00:40 +0000
commit3d2e10bcbd13ec48decafe49f32afcc12c5e185a (patch)
tree60c490e727a28fd2359c3d185cf2a4f5fd8c328b /firmware/target
parent24ca76ffec3e0d782f75ac1cca2c0b2c8b71f5db (diff)
downloadrockbox-3d2e10bcbd13ec48decafe49f32afcc12c5e185a.tar.gz
rockbox-3d2e10bcbd13ec48decafe49f32afcc12c5e185a.zip
Added remote backlight on hold option to players with remote hold switch. Disabled IRQs while reading pcf50606 ADC. This seems to have stopped buttons becoming unresponsive when using remote. Maybe fixes other button glitches as well?
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10911 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rwxr-xr-xfirmware/target/coldfire/iaudio/x5/adc-x5.c2
-rwxr-xr-xfirmware/target/coldfire/iaudio/x5/button-x5.c16
-rw-r--r--firmware/target/coldfire/iaudio/x5/pcf50606-x5.c2
3 files changed, 12 insertions, 8 deletions
diff --git a/firmware/target/coldfire/iaudio/x5/adc-x5.c b/firmware/target/coldfire/iaudio/x5/adc-x5.c
index e465f38494..fc45da8624 100755
--- a/firmware/target/coldfire/iaudio/x5/adc-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/adc-x5.c
@@ -35,6 +35,7 @@ static int channelnum[] =
35 35
36unsigned short adc_scan(int channel) 36unsigned short adc_scan(int channel)
37{ 37{
38 int level = set_irq_level(HIGHEST_IRQ_LEVEL);
38 unsigned char data; 39 unsigned char data;
39 40
40 pcf50606_write(0x2f, 0x80 | (channelnum[channel] << 1) | 1); 41 pcf50606_write(0x2f, 0x80 | (channelnum[channel] << 1) | 1);
@@ -42,6 +43,7 @@ unsigned short adc_scan(int channel)
42 43
43 adcdata[channel] = data; 44 adcdata[channel] = data;
44 45
46 set_irq_level(level);
45 return data; 47 return data;
46} 48}
47 49
diff --git a/firmware/target/coldfire/iaudio/x5/button-x5.c b/firmware/target/coldfire/iaudio/x5/button-x5.c
index 287ee0e92b..84d1dbc7d8 100755
--- a/firmware/target/coldfire/iaudio/x5/button-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/button-x5.c
@@ -41,7 +41,7 @@ bool button_hold(void)
41 41
42bool remote_button_hold(void) 42bool remote_button_hold(void)
43{ 43{
44 return false; /* TODO X5 */ 44 return adc_scan(ADC_REMOTE) < 0x17;
45} 45}
46 46
47int button_read_device(void) 47int button_read_device(void)
@@ -51,6 +51,7 @@ int button_read_device(void)
51 static bool hold_button = false; 51 static bool hold_button = false;
52 static bool remote_hold_button = false; 52 static bool remote_hold_button = false;
53 bool hold_button_old; 53 bool hold_button_old;
54 bool remote_hold_button_old;
54 55
55 /* normal buttons */ 56 /* normal buttons */
56 hold_button_old = hold_button; 57 hold_button_old = hold_button;
@@ -90,14 +91,15 @@ int button_read_device(void)
90 } 91 }
91 92
92 /* remote buttons */ 93 /* remote buttons */
93 94 remote_hold_button_old = remote_hold_button;
94 /* TODO: add light handling for the remote */
95
96 remote_hold_button = remote_button_hold();
97 95
98 data = adc_scan(ADC_REMOTE); 96 data = adc_scan(ADC_REMOTE);
99 if(data < 0x17) 97 remote_hold_button = data < 0x17;
100 remote_hold_button = true; 98
99#ifndef BOOTLOADER
100 if (remote_hold_button != remote_hold_button_old)
101 remote_backlight_hold_changed(remote_hold_button);
102#endif
101 103
102 if(!remote_hold_button) 104 if(!remote_hold_button)
103 { 105 {
diff --git a/firmware/target/coldfire/iaudio/x5/pcf50606-x5.c b/firmware/target/coldfire/iaudio/x5/pcf50606-x5.c
index dde20d8b7c..032c30814a 100644
--- a/firmware/target/coldfire/iaudio/x5/pcf50606-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/pcf50606-x5.c
@@ -177,7 +177,7 @@ void pcf50606_init(void)
177 and_l(~0x00000001, &GPIO_ENABLE); 177 and_l(~0x00000001, &GPIO_ENABLE);
178 or_l(0x00000001, &GPIO_FUNCTION); 178 or_l(0x00000001, &GPIO_FUNCTION);
179 or_l(0x00000100, &GPIO_INT_EN); /* GPI0 H-L */ 179 or_l(0x00000100, &GPIO_INT_EN); /* GPI0 H-L */
180 INTPRI5 |= 0x00000006; /* INT32 - Priority 6 */ 180 INTPRI5 |= (6 << 0); /* INT32 - Priority 6 */
181 181
182 pcf50606_write(0x39, 0x00); /* GPOOD0 = green led OFF */ 182 pcf50606_write(0x39, 0x00); /* GPOOD0 = green led OFF */
183 pcf50606_write(0x3a, 0x00); /* GPOOD1 = red led OFF */ 183 pcf50606_write(0x3a, 0x00); /* GPOOD1 = red led OFF */