adsense

2011-10-20

[嵌入式] 往右抹去


/*
 *  Copyright (C) 2008 by National Chip Implementation Center
 *  Author: ycchang <yaochung@cic.org.tw>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include "EX_LCD_V.h"
#include "image.h"
#include "image1.h"

#define DELAY_TIME 100000

unsigned int base = 0x10000000;
int LCDHSize  = 320, LCDVSize = 240, PixelSize = 3;
char *image;

void clean_screen();
void delay(unsigned int);
void move_right();
void move_rightdown();

int main()
{
    int i,j,k;
    int flag = 0;

    //uart_init ();

    /* turn on lcd */
    lcdc_init ();

    memset ((char *) base, 0xff, LCDHSize*LCDVSize*PixelSize);
    // clean screen
    clean_screen();

    // show images
    LCDC_FRAMEBASE = base;
    while (1) {
     flag ^= 1;
     image = (flag) ? imagebits : imagebits1;

for (i=0; i<LCDHSize; i++)
          for (j=0; j<LCDVSize; j++) {
             for (k=0; k<PixelSize; k++)
                 (*((char *)(base + j * LCDHSize * PixelSize + i * PixelSize + k))) =
                 image[j * LCDHSize * PixelSize + i * PixelSize + k];
        }
     // show onto LCD
LCDC_FRAMEBASE = base;
        delay(DELAY_TIME);
     }
exit (0);
//while (1);
}

// clean screen
void clean_screen()
{
    int i,j,k;
  
for (i=0; i<LCDVSize; i++)
        for (j=0; j<LCDHSize; j++) {
            for (k=0; k<PixelSize; k++)
                (*((char *)(base + i * LCDHSize * PixelSize + j * PixelSize + k))) = 0x00;
        }
    // show onto LCD
LCDC_FRAMEBASE = base;
}

// delay time
void delay(unsigned int count)
{
    for(;count>0;count--)
        ;
}

沒有留言:

張貼留言