Another simple SWIM example

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Another simple SWIM example

Another simple SWIM example

Attached is another simple SWIM demo that setups a 240x320 window and draws an animated diamond in the window as fast as possible. Although the code is meant to be used with the LPC32x0 CDL, it can be easily ported to other devices. The code for setting up the window and doing the animations is below:

/* Create a SWIM window */
swim_window_open(&win1, LCD_DISPLAY.pixels_per_line,
    LCD_DISPLAY.lines_per_panel, fblog1, 0, 0,
    (LCD_DISPLAY.pixels_per_line - 1),
    (LCD_DISPLAY.lines_per_panel - 1), 3, WHITE, BLACK, MAGENTA);

    xf = 20;
    yf = 30;
    xinc = 1;
    yinc = 1;
    clr = RED | GREEN;

    /* Draw as fast as possible, no throttling */
    while (1)
    {
       swim_set_fill_color(&win1, clr);
       swim_put_diamond(&win1, LCD_DISPLAY.pixels_per_line / 2,
       LCD_DISPLAY.lines_per_panel / 2, xf, yf);
       lcd_ioctl(lcddev, LCD_SET_UP_FB, PHY_LCD_FRAME_BUF1);

       xf += xinc;
       if ((xf < 10) || (xf > 150))
           xinc = -xinc;
       yf += yinc;
       if ((yf < 10) || (yf > 230))
           yinc = -yinc;

       clr++;
       if (clr > 0xFFFF)
           clr = RED | GREEN;
    }

The file also includes a pre-built image of the program for use with the Phytec LPC3250 board using S1L. To use the image, just boot the board to the S1L prompt, type "load term srec', send the SREC file to the board via the serial port (no transfer protocol), and then type 'exec' to start it.

評価なし
バージョン履歴
最終更新日:
‎04-25-2016 04:49 PM
更新者: