From 08585e417b4e545752ff9478d28c4da3e8c09844 Mon Sep 17 00:00:00 2001 From: Mark Arigo Date: Fri, 12 Dec 2008 04:56:25 +0000 Subject: FS#9591 by Anton Veretenenko for the Philips GoGear HDD1620/1630 (with a few changes by me). Fixes boot problem, pixel format, sound, and a few other things. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19395 a1c6a512-1295-4272-9138-f99709370657 --- .../target/arm/philips/hdd1630/button-hdd1630.c | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'firmware/target/arm/philips/hdd1630/button-hdd1630.c') diff --git a/firmware/target/arm/philips/hdd1630/button-hdd1630.c b/firmware/target/arm/philips/hdd1630/button-hdd1630.c index 3a8f7c5408..84cb8f0c06 100755 --- a/firmware/target/arm/philips/hdd1630/button-hdd1630.c +++ b/firmware/target/arm/philips/hdd1630/button-hdd1630.c @@ -23,6 +23,21 @@ #include "button.h" #include "backlight.h" +/* Remember last buttons, to make single buzz sound */ +int btn_old; + +/* + * Generate a click sound from the player (not in headphones yet) + * TODO: integrate this with the "key click" option + */ +void button_click(void) +{ + GPO32_ENABLE |= 0x2000; + GPIOD_OUTPUT_VAL |= 0x8; + udelay(1000); + GPO32_VAL &= ~0x2000; +} + void button_init_device(void) { /* TODO...for now, hardware initialisation is done by the bootloader */ @@ -49,19 +64,33 @@ int button_read_device(void) /* device buttons */ if (!hold_button) { + /* These are the correct button definitions if (!(GPIOA_INPUT_VAL & 0x01)) btn |= BUTTON_MENU; if (!(GPIOA_INPUT_VAL & 0x02)) btn |= BUTTON_VOL_UP; if (!(GPIOA_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN; if (!(GPIOA_INPUT_VAL & 0x08)) btn |= BUTTON_VIEW; - if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_PLAYLIST; if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER; + */ + + /* This is a hack until the touchpad works */ + if (!(GPIOA_INPUT_VAL & 0x01)) btn |= BUTTON_LEFT; /* BUTTON_MENU */ + if (!(GPIOA_INPUT_VAL & 0x02)) btn |= BUTTON_UP; /* BUTTON_VOL_UP */ + if (!(GPIOA_INPUT_VAL & 0x04)) btn |= BUTTON_DOWN; /* BUTTON_VOL_DOWN */ + if (!(GPIOA_INPUT_VAL & 0x08)) btn |= BUTTON_RIGHT; /* BUTTON_VIEW */ + if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_SELECT; /* BUTTON_PLAYLIST */ + if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER; } + if ((btn != btn_old) && (btn != BUTTON_NONE)) + button_click(); + + btn_old = btn; + return btn; } bool headphones_inserted(void) { - return true; + return (GPIOE_INPUT_VAL & 0x80) ? true : false; } -- cgit v1.2.3