From 3d2e10bcbd13ec48decafe49f32afcc12c5e185a Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sun, 10 Sep 2006 02:00:40 +0000 Subject: 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 --- firmware/target/coldfire/iaudio/x5/adc-x5.c | 2 ++ firmware/target/coldfire/iaudio/x5/button-x5.c | 16 +++++++++------- firmware/target/coldfire/iaudio/x5/pcf50606-x5.c | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'firmware/target/coldfire/iaudio') 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[] = 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); @@ -42,6 +43,7 @@ unsigned short adc_scan(int channel) adcdata[channel] = data; + set_irq_level(level); return data; } 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) bool remote_button_hold(void) { - return false; /* TODO X5 */ + return adc_scan(ADC_REMOTE) < 0x17; } int button_read_device(void) @@ -51,6 +51,7 @@ int button_read_device(void) static bool hold_button = false; static bool remote_hold_button = false; bool hold_button_old; + bool remote_hold_button_old; /* normal buttons */ hold_button_old = hold_button; @@ -90,14 +91,15 @@ int button_read_device(void) } /* remote buttons */ - - /* TODO: add light handling for the remote */ - - remote_hold_button = remote_button_hold(); + remote_hold_button_old = remote_hold_button; data = adc_scan(ADC_REMOTE); - if(data < 0x17) - remote_hold_button = true; + remote_hold_button = data < 0x17; + +#ifndef BOOTLOADER + if (remote_hold_button != remote_hold_button_old) + remote_backlight_hold_changed(remote_hold_button); +#endif if(!remote_hold_button) { 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) and_l(~0x00000001, &GPIO_ENABLE); or_l(0x00000001, &GPIO_FUNCTION); or_l(0x00000100, &GPIO_INT_EN); /* GPI0 H-L */ - INTPRI5 |= 0x00000006; /* INT32 - Priority 6 */ + INTPRI5 |= (6 << 0); /* INT32 - Priority 6 */ pcf50606_write(0x39, 0x00); /* GPOOD0 = green led OFF */ pcf50606_write(0x3a, 0x00); /* GPOOD1 = red led OFF */ -- cgit v1.2.3