JPG Images decompression from the microSD card using SmartGPU2 board - MBED + SmartGPU2 board

Dependencies:   SMARTGPU2 mbed

Files at this revision

API Documentation at this revision

Comitter:
emmanuelchio
Date:
Fri Apr 18 00:51:42 2014 +0000
Parent:
1:39094523c711
Commit message:
SmartGPU2 GalleryJPG_SG2 demo- Please select(uncomment) your smartGPU2 board under SMARTGPU2.h file before compiling!!!

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 39094523c711 -r b40561f97cc5 main.cpp
--- a/main.cpp	Thu Apr 17 21:46:19 2014 +0000
+++ b/main.cpp	Fri Apr 18 00:51:42 2014 +0000
@@ -37,30 +37,31 @@
     
   initializeSmartGPU2();             //Init communication with SmartGPU2 board
   
-  lcd.baudChange(BAUD7);             //set a fast baud! for fast drawing
-  lcd.SDFopenDir("JPG Images");            // Open the JPG Images that contains the images
+  lcd.baudChange(BAUD6);             //set a fast baud! for fast drawing
+  lcd.SDFopenDir("JPG Images");      // Open the JPG Images that contain the jpg images
   //strings config
   lcd.setTextColour(GREEN);
   lcd.setTextSize(FONT1);  
   
   while(1){   //Loop forever in the slide show!
     for(i=0;i<4;i++){
-      lcd.imageJPGSD(i*80,40,SCALE1_4,imagesOnSDCard[i]); //Load image from SD card, all images are 320x240(full screen) so we load them from top left corner X:0,Y:0            
+      lcd.imageJPGSD(i*(LCD_WIDTH/4),(LCD_HEIGHT/8),SCALE1_4,imagesOnSDCard[i]);     //Load image from SD card            
     }
     for(i=0;i<4;i++){
-      lcd.imageJPGSD(i*80,140,SCALE1_4,imagesOnSDCard[i+4]); //Load image from SD card, all images are 320x240(full screen) so we load them from top left corner X:0,Y:0            
+      lcd.imageJPGSD(i*(LCD_WIDTH/4),(LCD_HEIGHT/8)*5,SCALE1_4,imagesOnSDCard[i+4]); //Load image from SD card            
     }
+
+    lcd.string(LCD_WIDTH/5,10,MAX_X_LANDSCAPE,MAX_Y_LANDSCAPE,"Touch image to load!",&charsPrinted);
+    while(lcd.touchScreen(&point)==INVALID);  //Wait for a touch on the screen to show next or previous picture    
+    lcd.erase();
     
-    lcd.string(70,10,319,239,"Touch image to load!",&charsPrinted);
-    while(lcd.touchScreen(&point)==INVALID);  //Wait for a touch on the screen to show next or previous picture    
-    
-    if(point.y<120){             //touch on upper part
+    if(point.y<(LCD_HEIGHT/2)){    //touch on upper part
        lcd.imageJPGSD(0,0,SCALE1_1,imagesOnSDCard[point.x/(LCD_WIDTH/4)]); //Load image from SD card, all images are 320x240(full screen) so we load them from top left corner X:0,Y:0        
     }else{                       //touch on upper part
        lcd.imageJPGSD(0,0,SCALE1_1,imagesOnSDCard[(point.x/(LCD_WIDTH/4))+4]); //Load image from SD card, all images are 320x240(full screen) so we load them from top left corner X:0,Y:0                    
     }
-    
-    lcd.string(70,215,319,239,"Touch image to exit!",&charsPrinted);
+
+    lcd.string(LCD_WIDTH/5,LCD_HEIGHT-25,MAX_X_LANDSCAPE,MAX_Y_LANDSCAPE,"Touch image to exit!",&charsPrinted); 
     while(lcd.touchScreen(&point)==INVALID);  //Wait for a touch on the screen to show next or previous picture    
     lcd.erase();
   }