summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/drivers/lcd.c46
-rw-r--r--uisimulator/app.c1
-rw-r--r--uisimulator/common/mpegplay.c1
-rw-r--r--uisimulator/menu.c1
-rw-r--r--uisimulator/play.c7
-rw-r--r--uisimulator/screensaver.c1
-rw-r--r--uisimulator/tetris.c36
-rw-r--r--uisimulator/tree.c22
-rw-r--r--uisimulator/x11/button-x11.c1
9 files changed, 54 insertions, 62 deletions
diff --git a/firmware/drivers/lcd.c b/firmware/drivers/lcd.c
index d0e2c623de..f33e8e5f2a 100644
--- a/firmware/drivers/lcd.c
+++ b/firmware/drivers/lcd.c
@@ -329,24 +329,24 @@ static const unsigned char lcd_ascii[] = {
329void lcd_clear_display(void) 329void lcd_clear_display(void)
330{ 330{
331 int i; 331 int i;
332 lcd_write(TRUE,LCD_CURSOR(0,0)); 332 lcd_write(true,LCD_CURSOR(0,0));
333 for (i=0;i<24;i++) 333 for (i=0;i<24;i++)
334 lcd_write(FALSE,0); 334 lcd_write(false,0);
335} 335}
336 336
337void lcd_puts(int x, int y, char *string) 337void lcd_puts(int x, int y, char *string)
338{ 338{
339 lcd_write(TRUE,LCD_CURSOR(x,y)); 339 lcd_write(true,LCD_CURSOR(x,y));
340 while (*string) 340 while (*string)
341 lcd_write(FALSE,LCD_ASCII(*string++)); 341 lcd_write(false,LCD_ASCII(*string++));
342} 342}
343 343
344void lcd_define_pattern (int which,char *pattern,int length) 344void lcd_define_pattern (int which,char *pattern,int length)
345{ 345{
346 int i; 346 int i;
347 lcd_write(TRUE,LCD_PRAM|which); 347 lcd_write(true,LCD_PRAM|which);
348 for (i=0;i<length;i++) 348 for (i=0;i<length;i++)
349 lcd_write(FALSE,pattern[i]); 349 lcd_write(false,pattern[i]);
350} 350}
351#endif 351#endif
352 352
@@ -407,13 +407,13 @@ void lcd_init (void)
407 PBIOR |= 0x000f; /* IOR = 1 */ 407 PBIOR |= 0x000f; /* IOR = 1 */
408 408
409 /* Initialize LCD */ 409 /* Initialize LCD */
410 lcd_write (TRUE, LCD_CNTL_RESET); 410 lcd_write (true, LCD_CNTL_RESET);
411 lcd_write (TRUE, LCD_CNTL_POWER); 411 lcd_write (true, LCD_CNTL_POWER);
412 lcd_write (TRUE, LCD_CNTL_SEGREMAP); 412 lcd_write (true, LCD_CNTL_SEGREMAP);
413 lcd_write (TRUE, LCD_CNTL_OUTSCAN); 413 lcd_write (true, LCD_CNTL_OUTSCAN);
414 lcd_write (TRUE, LCD_CNTL_CONTRAST); 414 lcd_write (true, LCD_CNTL_CONTRAST);
415 lcd_write (TRUE, 0x30); /* Contrast parameter */ 415 lcd_write (true, 0x30); /* Contrast parameter */
416 lcd_write (TRUE, LCD_CNTL_DISPON); 416 lcd_write (true, LCD_CNTL_DISPON);
417 417
418 lcd_clear_display(); 418 lcd_clear_display();
419 lcd_update(); 419 lcd_update();
@@ -430,12 +430,12 @@ void lcd_update (void)
430 /* Copy display bitmap to hardware */ 430 /* Copy display bitmap to hardware */
431 for (y = 0; y < LCD_HEIGHT/8; y++) 431 for (y = 0; y < LCD_HEIGHT/8; y++)
432 { 432 {
433 lcd_write (TRUE, LCD_CNTL_PAGE | (y & 0xf)); 433 lcd_write (true, LCD_CNTL_PAGE | (y & 0xf));
434 lcd_write (TRUE, LCD_CNTL_HIGHCOL); 434 lcd_write (true, LCD_CNTL_HIGHCOL);
435 lcd_write (TRUE, LCD_CNTL_LOWCOL); 435 lcd_write (true, LCD_CNTL_LOWCOL);
436 436
437 for (x = 0; x < LCD_WIDTH; x++) 437 for (x = 0; x < LCD_WIDTH; x++)
438 lcd_write (FALSE, display[x][y]); 438 lcd_write (false, display[x][y]);
439 } 439 }
440} 440}
441 441
@@ -505,8 +505,8 @@ void lcd_putsxy(int x, int y, char *str, int thisfont)
505 else 505 else
506 src = char_gen_6x8[ch-ASCII_MIN][0]; 506 src = char_gen_6x8[ch-ASCII_MIN][0];
507 507
508 lcd_bitmap (src, lcd_x, lcd_y, nx-1, ny, TRUE); 508 lcd_bitmap (src, lcd_x, lcd_y, nx-1, ny, true);
509 lcd_bitmap (zeros, lcd_x+nx-1, lcd_y, 1, ny, TRUE); 509 lcd_bitmap (zeros, lcd_x+nx-1, lcd_y, 1, ny, true);
510 510
511 lcd_x += nx; 511 lcd_x += nx;
512 } 512 }
@@ -515,7 +515,7 @@ void lcd_putsxy(int x, int y, char *str, int thisfont)
515 515
516/* 516/*
517 * Display a bitmap at (x, y), size (nx, ny) 517 * Display a bitmap at (x, y), size (nx, ny)
518 * clear is TRUE to clear destination area first 518 * clear is true to clear destination area first
519 */ 519 */
520void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny, 520void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny,
521 bool clear) 521 bool clear)
@@ -593,7 +593,7 @@ void lcd_clearrect (int x, int y, int nx, int ny)
593{ 593{
594 int i; 594 int i;
595 for (i = 0; i < nx; i++) 595 for (i = 0; i < nx; i++)
596 lcd_bitmap (zeros, x+i, y, 1, ny, TRUE); 596 lcd_bitmap (zeros, x+i, y, 1, ny, true);
597} 597}
598 598
599/* 599/*
@@ -603,7 +603,7 @@ void lcd_fillrect (int x, int y, int nx, int ny)
603{ 603{
604 int i; 604 int i;
605 for (i = 0; i < nx; i++) 605 for (i = 0; i < nx; i++)
606 lcd_bitmap (ones, x+i, y, 1, ny, TRUE); 606 lcd_bitmap (ones, x+i, y, 1, ny, true);
607} 607}
608 608
609/* Invert a rectangular area at (x, y), size (nx, ny) */ 609/* Invert a rectangular area at (x, y), size (nx, ny) */
@@ -611,7 +611,7 @@ void lcd_invertrect (int x, int y, int nx, int ny)
611{ 611{
612 int i; 612 int i;
613 for (i = 0; i < nx; i++) 613 for (i = 0; i < nx; i++)
614 lcd_bitmap (ones, x+i, y, 1, ny, FALSE); 614 lcd_bitmap (ones, x+i, y, 1, ny, false);
615} 615}
616 616
617#define DRAW_PIXEL(x,y) display[x][y/8] |= (1<<(y&7)) 617#define DRAW_PIXEL(x,y) display[x][y/8] |= (1<<(y&7))
diff --git a/uisimulator/app.c b/uisimulator/app.c
index 5c96ab8c43..c5149d8171 100644
--- a/uisimulator/app.c
+++ b/uisimulator/app.c
@@ -17,7 +17,6 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#include "types.h"
21#include "lcd.h" 20#include "lcd.h"
22#include "button.h" 21#include "button.h"
23#include "kernel.h" 22#include "kernel.h"
diff --git a/uisimulator/common/mpegplay.c b/uisimulator/common/mpegplay.c
index aaaddfa014..5ecfca9e97 100644
--- a/uisimulator/common/mpegplay.c
+++ b/uisimulator/common/mpegplay.c
@@ -26,7 +26,6 @@
26#include <string.h> 26#include <string.h>
27#include <stdlib.h> 27#include <stdlib.h>
28#include <file.h> 28#include <file.h>
29#include <types.h>
30#include <lcd.h> 29#include <lcd.h>
31#include <button.h> 30#include <button.h>
32#include "id3.h" 31#include "id3.h"
diff --git a/uisimulator/menu.c b/uisimulator/menu.c
index dcaa1f5fca..6a6b61e755 100644
--- a/uisimulator/menu.c
+++ b/uisimulator/menu.c
@@ -17,7 +17,6 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#include "types.h"
21#include "lcd.h" 20#include "lcd.h"
22#include "menu.h" 21#include "menu.h"
23 22
diff --git a/uisimulator/play.c b/uisimulator/play.c
index 3681a7e133..e93f17672e 100644
--- a/uisimulator/play.c
+++ b/uisimulator/play.c
@@ -20,10 +20,9 @@
20#include <string.h> 20#include <string.h>
21#include <stdlib.h> 21#include <stdlib.h>
22 22
23#include <file.h> 23#include "file.h"
24#include <types.h> 24#include "lcd.h"
25#include <lcd.h> 25#include "button.h"
26#include <button.h>
27#include "kernel.h" 26#include "kernel.h"
28#include "tree.h" 27#include "tree.h"
29#include "debug.h" 28#include "debug.h"
diff --git a/uisimulator/screensaver.c b/uisimulator/screensaver.c
index a85ccf965d..b8144478e2 100644
--- a/uisimulator/screensaver.c
+++ b/uisimulator/screensaver.c
@@ -20,7 +20,6 @@
20#ifdef HAVE_LCD_BITMAP 20#ifdef HAVE_LCD_BITMAP
21 21
22#include "screensaver.h" 22#include "screensaver.h"
23#include "types.h"
24#include "lcd.h" 23#include "lcd.h"
25#include "button.h" 24#include "button.h"
26#include "kernel.h" 25#include "kernel.h"
diff --git a/uisimulator/tetris.c b/uisimulator/tetris.c
index 8884fd8964..24090eb67e 100644
--- a/uisimulator/tetris.c
+++ b/uisimulator/tetris.c
@@ -20,8 +20,7 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#ifdef HAVE_LCD_BITMAP 22#ifdef HAVE_LCD_BITMAP
23 23#include <stdbool.h>
24#include "types.h"
25#include "lcd.h" 24#include "lcd.h"
26#include "button.h" 25#include "button.h"
27#include "kernel.h" 26#include "kernel.h"
@@ -121,7 +120,7 @@ void draw_frame(int fstart_x,int fstop_x,int fstart_y,int fstop_y)
121 lcd_drawline(fstop_x, fstart_y, fstop_x, fstop_y); 120 lcd_drawline(fstop_x, fstart_y, fstop_x, fstop_y);
122} 121}
123 122
124void draw_block(int x,int y,int block,int frame,int clear) 123void draw_block(int x,int y,int block,int frame,bool clear)
125{ 124{
126 int i; 125 int i;
127 for(i=0;i < 4;i++) { 126 for(i=0;i < 4;i++) {
@@ -143,7 +142,7 @@ void to_virtual()
143 (current_x+block_data[current_b][current_f][0][i])) = current_b+1; 142 (current_x+block_data[current_b][current_f][0][i])) = current_b+1;
144} 143}
145 144
146int gameover() 145bool gameover()
147{ 146{
148 int i; 147 int i;
149 int frame, block, y, x; 148 int frame, block, y, x;
@@ -162,14 +161,14 @@ int gameover()
162 if(y+block_data[block][frame][1][i] < start_y) 161 if(y+block_data[block][frame][1][i] < start_y)
163 { 162 {
164 /* Game over ;) */ 163 /* Game over ;) */
165 return TRUE; 164 return true;
166 } 165 }
167 } 166 }
168 } 167 }
169 return FALSE; 168 return false;
170} 169}
171 170
172int valid_position(int x,int y,int block,int frame) 171bool valid_position(int x,int y,int block,int frame)
173{ 172{
174 int i; 173 int i;
175 for(i=0;i < 4;i++) 174 for(i=0;i < 4;i++)
@@ -179,8 +178,8 @@ int valid_position(int x,int y,int block,int frame)
179 (x+block_data[block][frame][0][i] > max_x-1) || 178 (x+block_data[block][frame][0][i] > max_x-1) ||
180 (y+block_data[block][frame][1][i] < 0) || 179 (y+block_data[block][frame][1][i] < 0) ||
181 (y+block_data[block][frame][1][i] > max_y-1)) 180 (y+block_data[block][frame][1][i] > max_y-1))
182 return FALSE; 181 return false;
183 return TRUE; 182 return true;
184} 183}
185 184
186void from_virtual() 185void from_virtual()
@@ -207,10 +206,10 @@ void move_block(int x,int y,int f)
207 } 206 }
208 if(valid_position(current_x+x,current_y+y,current_b,current_f)) 207 if(valid_position(current_x+x,current_y+y,current_b,current_f))
209 { 208 {
210 draw_block(current_x,current_y,current_b,last_frame,TRUE); 209 draw_block(current_x,current_y,current_b,last_frame,true);
211 current_x += x; 210 current_x += x;
212 current_y += y; 211 current_y += y;
213 draw_block(current_x,current_y,current_b,current_f,FALSE); 212 draw_block(current_x,current_y,current_b,current_f,false);
214 lcd_update(); 213 lcd_update();
215 } 214 }
216 else 215 else
@@ -225,27 +224,28 @@ void new_block()
225 current_y = 0; 224 current_y = 0;
226 next_b = t_rand(blocks); 225 next_b = t_rand(blocks);
227 next_f = t_rand(block_frames[next_b]); 226 next_f = t_rand(block_frames[next_b]);
228 draw_block(max_x+2,start_y-1,current_b,current_f,TRUE); 227 draw_block(max_x+2,start_y-1,current_b,current_f,true);
229 draw_block(max_x+2,start_y-1,next_b,next_f,FALSE); 228 draw_block(max_x+2,start_y-1,next_b,next_f,false);
230 if(!valid_position(current_x,current_y,current_b,current_f)) 229 if(!valid_position(current_x,current_y,current_b,current_f))
231 { 230 {
232 draw_block(current_x,current_y,current_b,current_f,FALSE); 231 draw_block(current_x,current_y,current_b,current_f,false);
233 lcd_update(); 232 lcd_update();
234 } 233 }
235 else 234 else
236 draw_block(current_x,current_y,current_b,current_f,FALSE); 235 draw_block(current_x,current_y,current_b,current_f,false);
237} 236}
238 237
239int check_lines() 238int check_lines()
240{ 239{
241 int x,y,line,i; 240 int x,y,i;
241 bool line;
242 int lines = 0; 242 int lines = 0;
243 for(y=0;y < max_y;y++) 243 for(y=0;y < max_y;y++)
244 { 244 {
245 line = TRUE; 245 line = true;
246 for(x=0;x < max_x;x++) 246 for(x=0;x < max_x;x++)
247 if(virtual[y*max_x+x] == 0) 247 if(virtual[y*max_x+x] == 0)
248 line = FALSE; 248 line = false;
249 if(line) 249 if(line)
250 { 250 {
251 lines++; 251 lines++;
diff --git a/uisimulator/tree.c b/uisimulator/tree.c
index 0382547590..1941661bb7 100644
--- a/uisimulator/tree.c
+++ b/uisimulator/tree.c
@@ -19,24 +19,22 @@
19 19
20#include <string.h> 20#include <string.h>
21#include <stdlib.h> 21#include <stdlib.h>
22#include <stdbool.h>
22 23
23#include <dir.h> 24#include "dir.h"
24#include <file.h> 25#include "file.h"
25#include <types.h> 26#include "lcd.h"
26#include <lcd.h> 27#include "button.h"
27#include <button.h>
28#include "kernel.h" 28#include "kernel.h"
29#include "tree.h" 29#include "tree.h"
30
31#include "icons.h" 30#include "icons.h"
32
33#include "play.h" 31#include "play.h"
34 32
35 33
36#define TREE_MAX_FILENAMELEN 128 34#define TREE_MAX_FILENAMELEN 128
37 35
38struct entry { 36struct entry {
39 int file; /* TRUE if file, FALSE if dir */ 37 int file; /* true if file, false if dir */
40 char name[TREE_MAX_FILENAMELEN]; 38 char name[TREE_MAX_FILENAMELEN];
41 int namelen; 39 int namelen;
42}; 40};
@@ -110,7 +108,7 @@ int static showdir(char *path, struct entry *buffer, int start,
110 else 108 else
111 icon_type=Folder; 109 icon_type=Folder;
112 lcd_bitmap(bitmap_icons_6x8[icon_type], 6, MARGIN_Y+i*LINE_HEIGTH, 6, 110 lcd_bitmap(bitmap_icons_6x8[icon_type], 6, MARGIN_Y+i*LINE_HEIGTH, 6,
113 8, TRUE); 111 8, true);
114#endif 112#endif
115 113
116 if(len < TREE_MAX_LEN_DISPLAY) 114 if(len < TREE_MAX_LEN_DISPLAY)
@@ -177,13 +175,13 @@ bool dirbrowse(char *root)
177 } 175 }
178 switch(key) { 176 switch(key) {
179 case BUTTON_OFF: 177 case BUTTON_OFF:
180 return FALSE; 178 return false;
181 break; 179 break;
182 180
183 case BUTTON_LEFT: 181 case BUTTON_LEFT:
184 i=strlen(currdir); 182 i=strlen(currdir);
185 if (i==1) { 183 if (i==1) {
186 return FALSE; 184 return false;
187 } 185 }
188 else { 186 else {
189 while (currdir[i-1]!='/') 187 while (currdir[i-1]!='/')
@@ -286,5 +284,5 @@ bool dirbrowse(char *root)
286 } 284 }
287 } 285 }
288 286
289 return FALSE; 287 return false;
290} 288}
diff --git a/uisimulator/x11/button-x11.c b/uisimulator/x11/button-x11.c
index dc077f03b1..c3afa4b42a 100644
--- a/uisimulator/x11/button-x11.c
+++ b/uisimulator/x11/button-x11.c
@@ -16,7 +16,6 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include "types.h"
20#include "button.h" 19#include "button.h"
21 20
22#include "X11/keysym.h" 21#include "X11/keysym.h"