1
0
Fork 0
forked from len0rd/rockbox

Added debouncing to the Ondio button driver.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5115 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2004-09-23 22:36:15 +00:00
parent 7f7afe434b
commit 23f2a59865

View file

@ -458,6 +458,8 @@ void button_init(void)
static int button_read(void)
{
int btn = BUTTON_NONE;
int retval;
int data = adc_read(ADC_BUTTON_ROW1);
if(adc_read(ADC_BUTTON_OPTION) > 0x200) /* active high */
@ -475,7 +477,15 @@ static int button_read(void)
else if (data >= 0x0A1)
btn |= BUTTON_DOWN;
return btn;
/* Filter the button status. It is only accepted if we get the same
status twice in a row. */
if(btn != last_read)
retval = lastbtn;
else
retval = btn;
last_read = btn;
return retval;
}
#endif