M:Robe 500: Start of proper remote support, touchscreen works without remote now.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20684 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
9f19f33c41
commit
5449b1ed1d
|
@ -182,9 +182,11 @@ MENUITEM_SETTING(remote_contrast,
|
|||
&global_settings.remote_contrast, NULL);
|
||||
MENUITEM_SETTING(remote_invert,
|
||||
&global_settings.remote_invert, NULL);
|
||||
|
||||
|
||||
#ifdef HAVE_LCD_FLIP
|
||||
MENUITEM_SETTING(remote_flip_display,
|
||||
&global_settings.remote_flip_display, flipdisplay_callback);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REMOTE_LCD_TICKING
|
||||
static int ticking_callback(int action,const struct menu_item_ex *this_item)
|
||||
|
@ -212,7 +214,11 @@ MAKE_MENU(lcd_remote_settings, ID2P(LANG_LCD_REMOTE_MENU),
|
|||
&remote_backlight_on_button_hold,
|
||||
#endif
|
||||
&remote_caption_backlight, &remote_bl_filter_first_keypress,
|
||||
&remote_contrast, &remote_invert, &remote_flip_display
|
||||
&remote_contrast, &remote_invert
|
||||
|
||||
#ifdef HAVE_LCD_FLIP
|
||||
,&remote_flip_display
|
||||
#endif
|
||||
#ifdef HAVE_REMOTE_LCD_TICKING
|
||||
,&remote_reduce_ticking
|
||||
#endif
|
||||
|
|
|
@ -59,6 +59,15 @@ const struct button_mapping remote_directions[] =
|
|||
{ PLA_DOWN_REPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
|
||||
{ PLA_LEFT_REPEAT, BUTTON_RC_LEFT|BUTTON_REPEAT, BUTTON_NONE},
|
||||
{ PLA_RIGHT_REPEAT, BUTTON_RC_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
|
||||
#elif (CONFIG_REMOTE_KEYPAD == MROBE_REMOTE)
|
||||
{ PLA_UP, BUTTON_RC_PLAY, BUTTON_NONE},
|
||||
{ PLA_DOWN, BUTTON_RC_DOWN, BUTTON_NONE},
|
||||
{ PLA_LEFT, BUTTON_RC_REW, BUTTON_NONE},
|
||||
{ PLA_RIGHT, BUTTON_RC_FF, BUTTON_NONE},
|
||||
{ PLA_UP_REPEAT, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE},
|
||||
{ PLA_DOWN_REPEAT, BUTTON_RC_DOWN|BUTTON_REPEAT, BUTTON_NONE},
|
||||
{ PLA_LEFT_REPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE},
|
||||
{ PLA_RIGHT_REPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE},
|
||||
#else
|
||||
#error pluginlib_actions: Unsupported remote keypad
|
||||
#endif
|
||||
|
|
|
@ -122,10 +122,6 @@ const unsigned char rockbox16x7[] = {
|
|||
|
||||
#elif CONFIG_KEYPAD == MROBE500_PAD
|
||||
#define LP_QUIT BUTTON_POWER
|
||||
#define LP_DEC_X BUTTON_LEFT
|
||||
#define LP_INC_X BUTTON_RIGHT
|
||||
#define LP_DEC_Y BUTTON_RC_DOWN
|
||||
#define LP_INC_Y BUTTON_RC_PLAY
|
||||
|
||||
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
|
||||
#define LP_QUIT BUTTON_BACK
|
||||
|
@ -191,7 +187,15 @@ const unsigned char rockbox16x7[] = {
|
|||
#define LP_R_INC_X BUTTON_RC_FF
|
||||
#define LP_R_DEC_Y BUTTON_RC_SOURCE
|
||||
#define LP_R_INC_Y BUTTON_RC_BITRATE
|
||||
|
||||
#elif (CONFIG_REMOTE_KEYPAD==MROBE_REMOTE)
|
||||
#define LP_R_QUIT BUTTON_RC_HEART
|
||||
#define LP_R_DEC_X BUTTON_RC_REW
|
||||
#define LP_R_INC_X BUTTON_RC_FF
|
||||
#define LP_R_DEC_Y BUTTON_RC_DOWN
|
||||
#define LP_R_INC_Y BUTTON_RC_PLAY
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_REMOTE_KEYPAD */
|
||||
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
|
|
|
@ -68,6 +68,7 @@ static bool abort;
|
|||
|
||||
#elif CONFIG_KEYPAD == MROBE500_PAD
|
||||
#define STATS_STOP BUTTON_POWER
|
||||
#define STATS_STOP_REMOTE BUTTON_RC_DOWN
|
||||
|
||||
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
|
||||
#define STATS_STOP BUTTON_BACK
|
||||
|
|
|
@ -742,7 +742,11 @@ void settings_apply(bool read_disk)
|
|||
#ifdef HAVE_REMOTE_LCD
|
||||
lcd_remote_set_contrast(global_settings.remote_contrast);
|
||||
lcd_remote_set_invert_display(global_settings.remote_invert);
|
||||
|
||||
#ifdef HAVE_LCD_FLIP
|
||||
lcd_remote_set_flip(global_settings.remote_flip_display);
|
||||
#endif
|
||||
|
||||
lcd_remote_scroll_speed(global_settings.remote_scroll_speed);
|
||||
lcd_remote_scroll_step(global_settings.remote_scroll_step);
|
||||
lcd_remote_scroll_delay(global_settings.remote_scroll_delay);
|
||||
|
|
|
@ -89,13 +89,21 @@
|
|||
#define HAVE_LCD_SLEEP
|
||||
|
||||
/* remote LCD */
|
||||
//#define HAVE_REMOTE_LCD
|
||||
#define HAVE_REMOTE_LCD
|
||||
#define LCD_REMOTE_WIDTH 79
|
||||
#define LCD_REMOTE_HEIGHT 16
|
||||
#define LCD_REMOTE_HEIGHT 64
|
||||
#define LCD_REMOTE_DEPTH 1
|
||||
|
||||
/* Remote display colours, for screenshots and sim (0xRRGGBB) */
|
||||
#define LCD_REMOTE_DARKCOLOR 0x000000
|
||||
#define LCD_REMOTE_BRIGHTCOLOR 0x5a915a
|
||||
#define LCD_REMOTE_BL_DARKCOLOR 0x000000
|
||||
#define LCD_REMOTE_BL_BRIGHTCOLOR 0x82b4fa
|
||||
|
||||
#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING
|
||||
|
||||
#define CONFIG_REMOTE_KEYPAD MROBE_REMOTE
|
||||
|
||||
#define MIN_REMOTE_CONTRAST_SETTING 0
|
||||
#define MAX_REMOTE_CONTRAST_SETTING 15
|
||||
#define DEFAULT_REMOTE_CONTRAST_SETTING 7
|
||||
|
|
|
@ -114,6 +114,7 @@
|
|||
#define H100_REMOTE 1
|
||||
#define H300_REMOTE 2
|
||||
#define X5_REMOTE 3
|
||||
#define MROBE_REMOTE 4
|
||||
|
||||
/* CONFIG_BACKLIGHT_FADING */
|
||||
/* No fading capabilities at all (yet) */
|
||||
|
|
|
@ -128,12 +128,6 @@ inline bool button_hold(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
static void remote_heartbeat(void)
|
||||
{
|
||||
char data[5] = {0x11, 0x30, 0x11^0x30, 0x11+0x30, '\0'};
|
||||
uart1_puts(data, 5);
|
||||
}
|
||||
|
||||
#define TOUCH_MARGIN 8
|
||||
char r_buffer[5];
|
||||
int r_button = BUTTON_NONE;
|
||||
|
@ -142,13 +136,14 @@ int button_read_device(int *data)
|
|||
int retval, calbuf;
|
||||
static int oldbutton = BUTTON_NONE;
|
||||
|
||||
static long last_touch = 0;
|
||||
|
||||
r_button=BUTTON_NONE;
|
||||
*data = 0;
|
||||
|
||||
if (touch_available)
|
||||
{
|
||||
short x,y;
|
||||
static long last_touch = 0;
|
||||
bool send_touch = false;
|
||||
tsc2100_read_values(&x, &y, &last_z1, &last_z2);
|
||||
if (TIME_BEFORE(last_touch + HZ/5, current_tick))
|
||||
|
@ -175,7 +170,14 @@ int button_read_device(int *data)
|
|||
last_touch = current_tick;
|
||||
touch_available = false;
|
||||
}
|
||||
remote_heartbeat();
|
||||
else
|
||||
{
|
||||
/* Touch hasn't happened in a while, clear the bits */
|
||||
if(last_touch+3>current_tick)
|
||||
{
|
||||
oldbutton&=(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
if ((IO_GIO_BITSET0&0x01) == 0)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,287 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id: $
|
||||
*
|
||||
* Copyright (C) 2009 Karl Kurbjun
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "file.h"
|
||||
#include "lcd-remote.h"
|
||||
#include "adc.h"
|
||||
#include "scroll_engine.h"
|
||||
#include "uart-target.h"
|
||||
|
||||
static enum remote_control_states
|
||||
{
|
||||
REMOTE_CONTROL_IDLE,
|
||||
REMOTE_CONTROL_NOP,
|
||||
REMOTE_CONTROL_POWER,
|
||||
REMOTE_CONTROL_MASK,
|
||||
REMOTE_CONTROL_DRAW1,
|
||||
REMOTE_CONTROL_DRAW_PAUSE1,
|
||||
REMOTE_CONTROL_DRAW2,
|
||||
REMOTE_CONTROL_DRAW_PAUSE2,
|
||||
REMOTE_CONTROL_SLEEP
|
||||
} remote_state_control = REMOTE_CONTROL_NOP;
|
||||
|
||||
bool remote_initialized=true;
|
||||
|
||||
unsigned char remote_contrast=DEFAULT_REMOTE_CONTRAST_SETTING;
|
||||
unsigned char remote_power=0x00;
|
||||
|
||||
/*** hardware configuration ***/
|
||||
|
||||
int lcd_remote_default_contrast(void)
|
||||
{
|
||||
return DEFAULT_REMOTE_CONTRAST_SETTING;
|
||||
}
|
||||
|
||||
void lcd_remote_sleep(void)
|
||||
{
|
||||
remote_state_control=REMOTE_CONTROL_SLEEP;
|
||||
}
|
||||
|
||||
void lcd_remote_powersave(bool on)
|
||||
{
|
||||
if(on)
|
||||
{
|
||||
remote_power|=0xC0;
|
||||
remote_state_control=REMOTE_CONTROL_POWER;
|
||||
}
|
||||
else
|
||||
{
|
||||
remote_power&=~(0xC0);
|
||||
remote_state_control=REMOTE_CONTROL_POWER;
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_remote_set_contrast(int val)
|
||||
{
|
||||
remote_contrast=(char)val;
|
||||
remote_state_control=REMOTE_CONTROL_POWER;
|
||||
}
|
||||
|
||||
void lcd_remote_set_invert_display(bool yesno)
|
||||
{
|
||||
(void)yesno;
|
||||
}
|
||||
|
||||
/* turn the display upside down (call lcd_remote_update() afterwards) */
|
||||
void lcd_remote_set_flip(bool yesno)
|
||||
{
|
||||
(void)yesno;
|
||||
}
|
||||
|
||||
bool remote_detect(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void lcd_remote_on(void)
|
||||
{
|
||||
remote_power|=0x80;
|
||||
remote_state_control=REMOTE_CONTROL_POWER;
|
||||
}
|
||||
|
||||
void lcd_remote_off(void)
|
||||
{
|
||||
remote_power&=~(0x80);
|
||||
remote_state_control=REMOTE_CONTROL_POWER;
|
||||
}
|
||||
|
||||
unsigned char lcd_remote_test[16]=
|
||||
{0x80,0xFF,0x80,0x00,0xFF,0x89,0x89,0x00,0xC1,0x89,0x8F,0x80,0xFF,0x80,0,0};
|
||||
|
||||
/* Monitor remote hotswap */
|
||||
static void remote_tick(void)
|
||||
{
|
||||
unsigned char i;
|
||||
unsigned char remote_payload[10], remote_payload_size;
|
||||
unsigned char remote_check_xor, remote_check_sum;
|
||||
|
||||
switch (remote_state_control)
|
||||
{
|
||||
case REMOTE_CONTROL_IDLE:
|
||||
|
||||
remote_payload_size=0;
|
||||
remote_state_control=REMOTE_CONTROL_IDLE;
|
||||
break;
|
||||
case REMOTE_CONTROL_NOP:
|
||||
remote_payload[0]=0x11;
|
||||
remote_payload[1]=0x30;
|
||||
|
||||
remote_payload_size=2;
|
||||
remote_state_control=REMOTE_CONTROL_NOP;
|
||||
break;
|
||||
case REMOTE_CONTROL_POWER:
|
||||
remote_payload[0]=0x31;
|
||||
remote_payload[1]=remote_power;
|
||||
remote_payload[2]=remote_contrast;
|
||||
|
||||
remote_payload_size=3;
|
||||
remote_state_control=REMOTE_CONTROL_NOP;
|
||||
break;
|
||||
case REMOTE_CONTROL_MASK:
|
||||
remote_payload[0]=0x41;
|
||||
remote_payload[1]=0x94;
|
||||
|
||||
remote_payload_size=2;
|
||||
remote_state_control=REMOTE_CONTROL_NOP;
|
||||
break;
|
||||
case REMOTE_CONTROL_DRAW1:
|
||||
remote_payload[0]=0x51;
|
||||
remote_payload[1]=0x80;
|
||||
remote_payload[2]=14;
|
||||
remote_payload[3]=0;
|
||||
remote_payload[4]=0;
|
||||
remote_payload[5]=14;
|
||||
remote_payload[6]=8;
|
||||
|
||||
remote_payload_size=7;
|
||||
remote_state_control=REMOTE_CONTROL_DRAW_PAUSE1;
|
||||
break;
|
||||
case REMOTE_CONTROL_DRAW_PAUSE1:
|
||||
remote_payload[0]=0x11;
|
||||
remote_payload[1]=0x30;
|
||||
|
||||
remote_payload_size=2;
|
||||
remote_state_control=REMOTE_CONTROL_DRAW2;
|
||||
break;
|
||||
case REMOTE_CONTROL_DRAW2:
|
||||
remote_payload[0]=0x51;
|
||||
remote_payload[1]=0x80;
|
||||
remote_payload[2]=14;
|
||||
remote_payload[3]=0;
|
||||
remote_payload[4]=8;
|
||||
remote_payload[5]=14;
|
||||
remote_payload[6]=16;
|
||||
|
||||
remote_payload_size=7;
|
||||
remote_state_control=REMOTE_CONTROL_DRAW_PAUSE2;
|
||||
break;
|
||||
case REMOTE_CONTROL_DRAW_PAUSE2:
|
||||
remote_payload[0]=0x11;
|
||||
remote_payload[1]=0x30;
|
||||
|
||||
remote_payload_size=2;
|
||||
remote_state_control=REMOTE_CONTROL_NOP;
|
||||
break;
|
||||
case REMOTE_CONTROL_SLEEP:
|
||||
remote_payload[0]=0x71;
|
||||
remote_payload[1]=0x30;
|
||||
|
||||
remote_payload_size=2;
|
||||
remote_state_control=REMOTE_CONTROL_IDLE;
|
||||
break;
|
||||
default:
|
||||
remote_payload_size=0;
|
||||
break;
|
||||
}
|
||||
|
||||
if(remote_payload_size==0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
remote_check_xor=remote_payload[0];
|
||||
remote_check_sum=remote_payload[0];
|
||||
for(i=1; i<remote_payload_size; i++)
|
||||
{
|
||||
remote_check_xor^=remote_payload[i];
|
||||
remote_check_sum+=remote_payload[i];
|
||||
}
|
||||
|
||||
if(remote_payload[0]==0x51)
|
||||
{
|
||||
unsigned char offset;
|
||||
unsigned char x;
|
||||
|
||||
if(remote_payload[4]==8)
|
||||
{
|
||||
offset=79;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset=0;
|
||||
}
|
||||
|
||||
for (x = 0; x < 14; x++)
|
||||
{
|
||||
remote_check_xor^=lcd_remote_test[x];
|
||||
remote_check_sum+=lcd_remote_test[x];
|
||||
}
|
||||
|
||||
uart1_puts(remote_payload, remote_payload_size);
|
||||
lcd_remote_test[14]=remote_check_xor;
|
||||
lcd_remote_test[15]=remote_check_sum;
|
||||
uart1_puts(lcd_remote_test, 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
remote_payload[remote_payload_size]=remote_check_xor;
|
||||
remote_payload[remote_payload_size+1]=remote_check_sum;
|
||||
|
||||
uart1_puts(remote_payload, remote_payload_size+2);
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_remote_init_device(void)
|
||||
{
|
||||
lcd_remote_clear_display();
|
||||
if (remote_detect())
|
||||
lcd_remote_on();
|
||||
|
||||
/* put the remote control in the tick task */
|
||||
tick_add_task(remote_tick);
|
||||
}
|
||||
|
||||
/* Update the display.
|
||||
This must be called after all other LCD functions that change the display. */
|
||||
void lcd_remote_update(void)
|
||||
{
|
||||
if(remote_state_control!=REMOTE_CONTROL_DRAW1
|
||||
&& remote_state_control!=REMOTE_CONTROL_DRAW_PAUSE1
|
||||
&& remote_state_control!=REMOTE_CONTROL_DRAW2
|
||||
&& remote_state_control!=REMOTE_CONTROL_DRAW_PAUSE2)
|
||||
{
|
||||
remote_state_control=REMOTE_CONTROL_DRAW1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update a fraction of the display. */
|
||||
void lcd_remote_update_rect(int x, int y, int width, int height)
|
||||
{
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void)width;
|
||||
(void)height;
|
||||
lcd_remote_update();
|
||||
}
|
||||
|
||||
void _remote_backlight_on(void)
|
||||
{
|
||||
remote_power|=0x40;
|
||||
remote_state_control=REMOTE_CONTROL_POWER;
|
||||
}
|
||||
|
||||
void _remote_backlight_off(void)
|
||||
{
|
||||
remote_power&=~(0x40);
|
||||
remote_state_control=REMOTE_CONTROL_POWER;
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id: $
|
||||
*
|
||||
* Copyright (C) 2009 by Karl Kurbjun
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef LCD_REMOTE_TARGET_H
|
||||
#define LCD_REMOTE_TARGET_H
|
||||
|
||||
#define REMOTE_INIT_LCD 1
|
||||
#define REMOTE_DEINIT_LCD 2
|
||||
|
||||
void lcd_remote_powersave(bool on);
|
||||
void lcd_remote_set_invert_display(bool yesno);
|
||||
//void lcd_remote_set_flip(bool yesno);
|
||||
|
||||
bool remote_detect(void);
|
||||
void lcd_remote_init_device(void);
|
||||
void lcd_remote_on(void);
|
||||
void lcd_remote_off(void);
|
||||
void lcd_remote_update(void);
|
||||
void lcd_remote_update_rect(int, int, int, int);
|
||||
|
||||
void _remote_backlight_on(void);
|
||||
void _remote_backlight_off(void);
|
||||
|
||||
extern bool remote_initialized;
|
||||
|
||||
void lcd_remote_sleep(void);
|
||||
|
||||
#endif
|
|
@ -72,6 +72,7 @@ void power_off(void)
|
|||
{
|
||||
/* turn off backlight and wait for 1 second */
|
||||
_backlight_off();
|
||||
lcd_remote_sleep();
|
||||
lcd_sleep();
|
||||
sleep(HZ);
|
||||
/* Hard shutdown */
|
||||
|
|
|
@ -123,7 +123,7 @@ void UART1(void)
|
|||
panicf("UART1 buffer overflow");
|
||||
else
|
||||
{
|
||||
if(uart1_recieve_write==RECIEVE_RING_SIZE)
|
||||
if(uart1_recieve_write>=RECIEVE_RING_SIZE)
|
||||
uart1_recieve_write=0;
|
||||
|
||||
uart1_recieve_buffer_ring[uart1_recieve_write] = IO_UART1_DTRR & 0xff;
|
||||
|
|
|
@ -1459,6 +1459,8 @@ fi
|
|||
tool="$rootdir/tools/scramble -add=m500"
|
||||
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
|
||||
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
|
||||
bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0"
|
||||
bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
|
||||
output="rockbox.mrobe500"
|
||||
appextra="recorder:gui"
|
||||
plugins="yes"
|
||||
|
|
Loading…
Reference in New Issue