1
0
Fork 0
forked from len0rd/rockbox

adjustment for the Ondio: button driver has an Odio part, for now it has a Player layout. Some fixes in the app code were necessary to remove dependencies of LCD, keypad, this wasn't independent everywhere.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5055 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jörg Hohensohn 2004-09-10 10:51:54 +00:00
parent 6c1afd7a9e
commit 24c7c04899
11 changed files with 120 additions and 27 deletions

View file

@ -1233,7 +1233,7 @@ static bool view_runtime(void)
/* Wait for a key to be pushed */
key = button_get_w_tmo(HZ);
switch(key) {
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD) || defined(HAVE_ONDIO_KEYPAD)
case BUTTON_STOP | BUTTON_REL:
#elif HAVE_RECORDER_KEYPAD
case BUTTON_OFF | BUTTON_REL:
@ -1412,7 +1412,7 @@ static bool dbg_disk_info(void)
/* Wait for a key to be pushed */
key = button_get_w_tmo(HZ*5);
switch(key) {
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD) || defined(HAVE_ONDIO_KEYPAD)
case BUTTON_STOP | BUTTON_REL:
#else
case BUTTON_OFF | BUTTON_REL:

View file

@ -231,7 +231,7 @@ bool show_info(void)
/* Wait for a key to be pushed */
key = button_get_w_tmo(HZ*5);
switch(key) {
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD) || defined(HAVE_ONDIO_KEYPAD)
case BUTTON_STOP | BUTTON_REL:
#else
case BUTTON_LEFT | BUTTON_REL:
@ -240,7 +240,7 @@ bool show_info(void)
done = true;
break;
#ifdef HAVE_PLAYER_KEYPAD
#if defined(HAVE_RECORDER_KEYPAD) || defined(HAVE_ONDIO_KEYPAD)
case BUTTON_LEFT:
case BUTTON_RIGHT:
if (state == 1)

View file

@ -557,7 +557,7 @@ static int add_directory_to_playlist(struct playlist_info* playlist,
for (i=0; i<num_files; i++)
{
/* user abort */
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD) || defined(HAVE_ONDIO_KEYPAD)
if (button_get(false) == BUTTON_STOP)
#else
if (button_get(false) == BUTTON_OFF)
@ -2009,7 +2009,7 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename,
while ((max = read_line(fd, temp_buf, sizeof(temp_buf))) > 0)
{
/* user abort */
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD) || defined(HAVE_ONDIO_KEYPAD)
if (button_get(false) == BUTTON_STOP)
#else
if (button_get(false) == BUTTON_OFF)
@ -2377,7 +2377,7 @@ int playlist_save(struct playlist_info* playlist, char *filename)
int seek;
/* user abort */
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD) || defined(HAVE_ONDIO_KEYPAD)
if (button_get(false) == BUTTON_STOP)
#else
if (button_get(false) == BUTTON_OFF)

View file

@ -1085,10 +1085,12 @@ bool set_time_screen(const char* string, struct tm *tm)
case BUTTON_ON:
done = true;
break;
#if (BUTTON_ON != BUTTON_OFF)
case BUTTON_OFF:
done = true;
tm->tm_year = -1;
break;
#endif
default:
if (default_event_handler(button) == SYS_USB_CONNECTED)

View file

@ -1266,7 +1266,7 @@ static bool disk_settings_menu(void)
return result;
}
#ifdef HAVE_LCD_BITMAP
#ifdef HAVE_RTC
static bool time_settings_menu(void)
{
int m;

View file

@ -94,7 +94,7 @@ bool sleeptimer_screen(void)
done = true;
break;
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD) || defined(HAVE_ONDIO_KEYPAD)
case BUTTON_RIGHT:
#else
case BUTTON_UP:
@ -113,7 +113,7 @@ bool sleeptimer_screen(void)
set_sleep_timer(newtime);
break;
#ifdef HAVE_PLAYER_KEYPAD
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_ONDIO_KEYPAD)
case BUTTON_LEFT:
#else
case BUTTON_DOWN:

View file

@ -61,7 +61,7 @@ static struct mp3entry* id3 = NULL;
static struct mp3entry* nid3 = NULL;
static char current_track_path[MAX_PATH+1];
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD)
#if defined(HAVE_PLAYER_KEYPAD) || defined(HAVE_NEO_KEYPAD) || defined(HAVE_ONDIO_KEYPAD)
void player_change_volume(int button)
{
bool exit = false;
@ -577,9 +577,11 @@ static bool menu(void)
/* show id3 tags */
#ifdef BUTTON_ON
case BUTTON_MENU | BUTTON_ON:
#ifdef HAVE_LCD_CHARCELLS
status_set_param(true);
status_set_audio(true);
#endif
#endif
#else
case BUTTON_F1 | BUTTON_ON:
#endif
@ -811,8 +813,10 @@ int wps_show(void)
case 0:
/* otherwise, exit to browser */
#else
#ifdef HAVE_LCD_CHARCELLS
status_set_record(false);
status_set_audio(false);
#endif
#endif
lcd_stop_scroll();

View file

@ -36,7 +36,7 @@
struct event_queue button_queue;
static int lastbtn;
#ifdef HAVE_RECORDER_KEYPAD
#if defined(HAVE_RECORDER_KEYPAD) || defined(HAVE_ONDIO_KEYPAD)
static bool flipped; /* bottons can be flipped to match the LCD flip */
#endif
@ -337,7 +337,7 @@ static int button_read(void)
return btn;
}
#elif HAVE_PLAYER_KEYPAD
#elif defined(HAVE_PLAYER_KEYPAD)
/* The player has two buttons on port pins:
@ -386,7 +386,7 @@ static int button_read(void)
return btn;
}
#elif HAVE_NEO_KEYPAD
#elif defined(HAVE_NEO_KEYPAD)
static bool mStation = false;
void button_init(void)
{
@ -421,6 +421,90 @@ int button_add(unsigned int button)
queue_post(&button_queue,button,NULL);
return 1;
}
#elif defined HAVE_ONDIO_KEYPAD
/*
* helper function to swap UP/DOWN, LEFT/RIGHT
*/
static int button_flip(int button)
{
int newbutton;
newbutton = button &
~(BUTTON_UP | BUTTON_DOWN
| BUTTON_LEFT | BUTTON_RIGHT);
if (button & BUTTON_UP)
newbutton |= BUTTON_DOWN;
if (button & BUTTON_DOWN)
newbutton |= BUTTON_UP;
if (button & BUTTON_LEFT)
newbutton |= BUTTON_RIGHT;
if (button & BUTTON_RIGHT)
newbutton |= BUTTON_LEFT;
return newbutton;
}
/*
* set the flip attribute
* better only call this when the queue is empty
*/
void button_set_flip(bool flip)
{
if (flip != flipped) /* not the current setting */
{
/* avoid race condition with the button_tick() */
int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
lastbtn = button_flip(lastbtn);
flipped = flip;
set_irq_level(oldlevel);
}
}
/* The Ondio its 6 buttons on analog inputs:
OPTION: AN2 (used as MENU for now)
ON/OFF: AN3
LEFT/RIGHT/UP/DOWN: AN4
We map them like the player keys for now, although this is far from optimal.
*/
void button_init(void)
{
queue_init(&button_queue);
lastbtn = 0;
tick_add_task(button_tick);
reset_poweroff_timer();
}
static int button_read(void)
{
int btn = BUTTON_NONE;
int data = adc_read(4);
if(adc_read(2) > 0x180) /* active high */
btn |= BUTTON_MENU;
if(adc_read(3) < 0x180) /* active low */
btn |= BUTTON_ON;
if(adc_read(3) < 0x180)
btn |= BUTTON_PLAY | BUTTON_UP;
/* Check the 4 direction keys, hard-coded analog limits for now */
if (data >= 0x2E5)
btn |= BUTTON_LEFT;
else if (data >= 0x23F)
btn |= BUTTON_RIGHT;
else if (data >= 0x197)
btn |= BUTTON_PLAY | BUTTON_UP;
else if (data >= 0x0A1)
btn |= BUTTON_STOP | BUTTON_DOWN;
return btn;
}
#endif
int button_status(void)

View file

@ -30,7 +30,7 @@ int button_get (bool block);
int button_get_w_tmo(int ticks);
int button_status(void);
void button_clear_queue(void);
#ifdef HAVE_RECORDER_KEYPAD
#if defined(HAVE_RECORDER_KEYPAD) || defined(HAVE_ONDIO_KEYPAD)
void button_set_flip(bool flip); /* turn 180 degrees */
#endif
@ -108,14 +108,23 @@ void button_set_flip(bool flip); /* turn 180 degrees */
#define BUTTON_F2 0x0200
#define BUTTON_F3 0x0400
#elif HAVE_PLAYER_KEYPAD
#elif defined(HAVE_PLAYER_KEYPAD)
/* Jukebox 6000 and Studio specific button codes */
#define BUTTON_MENU 0x0002
#define BUTTON_PLAY BUTTON_UP
#define BUTTON_STOP BUTTON_DOWN
#endif /* HAVE_PLAYER_KEYPAD */
#elif defined HAVE_ONDIO_KEYPAD
/* Ondio specific button codes */
#define BUTTON_MENU 0x0002
#define BUTTON_PLAY BUTTON_UP
#define BUTTON_STOP BUTTON_DOWN
/* ON is also interpreted as OFF, let's see if that helps a bit */
#define BUTTON_OFF BUTTON_ON
#endif /* HAVE_RECORDER/PLAYER/ONDIO_KEYPAD */
#endif /* HAVE_NEO_KEYPAD */

View file

@ -4,11 +4,8 @@
/* define this if you have a bitmap LCD display */
#define HAVE_LCD_BITMAP 1
/* define this if you have a Recorder style 10-key keyboard */
#define HAVE_RECORDER_KEYPAD 0
/* define this if you have a real-time clock */
#define HAVE_RTC 0
/* define this if you have an Ondio style 6-key keyboard */
#define HAVE_ONDIO_KEYPAD
/* Define this if you have a MAS3587F */
#define HAVE_MAS3587F

View file

@ -4,11 +4,8 @@
/* define this if you have a bitmap LCD display */
#define HAVE_LCD_BITMAP 1
/* define this if you have a Recorder style 10-key keyboard */
#define HAVE_RECORDER_KEYPAD 0
/* define this if you have a real-time clock */
#define HAVE_RTC 0
/* define this if you have an Ondio style 6-key keyboard */
#define HAVE_ONDIO_KEYPAD
/* Define this if you have a MAS3587F */
#define HAVE_MAS3587F