forked from len0rd/rockbox
SA9200: Implement clicker.
It's not integrated with key click option for now. Change-Id: Ib0769b02bfebe7c55eca7b7ea61df5d6dd83cdd3
This commit is contained in:
parent
3f2c525c57
commit
6bbfb35560
2 changed files with 19 additions and 0 deletions
|
@ -29,6 +29,19 @@
|
||||||
|
|
||||||
static int int_btn = BUTTON_NONE;
|
static int int_btn = BUTTON_NONE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generate a click sound from the player (not in headphones yet)
|
||||||
|
* TODO: integrate this with the "key click" option
|
||||||
|
*/
|
||||||
|
static void button_click(void)
|
||||||
|
{
|
||||||
|
GPIOF_ENABLE |= 0x08;
|
||||||
|
GPIOF_OUTPUT_VAL |= 0x08;
|
||||||
|
GPIOF_OUTPUT_EN |= 0x08;
|
||||||
|
udelay(1000);
|
||||||
|
GPIOF_OUTPUT_VAL &= ~0x08;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
static bool hold_button_old = false;
|
static bool hold_button_old = false;
|
||||||
|
|
||||||
|
@ -135,6 +148,7 @@ bool button_hold(void)
|
||||||
*/
|
*/
|
||||||
int button_read_device(void)
|
int button_read_device(void)
|
||||||
{
|
{
|
||||||
|
static int btn_old = BUTTON_NONE;
|
||||||
int btn = int_btn;
|
int btn = int_btn;
|
||||||
bool hold = !(GPIOL_INPUT_VAL & 0x40);
|
bool hold = !(GPIOL_INPUT_VAL & 0x40);
|
||||||
|
|
||||||
|
@ -154,6 +168,9 @@ int button_read_device(void)
|
||||||
if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_VOL_UP;
|
if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_VOL_UP;
|
||||||
if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN;
|
if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN;
|
||||||
|
|
||||||
|
if ((btn != btn_old) && (btn != BUTTON_NONE)) button_click();
|
||||||
|
btn_old = btn;
|
||||||
|
|
||||||
return btn;
|
return btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -489,6 +489,8 @@ void system_init(void)
|
||||||
DEV_RS = 0x00000000;
|
DEV_RS = 0x00000000;
|
||||||
DEV_RS2 = 0x00000000;
|
DEV_RS2 = 0x00000000;
|
||||||
#elif defined(PHILIPS_SA9200)
|
#elif defined(PHILIPS_SA9200)
|
||||||
|
DEV_INIT1 = 0x00000000;
|
||||||
|
DEV_INIT2 = 0x40004000;
|
||||||
/* reset all allowed devices */
|
/* reset all allowed devices */
|
||||||
DEV_RS = 0x3ffffef8;
|
DEV_RS = 0x3ffffef8;
|
||||||
DEV_RS2 = 0xffffffff;
|
DEV_RS2 = 0xffffffff;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue