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

Dependencies:   SMARTGPU2 mbed

Revision:
0:699e70ed46ee
Child:
1:39094523c711
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jul 10 03:30:27 2013 +0000
@@ -0,0 +1,64 @@
+/**************************************************************************************/
+/*SMARTGPU2 intelligent embedded graphics processor unit
+ those examples are for use the SMARTGPU2 with the mbed microcontoller, just connect tx,rx,and reset
+ Board:
+ http://vizictechnologies.com/#/smart-gpu-2/4577779046
+ 
+ www.vizictechnologies.com 
+ Vizic Technologies copyright 2013 */
+/**************************************************************************************/
+
+#include "mbed.h"
+#include "SMARTGPU2.h"
+
+SMARTGPU2 lcd(TXPIN,RXPIN,RESETPIN);  //create our object called "lcd"
+
+char imagesOnSDCard[8][30]={"Penguins","Koala","Hydrangeas","Light House","Jellyfish","Tulips","Desert","Flower"}; //array containing the names of the different called images
+
+/***************************************************/
+/***************************************************/
+void initializeSmartGPU2(void){      //Initialize SMARTGPU2 Board
+  lcd.reset();                       //physically reset SMARTGPU2
+  lcd.start();                       //initialize the SMARTGPU2 processor
+}
+
+/***************************************************/
+/***************************************************/
+/***************************************************/
+/***************************************************/
+int main() {
+  POINT point;
+  char pic=0;
+  unsigned char i=0;
+  NUMBEROFBYTES charsPrinted;
+    
+  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
+  //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            
+    }
+    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.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
+       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);
+    while(lcd.touchScreen(&point)==INVALID);  //Wait for a touch on the screen to show next or previous picture    
+    lcd.erase();
+  }
+}
\ No newline at end of file