mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-11 06:05:21 -05:00
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"
|
#include "tsc2100.h"
|
||||||
#endif
|
#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)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CREATIVE_ZVx
|
|
||||||
extern char r_buffer[5];
|
|
||||||
extern int r_button;
|
|
||||||
#endif
|
|
||||||
bool __dbg_hw_info(void)
|
bool __dbg_hw_info(void)
|
||||||
{
|
{
|
||||||
int line = 0, oldline;
|
int line = 0, oldline;
|
||||||
|
|
@ -171,11 +124,6 @@ bool __dbg_hw_info(void)
|
||||||
address+=0x800;
|
address+=0x800;
|
||||||
else if (button==BUTTON_RC_REW)
|
else if (button==BUTTON_RC_REW)
|
||||||
address-=0x800;
|
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
|
#else
|
||||||
button = button_get(false);
|
button = button_get(false);
|
||||||
if(button & BUTTON_POWER)
|
if(button & BUTTON_POWER)
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,6 @@
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "touchscreen.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 touch_available = false;
|
||||||
static bool hold_button = false;
|
static bool hold_button = false;
|
||||||
|
|
||||||
|
|
@ -129,93 +123,83 @@ inline bool button_hold(void)
|
||||||
return hold_button;
|
return hold_button;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TOUCH_MARGIN 8
|
|
||||||
char r_buffer[5];
|
|
||||||
int r_button = BUTTON_NONE;
|
|
||||||
int button_read_device(int *data)
|
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 int oldbutton = BUTTON_NONE;
|
||||||
static bool oldhold = false;
|
static bool oldhold = false;
|
||||||
|
|
||||||
static long last_touch = 0;
|
static long last_touch = 0;
|
||||||
|
|
||||||
r_button=BUTTON_NONE;
|
|
||||||
*data = 0;
|
*data = 0;
|
||||||
|
|
||||||
|
/* Handle touchscreen */
|
||||||
if (touch_available)
|
if (touch_available)
|
||||||
{
|
{
|
||||||
short x,y;
|
short x,y;
|
||||||
bool send_touch = false;
|
short last_z1, last_z2;
|
||||||
|
|
||||||
tsc2100_read_values(&x, &y, &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);
|
*data = touch_to_pixels(x, y);
|
||||||
r_button |= touchscreen_to_pixels((*data&0xffff0000)>>16,
|
r_button |= touchscreen_to_pixels((*data&0xffff0000)>>16,
|
||||||
*data&0x0000ffff, data);
|
*data&0x0000ffff, data);
|
||||||
oldbutton = r_button;
|
oldbutton = r_button;
|
||||||
}
|
|
||||||
last_touch = current_tick;
|
|
||||||
touch_available = false;
|
touch_available = false;
|
||||||
|
last_touch=current_tick;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Touch hasn't happened in a while, clear the bits */
|
/* Touch hasn't happened in a while, clear the bits */
|
||||||
if(last_touch+3>current_tick)
|
if(last_touch+3>current_tick)
|
||||||
{
|
|
||||||
oldbutton&=(0xFF);
|
oldbutton&=(0xFF);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/* Handle power button */
|
||||||
if ((IO_GIO_BITSET0&0x01) == 0)
|
if ((IO_GIO_BITSET0&0x01) == 0)
|
||||||
{
|
{
|
||||||
r_button |= BUTTON_POWER;
|
r_button |= BUTTON_POWER;
|
||||||
oldbutton=r_button;
|
oldbutton=r_button;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
oldbutton&=~BUTTON_POWER;
|
||||||
|
|
||||||
retval=uart1_gets_queue(r_buffer, 5);
|
/* Handle remote buttons */
|
||||||
|
if(uart1_gets_queue(r_buffer, 5)>=0)
|
||||||
for(button1_location=0;button1_location<4;button1_location++)
|
|
||||||
{
|
{
|
||||||
if((r_buffer[button1_location]&0xF0)==0xF0
|
int button_location;
|
||||||
&& (r_buffer[button1_location+1]&0xF0)!=0xF0)
|
|
||||||
|
for(button_location=0;button_location<4;button_location++)
|
||||||
|
{
|
||||||
|
if((r_buffer[button_location]&0xF0)==0xF0
|
||||||
|
&& (r_buffer[button_location+1]&0xF0)!=0xF0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
button1_location++;
|
|
||||||
if(button1_location==5)
|
|
||||||
button1_location=0;
|
|
||||||
|
|
||||||
if(button1_location==4)
|
if(button_location==4)
|
||||||
button2_location=0;
|
button_location=0;
|
||||||
|
|
||||||
|
button_location++;
|
||||||
|
|
||||||
|
r_button |= r_buffer[button_location];
|
||||||
|
|
||||||
|
/* Find the hold status location */
|
||||||
|
if(button_location==4)
|
||||||
|
button_location=0;
|
||||||
else
|
else
|
||||||
button2_location=button1_location+1;
|
button_location++;
|
||||||
|
|
||||||
|
hold_button=((r_buffer[button_location]&0x80)?true:false);
|
||||||
|
|
||||||
if(retval>=0)
|
|
||||||
{
|
|
||||||
uart1_clear_queue();
|
uart1_clear_queue();
|
||||||
r_button |= r_buffer[button1_location];
|
|
||||||
oldbutton=r_button;
|
oldbutton=r_button;
|
||||||
hold_button=((r_buffer[button2_location]&0x80)?true:false);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
r_button=oldbutton;
|
r_button=oldbutton;
|
||||||
}
|
|
||||||
|
|
||||||
|
/* Take care of hold notices */
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
/* give BL notice if HB state chaged */
|
/* give BL notice if HB state chaged */
|
||||||
if (hold_button != oldhold)
|
if (hold_button != oldhold)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue