summaryrefslogtreecommitdiff
path: root/firmware
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
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')
-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 @@
31#define WHEEL_FAST_OFF_INTERVAL 60000 31#define WHEEL_FAST_OFF_INTERVAL 60000
32#define WHEELCLICKS_PER_ROTATION 48 /* wheelclicks per full rotation */ 32#define WHEELCLICKS_PER_ROTATION 48 /* wheelclicks per full rotation */
33 33
34static short _dbop_din;
34/* Clickwheel */ 35/* Clickwheel */
35static unsigned int old_wheel_value = 0; 36static unsigned int old_wheel_value = 0;
36static unsigned int wheel_repeat = BUTTON_NONE; 37static unsigned int wheel_repeat = BUTTON_NONE;
@@ -47,7 +48,7 @@ static bool hold_button = false;
47static bool hold_button_old = false; 48static bool hold_button_old = false;
48#endif 49#endif
49 50
50extern void lcd_button_support(void); 51extern bool lcd_button_support(void);
51 52
52void button_init_device(void) 53void button_init_device(void)
53{ 54{
@@ -85,8 +86,7 @@ void clickwheel(unsigned int wheel_value)
85 unsigned long usec = TIMER1_VALUE; /* WAG!!! and it works!!*/ 86 unsigned long usec = TIMER1_VALUE; /* WAG!!! and it works!!*/
86 unsigned v = (usec - last_wheel_usec) & 0x7fffffff; 87 unsigned v = (usec - last_wheel_usec) & 0x7fffffff;
87 88
88 v = (v>0) ? 1000000 / v : 0; /* clicks/sec = 1000000 * 89 v = (v>0) ? 1000000 / v : 0; /* clicks/sec = 1000000 * +clicks/usec */
89+clicks/usec */
90 v = (v>0xffffff) ? 0xffffff : v; /* limit to 24 bit */ 90 v = (v>0xffffff) ? 0xffffff : v; /* limit to 24 bit */
91 91
92 /* some velocity filtering to smooth things out */ 92 /* some velocity filtering to smooth things out */
@@ -119,8 +119,7 @@ void clickwheel(unsigned int wheel_value)
119 } 119 }
120 else 120 else
121 { 121 {
122 /* fast ON gets filtered to avoid inadvertent jumps to fast mode 122 /* fast ON gets filtered to avoid inadvertent jumps to fast mode */
123*/
124 if (repeat && wheel_velocity > 1000000/WHEEL_FAST_ON_INTERVAL) 123 if (repeat && wheel_velocity > 1000000/WHEEL_FAST_ON_INTERVAL)
125 { 124 {
126 /* moving into fast mode */ 125 /* moving into fast mode */
@@ -180,12 +179,13 @@ void clickwheel(unsigned int wheel_value)
180 old_wheel_value = wheel_value; 179 old_wheel_value = wheel_value;
181} 180}
182 181
183int read_dbop(void) 182static short read_dbop(void)
184{ 183{
185 /*write a red pixel */ 184 /*write a red pixel */
186 lcd_button_support(); 185 if (!lcd_button_support())
186 return _dbop_din;
187 187
188 /* Set up dbop for input */ 188 /* Set up dbop for input */
189 while (!(DBOP_STAT & (1<<10))); /* Wait for fifo to empty */ 189 while (!(DBOP_STAT & (1<<10))); /* Wait for fifo to empty */
190 DBOP_CTRL |= (1<<19); 190 DBOP_CTRL |= (1<<19);
191 DBOP_CTRL &= ~(1<<16); /* disable output */ 191 DBOP_CTRL &= ~(1<<16); /* disable output */
@@ -198,14 +198,14 @@ int read_dbop(void)
198 int delay = 50; 198 int delay = 50;
199 while(delay--); /* small delay to set up read */ 199 while(delay--); /* small delay to set up read */
200 200
201 int ret = DBOP_DIN; /* now read dbop & store info*/ 201 _dbop_din = DBOP_DIN; /* now read dbop & store info*/
202 202
203 DBOP_TIMPOL_01 = 0x6e167; 203 DBOP_TIMPOL_01 = 0x6e167;
204 DBOP_TIMPOL_23 = 0xa167e06f; 204 DBOP_TIMPOL_23 = 0xa167e06f;
205 DBOP_CTRL |= (1<<16); 205 DBOP_CTRL |= (1<<16);
206 DBOP_CTRL &= ~(1<<19); 206 DBOP_CTRL &= ~(1<<19);
207 207
208 return ret; 208 return _dbop_din;
209} 209}
210 210
211/* 211/*
@@ -215,7 +215,7 @@ int button_read_device(void)
215{ 215{
216 int btn = BUTTON_NONE; 216 int btn = BUTTON_NONE;
217 /* read buttons from dbop */ 217 /* read buttons from dbop */
218 int dbop = read_dbop(); 218 short dbop = read_dbop();
219 219
220 /* hold button */ 220 /* hold button */
221 if(dbop & (1<<12)) 221 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)
435} /* lcd_update_rect */ 435} /* lcd_update_rect */
436 436
437/* writes one read pixel outside the visible area, needed for correct dbop reads */ 437/* writes one read pixel outside the visible area, needed for correct dbop reads */
438void lcd_button_support(void) 438bool lcd_button_support(void)
439{ 439{
440 int x=LCD_HEIGHT+1; 440 int x=LCD_HEIGHT+1;
441 int y=LCD_WIDTH+1; 441 int y=LCD_WIDTH+1;
@@ -444,7 +444,7 @@ void lcd_button_support(void)
444 unsigned short data = (0xf<<12); 444 unsigned short data = (0xf<<12);
445 445
446 if (lcd_busy) 446 if (lcd_busy)
447 return; 447 return false;
448 448
449 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ); 449 lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ);
450 /* Set start position and window */ 450 /* Set start position and window */
@@ -457,4 +457,5 @@ void lcd_button_support(void)
457 lcd_write_cmd(R_WRITE_DATA_2_GRAM); 457 lcd_write_cmd(R_WRITE_DATA_2_GRAM);
458 458
459 lcd_write_data(&data, width); 459 lcd_write_data(&data, width);
460 return true;
460} 461}