diff options
author | Barry Wardell <rockbox@barrywardell.net> | 2006-09-04 20:09:17 +0000 |
---|---|---|
committer | Barry Wardell <rockbox@barrywardell.net> | 2006-09-04 20:09:17 +0000 |
commit | a27c1833aa52c66b6df73b803cf372c5652ffaca (patch) | |
tree | 51500a5248c5e81e2116a3db1cc27d400ea79018 /firmware/target | |
parent | e9bf85935b2cce1fd71b03ecf3f3b2aa663cc3b6 (diff) |
Basic support for the H10 scrollpad.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10882 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/iriver/h10/button-h10.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/firmware/target/arm/iriver/h10/button-h10.c b/firmware/target/arm/iriver/h10/button-h10.c index 340f51c34c..cd28e25c71 100644 --- a/firmware/target/arm/iriver/h10/button-h10.c +++ b/firmware/target/arm/iriver/h10/button-h10.c @@ -33,7 +33,9 @@ void button_init_device(void) { - /* No hardware initialisation required as it is done by the bootloader */ + /* We need to output to pin 6 of GPIOD when reading the scroll pad value */ + GPIOD_OUTPUT_EN |= 0x40; + GPIOD_OUTPUT_VAL |= 0x40; } bool button_hold(void) @@ -73,10 +75,21 @@ int button_read_device(void) if (GPIOB_INPUT_VAL & 0x1) btn |= BUTTON_POWER; /* Read scroller */ - if ( (GPIOC_INPUT_VAL & 0x8) && (GPIOD_INPUT_VAL & 0x20) ) + if ( GPIOD_INPUT_VAL & 0x20 ) { - /* Scroller is pressed */ - btn |= BUTTON_SCROLL_DOWN; + int scroll_pos; + + GPIOD_OUTPUT_VAL &=~ 0x40; + udelay(50); + scroll_pos = adc_scan(ADC_SCROLLPAD); + GPIOD_OUTPUT_VAL |= 0x40; + + if(scroll_pos < 0x210) + { + btn |= BUTTON_SCROLL_DOWN; + } else { + btn |= BUTTON_SCROLL_UP; + } } } |