LCD (4.3inch) Shield sample. While USER_BUTTON0 is pressed, it will save the image to the USB memory.When you use this program, we judge you have agreed to the following contents. https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE

Dependencies:   GR-PEACH_video GraphicsFramework R_BSP USBHost mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "DisplayBace.h"
00003 #include "rtos.h"
00004 #include "JPEG_Converter.h"
00005 #include "USBHostMSD.h"
00006 #include "bitmap.h "
00007 #if defined(TARGET_RZ_A1H)
00008 #include "usb_host_setting.h"
00009 #else
00010 #define USB_HOST_CH            (0)
00011 #endif
00012 
00013 #define VIDEO_CVBS             (0)                 /* Analog  Video Signal */
00014 #define VIDEO_CMOS_CAMERA      (1)                 /* Digital Video Signal */
00015 #define VIDEO_YCBCR422         (0)
00016 #define VIDEO_RGB888           (1)
00017 #define VIDEO_RGB565           (2)
00018 
00019 /**** User Selection *********/
00020 #define VIDEO_INPUT_METHOD     (VIDEO_CMOS_CAMERA) /* Select  VIDEO_CVBS or VIDEO_CMOS_CAMERA                       */
00021 #define VIDEO_INPUT_FORMAT     (VIDEO_YCBCR422)    /* Select  VIDEO_YCBCR422 or VIDEO_RGB888 or VIDEO_RGB565        */
00022 #define USE_VIDEO_CH           (0)                 /* Select  0 or 1            If selecting VIDEO_CMOS_CAMERA, should be 0.)               */
00023 #define VIDEO_PAL              (0)                 /* Select  0(NTSC) or 1(PAL) If selecting VIDEO_CVBS, this parameter is not referenced.) */
00024 /*****************************/
00025  
00026 /**** LCD Parameter **********/
00027 #define LCD_DE_MODE            (0)
00028 #define LCD_SYNC_MODE          (1)
00029 
00030 #define LCD_DOT_CLOCK          (13.40f)            // 13.4MHz
00031 
00032 #define LCD_H_WIDTH            (480u)
00033 #define LCD_H_BACK_PORCH       (43u)
00034 #define LCD_H_FRONT_PORCH      (52u)
00035 #define LCD_H_SYNC_WIDTH       (41u)
00036 
00037 #define LCD_V_WIDTH            (272u)
00038 #define LCD_V_BACK_PORCH       (12u)
00039 #define LCD_V_FRONT_PORCH      (2u)
00040 #define LCD_V_SYNC_WIDTH       (10u)
00041 
00042 #define LCD_MODE               (LCD_SYNC_MODE)
00043 
00044 /*****************************/
00045 
00046 
00047 #if USE_VIDEO_CH == (0)
00048 #define VIDEO_INPUT_CH         (DisplayBase::VIDEO_INPUT_CHANNEL_0)
00049 #define VIDEO_INT_TYPE         (DisplayBase::INT_TYPE_S0_VFIELD)
00050 #else
00051 #define VIDEO_INPUT_CH         (DisplayBase::VIDEO_INPUT_CHANNEL_1)
00052 #define VIDEO_INT_TYPE         (DisplayBase::INT_TYPE_S1_VFIELD)
00053 #endif
00054 
00055 #if ( VIDEO_INPUT_FORMAT == VIDEO_YCBCR422 || VIDEO_INPUT_FORMAT == VIDEO_RGB565 )
00056 #define DATA_SIZE_PER_PIC      (2u)
00057 #else
00058 #define DATA_SIZE_PER_PIC      (4u)
00059 #endif
00060 
00061 /*! Frame buffer stride: Frame buffer stride should be set to a multiple of 32 or 128
00062     in accordance with the frame buffer burst transfer mode. */
00063 #define PIXEL_HW               (480u)  /* WQVGA */
00064 #define PIXEL_VW               (272u)  /* WQVGA */
00065 
00066 #define VIDEO_BUFFER_STRIDE    (((PIXEL_HW * DATA_SIZE_PER_PIC) + 31u) & ~31u)
00067 #define VIDEO_BUFFER_HEIGHT    (PIXEL_VW)
00068 
00069 #if (USB_HOST_CH == 1) //Audio Camera Shield USB1
00070 DigitalOut usb1en(P3_8);
00071 #endif
00072 DigitalOut led1(LED1);
00073 DigitalIn  button(USER_BUTTON0);
00074 #if(1) //lcd
00075 DigitalOut lcd_pwon(P7_15);
00076 DigitalOut lcd_blon(P8_1);
00077 DigitalOut touch_reset(P4_0);
00078 PwmOut     lcd_cntrst(P8_15);
00079 I2C        mI2c(I2C_SDA, I2C_SCL);
00080 
00081 typedef struct {
00082     uint8_t y_h: 3,
00083     reserved: 1,
00084     x_h: 3,
00085     valid: 1;
00086     uint8_t x_l;
00087     uint8_t y_l;
00088 } xyz_data_t;
00089 
00090 typedef struct {
00091     uint8_t fingers: 3,
00092     reserved: 5;
00093     uint8_t keys;
00094     xyz_data_t xyz_data[2];
00095 } stx_report_data_t;
00096 
00097 static int get_coordinates(uint8_t *count, uint32_t *x0, uint32_t *y0, uint32_t *x1, uint32_t *y1) {
00098     char buf[8];
00099     stx_report_data_t *pdata;
00100     int ret = -1;
00101     *count = 0; // Set point detected count to 0.
00102 
00103     if (mI2c.read((0x55 << 1), buf, sizeof(buf)) == 0) {
00104         pdata = (stx_report_data_t *)buf;
00105         if (pdata->fingers) {
00106             if (pdata->xyz_data[0].valid) {
00107                 *x0 = (pdata->xyz_data[0].x_h << 8) | pdata->xyz_data[0].x_l;
00108                 *y0 = (pdata->xyz_data[0].y_h << 8) | pdata->xyz_data[0].y_l;
00109                 (*count)++;
00110             }
00111         }
00112         if (pdata->xyz_data[1].valid) {
00113             *x1 = (pdata->xyz_data[1].x_h << 8) | pdata->xyz_data[1].x_l;
00114             *y1 = (pdata->xyz_data[1].y_h << 8) | pdata->xyz_data[1].y_l;
00115             (*count)++;
00116         }
00117         ret = 0;
00118     }
00119 
00120     return ret;
00121 }
00122 #endif
00123 
00124 static uint8_t FrameBuffer_Video_A[VIDEO_BUFFER_STRIDE * VIDEO_BUFFER_HEIGHT]__attribute((section("NC_BSS"),aligned(16)));  //16 bytes aligned!;
00125 static uint8_t FrameBuffer_Video_B[VIDEO_BUFFER_STRIDE * VIDEO_BUFFER_HEIGHT]__attribute((section("NC_BSS"),aligned(16)));  //16 bytes aligned!;
00126 static uint8_t JCUBuffer_OUTPUT[VIDEO_BUFFER_STRIDE * VIDEO_BUFFER_HEIGHT]__attribute((section("NC_BSS"),aligned(8)));  //8 bytes aligned!;
00127 static volatile int32_t vfield_count;
00128 static volatile int32_t vsync_count;
00129 
00130 static void IntCallbackFunc_Vfield(DisplayBase::int_type_t int_type)
00131 {
00132     //Interrupt callback function
00133     if (vfield_count != 0) {
00134         vfield_count = 0;
00135     }
00136 }
00137 
00138 static void WaitVfield(const int32_t wait_count)
00139 {
00140     vfield_count = wait_count;
00141     while (vfield_count > 0) {
00142         /* Do nothing */
00143     }
00144 }
00145  
00146 static void IntCallbackFunc_Vsync(DisplayBase::int_type_t int_type)
00147 {
00148     //Interrupt callback function for Vsync interruption
00149     if (vsync_count > 0) {
00150         vsync_count--;
00151     }
00152 }
00153 
00154 static void WaitVsync(const int32_t wait_count)
00155 {
00156     //Wait for the specified number of times Vsync occurs
00157     vsync_count = wait_count;
00158     while (vsync_count > 0) {
00159         /* Do nothing */
00160     }
00161 }
00162 
00163 int main(void)
00164 {
00165     /* Create DisplayBase object */
00166     DisplayBase Display;
00167     DisplayBase::graphics_error_t error;
00168     JPEG_Converter decoder;
00169     JPEG_Converter::bitmap_buff_info_t aBitmapData;
00170     FILE * wr_fp = NULL;
00171     size_t EncodeSize;
00172     uint8_t * write_buff_addr = FrameBuffer_Video_A;
00173     uint8_t * save_buff_addr  = FrameBuffer_Video_B;
00174 
00175 
00176 #if VIDEO_INPUT_METHOD == VIDEO_CMOS_CAMERA
00177     DisplayBase::video_ext_in_config_t ext_in_config;
00178     PinName cmos_camera_pin[11] = {
00179         /* data pin */
00180         P2_7, P2_6, P2_5, P2_4, P2_3, P2_2, P2_1, P2_0,
00181         /* control pin */
00182         P10_0,      /* DV0_CLK   */
00183         P1_0,       /* DV0_Vsync */
00184         P1_1        /* DV0_Hsync */
00185     };
00186 #endif
00187 #if(1) //lcd
00188     lcd_pwon = 0;
00189     lcd_blon = 0;
00190     touch_reset = 0;
00191     Thread::wait(100);
00192  
00193     lcd_pwon = 1;
00194     lcd_blon = 1;
00195     touch_reset = 1;
00196     Thread::wait(100);
00197 
00198     DisplayBase::lcd_config_t lcd_config;
00199     PinName lvds_pin[8] = {
00200         /* data pin */
00201         P5_7, P5_6, P5_5, P5_4, P5_3, P5_2, P5_1, P5_0
00202     };
00203     DisplayBase::rect_t rect;
00204 
00205     lcd_config.lcd_type             = DisplayBase::LCD_TYPE_LVDS;
00206     lcd_config.intputClock          = 66.67f;
00207     lcd_config.outputClock          = LCD_DOT_CLOCK;
00208     lcd_config.lcd_outformat        = DisplayBase::LCD_OUTFORMAT_RGB888;
00209     lcd_config.lcd_edge             = DisplayBase::EDGE_RISING;
00210 #if(LCD_MODE) //SYNC Mode
00211     lcd_config.h_toatal_period      = (LCD_H_BACK_PORCH + LCD_H_WIDTH + LCD_H_FRONT_PORCH);
00212     lcd_config.v_toatal_period      = (LCD_V_BACK_PORCH + LCD_V_WIDTH + LCD_V_FRONT_PORCH);
00213  
00214     lcd_config.h_disp_widht         = (LCD_H_WIDTH);
00215     lcd_config.v_disp_widht         = (LCD_V_WIDTH);
00216     lcd_config.h_back_porch         = (LCD_H_BACK_PORCH);
00217     lcd_config.v_back_porch         = (LCD_V_BACK_PORCH);
00218  
00219     lcd_config.h_sync_port          = DisplayBase::LCD_TCON_PIN_2;
00220     lcd_config.h_sync_port_polarity = DisplayBase::SIG_POL_INVERTED;
00221     lcd_config.h_sync_width         = LCD_H_SYNC_WIDTH;
00222  
00223     lcd_config.v_sync_port          = DisplayBase::LCD_TCON_PIN_0;
00224     lcd_config.v_sync_port_polarity = DisplayBase::SIG_POL_INVERTED;
00225     lcd_config.v_sync_width         = LCD_V_SYNC_WIDTH;
00226  
00227     lcd_config.de_port              = DisplayBase::LCD_TCON_PIN_3;
00228     lcd_config.de_port_polarity     = DisplayBase::SIG_POL_NOT_INVERTED;
00229 #else  //DE Mode
00230     lcd_config.h_toatal_period      = (LCD_H_WIDTH + 80u);
00231     lcd_config.v_toatal_period      = (LCD_V_WIDTH);
00232 
00233     lcd_config.h_disp_widht         = (LCD_H_WIDTH);
00234     lcd_config.v_disp_widht         = (LCD_V_WIDTH);
00235     lcd_config.h_back_porch         = (68u);
00236     lcd_config.v_back_porch         = (18u);
00237 
00238     lcd_config.h_sync_port          = DisplayBase::LCD_TCON_PIN_NON;
00239     lcd_config.h_sync_port_polarity = DisplayBase::SIG_POL_NOT_INVERTED;
00240     lcd_config.h_sync_width         = 0;
00241 
00242     lcd_config.v_sync_port          = DisplayBase::LCD_TCON_PIN_NON;
00243     lcd_config.v_sync_port_polarity = DisplayBase::SIG_POL_NOT_INVERTED;
00244     lcd_config.v_sync_width         = 0;
00245 
00246     lcd_config.de_port              = DisplayBase::LCD_TCON_PIN_3;
00247     lcd_config.de_port_polarity     = DisplayBase::SIG_POL_INVERTED;
00248 #endif
00249 
00250     /* Graphics initialization process */
00251     error = Display.Graphics_init(&lcd_config);
00252 #else
00253     /* Graphics initialization process */
00254     error = Display.Graphics_init(NULL);
00255 #endif
00256 
00257     if (error != DisplayBase::GRAPHICS_OK) {
00258         printf("Line %d, error %d\n", __LINE__, error);
00259         while (1);
00260     }
00261 
00262 #if VIDEO_INPUT_METHOD == VIDEO_CVBS
00263     error = Display.Graphics_Video_init( DisplayBase::INPUT_SEL_VDEC, NULL);
00264     if( error != DisplayBase::GRAPHICS_OK ) {
00265         printf("Line %d, error %d\n", __LINE__, error);
00266         while(1);
00267     }
00268 
00269 #elif VIDEO_INPUT_METHOD == VIDEO_CMOS_CAMERA
00270     /* MT9V111 camera input config */
00271     ext_in_config.inp_format     = DisplayBase::VIDEO_EXTIN_FORMAT_BT601; /* BT601 8bit YCbCr format */
00272     ext_in_config.inp_pxd_edge   = DisplayBase::EDGE_RISING;              /* Clock edge select for capturing data          */
00273     ext_in_config.inp_vs_edge    = DisplayBase::EDGE_RISING;              /* Clock edge select for capturing Vsync signals */
00274     ext_in_config.inp_hs_edge    = DisplayBase::EDGE_RISING;              /* Clock edge select for capturing Hsync signals */
00275     ext_in_config.inp_endian_on  = DisplayBase::OFF;                      /* External input bit endian change on/off       */
00276     ext_in_config.inp_swap_on    = DisplayBase::OFF;                      /* External input B/R signal swap on/off         */
00277     ext_in_config.inp_vs_inv     = DisplayBase::SIG_POL_NOT_INVERTED;     /* External input DV_VSYNC inversion control     */
00278     ext_in_config.inp_hs_inv     = DisplayBase::SIG_POL_INVERTED;         /* External input DV_HSYNC inversion control     */
00279     ext_in_config.inp_f525_625   = DisplayBase::EXTIN_LINE_525;           /* Number of lines for BT.656 external input */
00280     ext_in_config.inp_h_pos      = DisplayBase::EXTIN_H_POS_CRYCBY;       /* Y/Cb/Y/Cr data string start timing to Hsync reference */
00281     ext_in_config.cap_vs_pos     = 6;                                     /* Capture start position from Vsync */
00282     ext_in_config.cap_hs_pos     = 150;                                   /* Capture start position form Hsync */
00283     ext_in_config.cap_width      = 640;                                   /* Capture width  */
00284     ext_in_config.cap_height     = 468u;                                  /* Capture height Max 468[line]
00285                                                                              Due to CMOS(MT9V111) output signal timing and VDC5 specification */
00286     error = Display.Graphics_Video_init( DisplayBase::INPUT_SEL_EXT, &ext_in_config);
00287     if( error != DisplayBase::GRAPHICS_OK ) {
00288         printf("Line %d, error %d\n", __LINE__, error);
00289         while(1);
00290     }
00291 
00292     /* MT9V111 camera input port setting */
00293     error = Display.Graphics_Dvinput_Port_Init(cmos_camera_pin, 11);
00294     if( error != DisplayBase::GRAPHICS_OK ) {
00295         printf("Line %d, error %d\n", __LINE__, error);
00296         while (1);
00297     }
00298 #endif
00299 
00300     /* Interrupt callback function setting (Vsync signal output from scaler 0) */
00301     error = Display.Graphics_Irq_Handler_Set(DisplayBase::INT_TYPE_S0_LO_VSYNC, 0, IntCallbackFunc_Vsync);
00302     if (error != DisplayBase::GRAPHICS_OK) {
00303         printf("Line %d, error %d\n", __LINE__, error);
00304         while (1);
00305     }
00306     /* Video capture setting (progressive form fixed) */
00307     error = Display.Video_Write_Setting(
00308                 VIDEO_INPUT_CH,
00309 #if VIDEO_PAL == 0
00310                 DisplayBase::COL_SYS_NTSC_358,
00311 #else
00312                 DisplayBase::COL_SYS_PAL_443,
00313 #endif
00314                 write_buff_addr,
00315                 VIDEO_BUFFER_STRIDE,
00316 #if VIDEO_INPUT_FORMAT == VIDEO_YCBCR422
00317                 DisplayBase::VIDEO_FORMAT_YCBCR422,
00318                 DisplayBase::WR_RD_WRSWA_NON,
00319 #elif VIDEO_INPUT_FORMAT == VIDEO_RGB565
00320                 DisplayBase::VIDEO_FORMAT_RGB565,
00321                 DisplayBase::WR_RD_WRSWA_32_16BIT,
00322 #else
00323                 DisplayBase::VIDEO_FORMAT_RGB888,
00324                 DisplayBase::WR_RD_WRSWA_32BIT,
00325 #endif
00326                 PIXEL_VW,
00327                 PIXEL_HW
00328             );
00329     if (error != DisplayBase::GRAPHICS_OK) {
00330         printf("Line %d, error %d\n", __LINE__, error);
00331         while (1);
00332     }
00333 
00334     /* Interrupt callback function setting (Field end signal for recording function in scaler 0) */
00335     error = Display.Graphics_Irq_Handler_Set(VIDEO_INT_TYPE, 0, IntCallbackFunc_Vfield);
00336     if (error != DisplayBase::GRAPHICS_OK) {
00337         printf("Line %d, error %d\n", __LINE__, error);
00338         while (1);
00339     }
00340 
00341     /* Video write process start */
00342     error = Display.Video_Start (VIDEO_INPUT_CH);
00343     if (error != DisplayBase::GRAPHICS_OK) {
00344         printf("Line %d, error %d\n", __LINE__, error);
00345         while (1);
00346     }
00347 
00348     /* Video write process stop */
00349     error = Display.Video_Stop (VIDEO_INPUT_CH);
00350     if (error != DisplayBase::GRAPHICS_OK) {
00351         printf("Line %d, error %d\n", __LINE__, error);
00352         while (1);
00353     }
00354 
00355     /* Video write process start */
00356     error = Display.Video_Start (VIDEO_INPUT_CH);
00357     if (error != DisplayBase::GRAPHICS_OK) {
00358         printf("Line %d, error %d\n", __LINE__, error);
00359         while (1);
00360     }
00361 
00362     /* Wait vsync to update resister */
00363     WaitVsync(1);
00364  
00365     /* Wait 2 Vfield(Top or bottom field) */
00366     WaitVfield(2);
00367 
00368 #if (USB_HOST_CH == 1) //Audio Shield USB1
00369     //Audio Shield USB1 enable
00370     usb1en = 1;        //Outputs high level
00371     Thread::wait(5);
00372     usb1en = 0;        //Outputs low level
00373 #endif
00374     USBHostMSD msd("usb");
00375     char file_name[32];
00376     int file_name_index = 0;
00377     int save_file_size;
00378 
00379 #if(1) //lcd
00380     Display.Graphics_Lvds_Port_Init(lvds_pin, 8);
00381     rect.vs = 0;
00382     rect.vw = PIXEL_VW;
00383     rect.hs = 0;
00384     rect.hw = PIXEL_HW;
00385 
00386     Display.Graphics_Read_Setting(
00387         DisplayBase::GRAPHICS_LAYER_0,
00388         (void *)write_buff_addr,
00389         VIDEO_BUFFER_STRIDE,
00390 #if VIDEO_INPUT_FORMAT == VIDEO_YCBCR422
00391         DisplayBase::GRAPHICS_FORMAT_YCBCR422,
00392         DisplayBase::WR_RD_WRSWA_NON,
00393 #elif VIDEO_INPUT_FORMAT == VIDEO_RGB565
00394         DisplayBase::GRAPHICS_FORMAT_RGB565,
00395         DisplayBase::WR_RD_WRSWA_32_16BIT,
00396 #else
00397         DisplayBase::GRAPHICS_FORMAT_RGB888,
00398         DisplayBase::WR_RD_WRSWA_32BIT,
00399 #endif
00400         &rect
00401     );
00402     Display.Graphics_Start(DisplayBase::GRAPHICS_LAYER_0);
00403 
00404     lcd_cntrst.write(1.0);
00405 
00406     while (1) {
00407         uint8_t count = 0;
00408         uint32_t x0 = 0;
00409         uint32_t y0 = 0;
00410         uint32_t x1 = 0;
00411         uint32_t y1 = 0;
00412 
00413         /* button check */
00414         if (button == 0) {
00415             if (!msd.connect()) {
00416                 printf("Device disconnected\n");
00417             } else {
00418                 led1 = 1;
00419                 if (write_buff_addr == FrameBuffer_Video_A) {
00420                     write_buff_addr = FrameBuffer_Video_B;
00421                     save_buff_addr  = FrameBuffer_Video_A;
00422                 } else {
00423                     write_buff_addr = FrameBuffer_Video_A;
00424                     save_buff_addr  = FrameBuffer_Video_B;
00425                 }
00426     
00427                 /* Change write buffer */
00428                 error = Display.Video_Write_Change(
00429                             VIDEO_INPUT_CH,
00430                             write_buff_addr,
00431                             VIDEO_BUFFER_STRIDE);
00432                 if (error != DisplayBase::GRAPHICS_OK) {
00433                     printf("Line %d, error %d\n", __LINE__, error);
00434                     while (1);
00435                 }
00436                 /* Wait 2 Vfield(Top or bottom field) */
00437                 WaitVfield(2);
00438     
00439                 /* FrameBuffer_Video_A or FrameBuffer_Video_B capture completed */
00440                 printf("USB connect checking...\n");
00441                 while (!msd.connected()) {
00442                     if (!msd.connect()) {
00443                         Thread::wait(500);
00444                     } else {
00445                         break;
00446                     }
00447                 }
00448                 printf("USB connect check OK!\n");
00449     
00450                 /* Data save */
00451 #if ( VIDEO_INPUT_FORMAT == VIDEO_RGB565 )
00452                 /* Save ".bin" file */
00453                 sprintf(file_name, "/usb/video_%d.bin", file_name_index++);
00454                 FILE * fp = fopen(file_name, "w");
00455                 save_file_size = fwrite(save_buff_addr, sizeof(char), (VIDEO_BUFFER_STRIDE * VIDEO_BUFFER_HEIGHT), fp);
00456                 fclose(fp);
00457 #elif ( VIDEO_INPUT_FORMAT == VIDEO_YCBCR422 )
00458                 /* Save ".jpg" file */
00459                 sprintf(file_name, "/usb/image_%d.jpg", file_name_index++);
00460                 //YCbCr setting
00461                 aBitmapData.width           = PIXEL_HW;
00462                 aBitmapData.height          = PIXEL_VW;
00463                 aBitmapData.format          = JPEG_Converter::WR_RD_YCbCr422;   //YCbCr[0] & ARGB8888[1] is 4byte, not RGB565[2] is 2byte
00464                 aBitmapData.buffer_address  = save_buff_addr;
00465                 printf("File encode start\n");
00466                 // JPEG_Converter
00467                 if (decoder.encode(&aBitmapData, JCUBuffer_OUTPUT, &EncodeSize) == JPEG_Converter::JPEG_CONV_OK) {
00468                     printf("File encode done\n");
00469                     printf("File write start\n");
00470                     wr_fp = fopen(file_name, "w");
00471                     save_file_size = fwrite(JCUBuffer_OUTPUT, sizeof(char), EncodeSize, wr_fp);
00472                     fclose(wr_fp);
00473                     printf("File write done\n");
00474                     led1 = 0;
00475                 } else {
00476                     printf("Error:JCU encode error\n");
00477                     led1 = 0;
00478                 }
00479 #else
00480                 /* Save ".bmp" file */
00481                 sprintf(file_name, "/usb/video_%d.bmp", file_name_index++);
00482     
00483                 bitmap bitmapfile;
00484                 save_file_size = bitmapfile.Rgb888ToBmp(file_name, save_buff_addr, PIXEL_HW, PIXEL_VW);
00485 #endif
00486                 printf("file name : %s, file size : %d\n", file_name, save_file_size);
00487     
00488                 /* Swap frame buffer */
00489                 Display.Graphics_Read_Change(
00490                             DisplayBase::GRAPHICS_LAYER_0,
00491                             write_buff_addr);
00492                 /* Wait vsync to update resister */
00493                 WaitVsync(1);
00494                 led1 = 0;
00495             }
00496         }
00497 
00498         /* coordinates check */
00499         get_coordinates(&count, &x0, &y0, &x1, &y1);
00500         if (count != 0) {
00501             printf("count=%d, {X=%d,Y=%d}, {X=%d,Y=%d} \n", count, x0, y0, x1, y1);
00502         }
00503         Thread::wait(100);
00504     }
00505 #endif
00506 }