lcd_gfx_hwtest.c

Go to the documentation of this file.
00001 
00042 #warning FIXME: broken test!
00043 
00044 #if 0
00045 
00046 #include <drv/lcd_gfx.h>
00047 #include <gfx/gfx.h>
00048 
00049 #include <emul/emul.h>
00050 
00051 static void magic(struct Bitmap *bitmap, coord_t x, coord_t y)
00052 {
00053     static const coord_t coords[] = { 120, 34, 90, 90, 30, 90, 0, 34, 60, 0, 90, 90, 0, 34, 120, 34, 30, 90, 60, 0 };
00054     unsigned int i;
00055 
00056     gfx_moveTo(bitmap, coords[countof(coords)-2]/2 + x, coords[countof(coords)-1]/3 + y);
00057     for (i = 0; i < countof(coords); i += 2)
00058         gfx_lineTo(bitmap, coords[i]/2 + x, coords[i+1]/3 + y);
00059 }
00060 
00061 int main(int argc, char *argv[])
00062 {
00063     emul_init(&argc, argv);
00064     lcd_init();
00065 
00066     coord_t x = 0, y = LCD_WIDTH / 2;
00067     coord_t xdir = +1, ydir = -1;
00068     Bitmap *bm = &lcd_bitmap;
00069 
00070     for(;;)
00071     {
00072         gfx_bitmapClear(bm);
00073         gfx_setClipRect(bm, 0, 0, bm->width, bm->height);
00074         gfx_rectDraw(bm, 10, 10, bm->width-10, bm->height-10);
00075         gfx_setClipRect(bm, 11, 11, bm->width-11, bm->height-11);
00076         magic(bm, x, y);
00077 
00078         x += xdir;
00079         y += ydir;
00080         if (x >= bm->width)  xdir = -1;
00081         if (x <= -50)        xdir = +1;
00082         if (y >= bm->height) ydir = -1;
00083         if (y <= -50)        ydir = +1;
00084 
00085         lcd_blit_bitmap(bm);
00086         emul_idle();
00087         usleep(10000);
00088     }
00089 
00090     emul_cleanup();
00091     return 0;
00092 }
00093 
00094 #endif