summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-02-18 17:43:38 +0000
committerThomas Martitz <kugel@rockbox.org>2009-02-18 17:43:38 +0000
commit5e3b4fe3f8a47b57f9c799025f757607102d3284 (patch)
treebc917e283a73fc56257417ccb5ff4b45e731fd6d /firmware/target/arm
parent30255d53daf8184a33631893b0bf214f8973c329 (diff)
downloadrockbox-5e3b4fe3f8a47b57f9c799025f757607102d3284.tar.gz
rockbox-5e3b4fe3f8a47b57f9c799025f757607102d3284.zip
Return old button value if lcd_button_supprt was blocked.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20041 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c22
-rw-r--r--firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c5
2 files changed, 14 insertions, 13 deletions
diff --git a/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c
index 8654419f10..9a8b58fd3f 100644
--- a/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c
+++ b/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c
@@ -31,6 +31,7 @@
#define WHEEL_FAST_OFF_INTERVAL 60000
#define WHEELCLICKS_PER_ROTATION 48 /* wheelclicks per full rotation */
+static short _dbop_din;
/* Clickwheel */
static unsigned int old_wheel_value = 0;
static unsigned int wheel_repeat = BUTTON_NONE;
@@ -47,7 +48,7 @@ static bool hold_button = false;
static bool hold_button_old = false;
#endif
-extern void lcd_button_support(void);
+extern bool lcd_button_support(void);
void button_init_device(void)
{
@@ -85,8 +86,7 @@ void clickwheel(unsigned int wheel_value)
unsigned long usec = TIMER1_VALUE; /* WAG!!! and it works!!*/
unsigned v = (usec - last_wheel_usec) & 0x7fffffff;
- v = (v>0) ? 1000000 / v : 0; /* clicks/sec = 1000000 *
-+clicks/usec */
+ v = (v>0) ? 1000000 / v : 0; /* clicks/sec = 1000000 * +clicks/usec */
v = (v>0xffffff) ? 0xffffff : v; /* limit to 24 bit */
/* some velocity filtering to smooth things out */
@@ -119,8 +119,7 @@ void clickwheel(unsigned int wheel_value)
}
else
{
- /* fast ON gets filtered to avoid inadvertent jumps to fast mode
-*/
+ /* fast ON gets filtered to avoid inadvertent jumps to fast mode */
if (repeat && wheel_velocity > 1000000/WHEEL_FAST_ON_INTERVAL)
{
/* moving into fast mode */
@@ -180,12 +179,13 @@ void clickwheel(unsigned int wheel_value)
old_wheel_value = wheel_value;
}
-int read_dbop(void)
+static short read_dbop(void)
{
/*write a red pixel */
- lcd_button_support();
+ if (!lcd_button_support())
+ return _dbop_din;
- /* Set up dbop for input */
+ /* Set up dbop for input */
while (!(DBOP_STAT & (1<<10))); /* Wait for fifo to empty */
DBOP_CTRL |= (1<<19);
DBOP_CTRL &= ~(1<<16); /* disable output */
@@ -198,14 +198,14 @@ int read_dbop(void)
int delay = 50;
while(delay--); /* small delay to set up read */
- int ret = DBOP_DIN; /* now read dbop & store info*/
+ _dbop_din = DBOP_DIN; /* now read dbop & store info*/
DBOP_TIMPOL_01 = 0x6e167;
DBOP_TIMPOL_23 = 0xa167e06f;
DBOP_CTRL |= (1<<16);
DBOP_CTRL &= ~(1<<19);
- return ret;
+ return _dbop_din;
}
/*
@@ -215,7 +215,7 @@ int button_read_device(void)
{
int btn = BUTTON_NONE;
/* read buttons from dbop */
- int dbop = read_dbop();
+ short dbop = read_dbop();
/* hold button */
if(dbop & (1<<12))
diff --git a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
index 60a32b510b..379869f2b4 100644
--- a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
+++ b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
@@ -435,7 +435,7 @@ void lcd_update_rect(int x, int y, int width, int height)
} /* lcd_update_rect */
/* writes one read pixel outside the visible area, needed for correct dbop reads */
-void lcd_button_support(void)
+bool lcd_button_support(void)
{
int x=LCD_HEIGHT+1;
int y=LCD_WIDTH+1;
@@ -444,7 +444,7 @@ void lcd_button_support(void)
unsigned short data = (0xf<<12);
if (lcd_busy)
- return;
+ return false;
lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ);
/* Set start position and window */
@@ -457,4 +457,5 @@ void lcd_button_support(void)
lcd_write_cmd(R_WRITE_DATA_2_GRAM);
lcd_write_data(&data, width);
+ return true;
}