M:Robe 500: Remove some dead code and cleanup button handling
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20720 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4f47b38938
commit
94dc016a94
2 changed files with 43 additions and 111 deletions
|
@ -35,58 +35,11 @@
|
|||
#include "tsc2100.h"
|
||||
#endif
|
||||
|
||||
#if defined(PCM_TEST)
|
||||
/* Leaving this in for potential debugging for other targets */
|
||||
#include "pcm.h"
|
||||
#include "debug-target.h"
|
||||
#include "dsp-target.h"
|
||||
#include "dsp/ipc.h"
|
||||
#define ARM_BUFFER_SIZE (PCM_SIZE)
|
||||
|
||||
static signed short *the_rover = (signed short *)0x1900000;
|
||||
static unsigned int index_rover = 0;
|
||||
|
||||
void pcmtest_get_more(unsigned char** start, size_t* size)
|
||||
{
|
||||
unsigned long sdem_addr;
|
||||
sdem_addr = (unsigned long)the_rover + index_rover;
|
||||
|
||||
*start = (unsigned char*)(sdem_addr);
|
||||
*size = ARM_BUFFER_SIZE;
|
||||
|
||||
index_rover += ARM_BUFFER_SIZE;
|
||||
if (index_rover >= 4*1024*1024)
|
||||
{
|
||||
index_rover = 0;
|
||||
}
|
||||
|
||||
DEBUGF("pcm_sdram at 0x%08lx, sdem_addr 0x%08lx",
|
||||
(unsigned long)the_rover, (unsigned long)sdem_addr);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool __dbg_ports(void)
|
||||
{
|
||||
#if defined(PCM_TEST)
|
||||
int fd;
|
||||
int bytes;
|
||||
|
||||
fd = open("/test.raw", O_RDONLY);
|
||||
bytes = read(fd, the_rover, 4*1024*1024);
|
||||
close(fd);
|
||||
|
||||
DEBUGF("read %d rover bytes", bytes);
|
||||
|
||||
pcm_play_data(&pcmtest_get_more,(unsigned char*)the_rover, ARM_BUFFER_SIZE);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef CREATIVE_ZVx
|
||||
extern char r_buffer[5];
|
||||
extern int r_button;
|
||||
#endif
|
||||
bool __dbg_hw_info(void)
|
||||
{
|
||||
int line = 0, oldline;
|
||||
|
@ -171,11 +124,6 @@ bool __dbg_hw_info(void)
|
|||
address+=0x800;
|
||||
else if (button==BUTTON_RC_REW)
|
||||
address-=0x800;
|
||||
|
||||
snprintf(buf, sizeof(buf), "Buffer: 0x%02x%02x%02x%02x%02x",
|
||||
r_buffer[0], r_buffer[1], r_buffer[2], r_buffer[3],r_buffer[4] ); lcd_puts(0, line++, buf);
|
||||
snprintf(buf, sizeof(buf), "Button: 0x%08x, HWread: 0x%08x",
|
||||
(unsigned int)button, r_button); lcd_puts(0, line++, buf);
|
||||
#else
|
||||
button = button_get(false);
|
||||
if(button & BUTTON_POWER)
|
||||
|
|
|
@ -35,12 +35,6 @@
|
|||
#include "string.h"
|
||||
#include "touchscreen.h"
|
||||
|
||||
#define BUTTON_TIMEOUT 50
|
||||
|
||||
#define BUTTON_START_BYTE 0xF0
|
||||
#define BUTTON_START_BYTE2 0xF4 /* not sure why, but sometimes you get F0 or F4, */
|
||||
/* but always the same one for the session? */
|
||||
static short last_x, last_y, last_z1, last_z2; /* for the touch screen */
|
||||
static bool touch_available = false;
|
||||
static bool hold_button = false;
|
||||
|
||||
|
@ -129,93 +123,83 @@ inline bool button_hold(void)
|
|||
return hold_button;
|
||||
}
|
||||
|
||||
#define TOUCH_MARGIN 8
|
||||
char r_buffer[5];
|
||||
int r_button = BUTTON_NONE;
|
||||
int button_read_device(int *data)
|
||||
{
|
||||
int retval, button1_location, button2_location;
|
||||
char r_buffer[5];
|
||||
int r_button = BUTTON_NONE;
|
||||
|
||||
static int oldbutton = BUTTON_NONE;
|
||||
static bool oldhold = false;
|
||||
|
||||
static long last_touch = 0;
|
||||
|
||||
r_button=BUTTON_NONE;
|
||||
*data = 0;
|
||||
|
||||
/* Handle touchscreen */
|
||||
if (touch_available)
|
||||
{
|
||||
short x,y;
|
||||
bool send_touch = false;
|
||||
short last_z1, last_z2;
|
||||
|
||||
tsc2100_read_values(&x, &y, &last_z1, &last_z2);
|
||||
if (TIME_BEFORE(last_touch + HZ/5, current_tick))
|
||||
{
|
||||
if ((x > last_x + TOUCH_MARGIN) ||
|
||||
(x < last_x - TOUCH_MARGIN) ||
|
||||
(y > last_y + TOUCH_MARGIN) ||
|
||||
(y < last_y - TOUCH_MARGIN))
|
||||
{
|
||||
send_touch = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
send_touch = true;
|
||||
if (send_touch)
|
||||
{
|
||||
last_x = x;
|
||||
last_y = y;
|
||||
*data = touch_to_pixels(x, y);
|
||||
r_button |= touchscreen_to_pixels((*data&0xffff0000)>>16,
|
||||
*data&0x0000ffff, data);
|
||||
oldbutton = r_button;
|
||||
}
|
||||
last_touch = current_tick;
|
||||
|
||||
*data = touch_to_pixels(x, y);
|
||||
r_button |= touchscreen_to_pixels((*data&0xffff0000)>>16,
|
||||
*data&0x0000ffff, data);
|
||||
oldbutton = r_button;
|
||||
|
||||
touch_available = false;
|
||||
last_touch=current_tick;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Touch hasn't happened in a while, clear the bits */
|
||||
if(last_touch+3>current_tick)
|
||||
{
|
||||
oldbutton&=(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle power button */
|
||||
if ((IO_GIO_BITSET0&0x01) == 0)
|
||||
{
|
||||
r_button |= BUTTON_POWER;
|
||||
oldbutton=r_button;
|
||||
}
|
||||
|
||||
retval=uart1_gets_queue(r_buffer, 5);
|
||||
|
||||
for(button1_location=0;button1_location<4;button1_location++)
|
||||
{
|
||||
if((r_buffer[button1_location]&0xF0)==0xF0
|
||||
&& (r_buffer[button1_location+1]&0xF0)!=0xF0)
|
||||
break;
|
||||
}
|
||||
button1_location++;
|
||||
if(button1_location==5)
|
||||
button1_location=0;
|
||||
|
||||
if(button1_location==4)
|
||||
button2_location=0;
|
||||
else
|
||||
button2_location=button1_location+1;
|
||||
|
||||
if(retval>=0)
|
||||
oldbutton&=~BUTTON_POWER;
|
||||
|
||||
/* Handle remote buttons */
|
||||
if(uart1_gets_queue(r_buffer, 5)>=0)
|
||||
{
|
||||
int button_location;
|
||||
|
||||
for(button_location=0;button_location<4;button_location++)
|
||||
{
|
||||
if((r_buffer[button_location]&0xF0)==0xF0
|
||||
&& (r_buffer[button_location+1]&0xF0)!=0xF0)
|
||||
break;
|
||||
}
|
||||
|
||||
if(button_location==4)
|
||||
button_location=0;
|
||||
|
||||
button_location++;
|
||||
|
||||
r_button |= r_buffer[button_location];
|
||||
|
||||
/* Find the hold status location */
|
||||
if(button_location==4)
|
||||
button_location=0;
|
||||
else
|
||||
button_location++;
|
||||
|
||||
hold_button=((r_buffer[button_location]&0x80)?true:false);
|
||||
|
||||
uart1_clear_queue();
|
||||
r_button |= r_buffer[button1_location];
|
||||
oldbutton=r_button;
|
||||
hold_button=((r_buffer[button2_location]&0x80)?true:false);
|
||||
}
|
||||
else
|
||||
{
|
||||
r_button=oldbutton;
|
||||
}
|
||||
|
||||
/* Take care of hold notices */
|
||||
#ifndef BOOTLOADER
|
||||
/* give BL notice if HB state chaged */
|
||||
if (hold_button != oldhold)
|
||||
|
|
Loading…
Reference in a new issue