forked from len0rd/rockbox
iRiver: added support for hold-button on main unit and remote control
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6320 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e5e08c7ee5
commit
ed0c8764c4
4 changed files with 92 additions and 56 deletions
|
@ -37,6 +37,9 @@
|
||||||
#include "powermgmt.h"
|
#include "powermgmt.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
#if CONFIG_KEYPAD == IRIVER_H100_PAD
|
||||||
|
#include "button.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
static enum playmode ff_mode;
|
static enum playmode ff_mode;
|
||||||
|
|
||||||
|
@ -157,7 +160,11 @@ void status_draw(bool force_redraw)
|
||||||
info.hour = tm->tm_hour;
|
info.hour = tm->tm_hour;
|
||||||
info.minute = tm->tm_min;
|
info.minute = tm->tm_min;
|
||||||
info.shuffle = global_settings.playlist_shuffle;
|
info.shuffle = global_settings.playlist_shuffle;
|
||||||
|
#if CONFIG_KEYPAD == IRIVER_H100_PAD
|
||||||
|
info.keylock = button_hold();
|
||||||
|
#else
|
||||||
info.keylock = keys_locked;
|
info.keylock = keys_locked;
|
||||||
|
#endif
|
||||||
info.repeat = global_settings.repeat_mode;
|
info.repeat = global_settings.repeat_mode;
|
||||||
info.playmode = current_playmode();
|
info.playmode = current_playmode();
|
||||||
#ifndef HAVE_LED
|
#ifndef HAVE_LED
|
||||||
|
|
|
@ -105,3 +105,4 @@ Tony Motakis
|
||||||
Andy Young
|
Andy Young
|
||||||
Alexandre Bourget
|
Alexandre Bourget
|
||||||
Richard S. La Charité III
|
Richard S. La Charité III
|
||||||
|
Christian Gmeiner
|
||||||
|
|
|
@ -356,6 +356,24 @@ static int button_read(void)
|
||||||
|
|
||||||
#if CONFIG_KEYPAD == IRIVER_H100_PAD
|
#if CONFIG_KEYPAD == IRIVER_H100_PAD
|
||||||
|
|
||||||
|
static bool hold_button = false;
|
||||||
|
static bool remote_hold_button = false;
|
||||||
|
|
||||||
|
/* light handling */
|
||||||
|
if (hold_button && !button_hold())
|
||||||
|
{
|
||||||
|
backlight_on();
|
||||||
|
}
|
||||||
|
if (remote_hold_button && !remote_button_hold())
|
||||||
|
{
|
||||||
|
remote_backlight_on();
|
||||||
|
}
|
||||||
|
hold_button = button_hold();
|
||||||
|
remote_hold_button = remote_button_hold();
|
||||||
|
|
||||||
|
/* normal buttons */
|
||||||
|
if (!button_hold())
|
||||||
|
{
|
||||||
data = adc_scan(ADC_BUTTONS);
|
data = adc_scan(ADC_BUTTONS);
|
||||||
|
|
||||||
if (data < 0x80)
|
if (data < 0x80)
|
||||||
|
@ -381,7 +399,11 @@ static int button_read(void)
|
||||||
else
|
else
|
||||||
if (data < 0xf0)
|
if (data < 0xf0)
|
||||||
btn = BUTTON_REC;
|
btn = BUTTON_REC;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* remote buttons */
|
||||||
|
if (!remote_button_hold())
|
||||||
|
{
|
||||||
data = adc_scan(ADC_REMOTE);
|
data = adc_scan(ADC_REMOTE);
|
||||||
|
|
||||||
if (data < 0x74)
|
if (data < 0x74)
|
||||||
|
@ -413,13 +435,18 @@ static int button_read(void)
|
||||||
else
|
else
|
||||||
if (data < 0xf0)
|
if (data < 0xf0)
|
||||||
btn = BUTTON_RC_REW;
|
btn = BUTTON_RC_REW;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* special buttons */
|
||||||
|
if (!button_hold())
|
||||||
|
{
|
||||||
data = GPIO1_READ;
|
data = GPIO1_READ;
|
||||||
if ((data & 0x20) == 0)
|
if ((data & 0x20) == 0)
|
||||||
btn |= BUTTON_ON;
|
btn |= BUTTON_ON;
|
||||||
|
|
||||||
if ((data & 0x40) == 0)
|
if ((data & 0x40) == 0)
|
||||||
btn |= BUTTON_RC_ON;
|
btn |= BUTTON_RC_ON;
|
||||||
|
}
|
||||||
|
|
||||||
#elif CONFIG_KEYPAD == RECORDER_PAD
|
#elif CONFIG_KEYPAD == RECORDER_PAD
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ void button_set_flip(bool flip); /* turn 180 degrees */
|
||||||
|
|
||||||
#if CONFIG_KEYPAD == IRIVER_H100_PAD
|
#if CONFIG_KEYPAD == IRIVER_H100_PAD
|
||||||
bool button_hold(void);
|
bool button_hold(void);
|
||||||
|
bool remote_button_hold(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BUTTON_NONE 0x0000
|
#define BUTTON_NONE 0x0000
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue