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

Dependencies:   SMARTGPU2 mbed

Committer:
emmanuelchio
Date:
Thu Apr 17 21:46:19 2014 +0000
Revision:
1:39094523c711
Parent:
0:699e70ed46ee
Child:
2:b40561f97cc5
SmartGPU2 GalleryJPG_SG2 demo- Please select(uncomment) your smartGPU2 board under SMARTGPU2.h file before compiling!!!

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emmanuelchio 1:39094523c711 1 /**************************************************************************************/
emmanuelchio 0:699e70ed46ee 2 /**************************************************************************************/
emmanuelchio 0:699e70ed46ee 3 /*SMARTGPU2 intelligent embedded graphics processor unit
emmanuelchio 1:39094523c711 4 those examples are for using the SMARTGPU2 with the mbed microcontoller, just connect tx,rx,and reset
emmanuelchio 0:699e70ed46ee 5 Board:
emmanuelchio 1:39094523c711 6 http://www.vizictechnologies.com/
emmanuelchio 0:699e70ed46ee 7
emmanuelchio 0:699e70ed46ee 8 www.vizictechnologies.com
emmanuelchio 1:39094523c711 9 Vizic Technologies copyright 2014 */
emmanuelchio 0:699e70ed46ee 10 /**************************************************************************************/
emmanuelchio 1:39094523c711 11 /**************************************************************************************/
emmanuelchio 1:39094523c711 12
emmanuelchio 0:699e70ed46ee 13
emmanuelchio 0:699e70ed46ee 14 #include "mbed.h"
emmanuelchio 0:699e70ed46ee 15 #include "SMARTGPU2.h"
emmanuelchio 0:699e70ed46ee 16
emmanuelchio 0:699e70ed46ee 17 SMARTGPU2 lcd(TXPIN,RXPIN,RESETPIN); //create our object called "lcd"
emmanuelchio 0:699e70ed46ee 18
emmanuelchio 0:699e70ed46ee 19 char imagesOnSDCard[8][30]={"Penguins","Koala","Hydrangeas","Light House","Jellyfish","Tulips","Desert","Flower"}; //array containing the names of the different called images
emmanuelchio 0:699e70ed46ee 20
emmanuelchio 0:699e70ed46ee 21 /***************************************************/
emmanuelchio 0:699e70ed46ee 22 /***************************************************/
emmanuelchio 0:699e70ed46ee 23 void initializeSmartGPU2(void){ //Initialize SMARTGPU2 Board
emmanuelchio 0:699e70ed46ee 24 lcd.reset(); //physically reset SMARTGPU2
emmanuelchio 0:699e70ed46ee 25 lcd.start(); //initialize the SMARTGPU2 processor
emmanuelchio 0:699e70ed46ee 26 }
emmanuelchio 0:699e70ed46ee 27
emmanuelchio 0:699e70ed46ee 28 /***************************************************/
emmanuelchio 0:699e70ed46ee 29 /***************************************************/
emmanuelchio 0:699e70ed46ee 30 /***************************************************/
emmanuelchio 0:699e70ed46ee 31 /***************************************************/
emmanuelchio 0:699e70ed46ee 32 int main() {
emmanuelchio 0:699e70ed46ee 33 POINT point;
emmanuelchio 0:699e70ed46ee 34 char pic=0;
emmanuelchio 0:699e70ed46ee 35 unsigned char i=0;
emmanuelchio 0:699e70ed46ee 36 NUMBEROFBYTES charsPrinted;
emmanuelchio 0:699e70ed46ee 37
emmanuelchio 0:699e70ed46ee 38 initializeSmartGPU2(); //Init communication with SmartGPU2 board
emmanuelchio 0:699e70ed46ee 39
emmanuelchio 0:699e70ed46ee 40 lcd.baudChange(BAUD7); //set a fast baud! for fast drawing
emmanuelchio 0:699e70ed46ee 41 lcd.SDFopenDir("JPG Images"); // Open the JPG Images that contains the images
emmanuelchio 0:699e70ed46ee 42 //strings config
emmanuelchio 0:699e70ed46ee 43 lcd.setTextColour(GREEN);
emmanuelchio 0:699e70ed46ee 44 lcd.setTextSize(FONT1);
emmanuelchio 0:699e70ed46ee 45
emmanuelchio 0:699e70ed46ee 46 while(1){ //Loop forever in the slide show!
emmanuelchio 0:699e70ed46ee 47 for(i=0;i<4;i++){
emmanuelchio 0:699e70ed46ee 48 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
emmanuelchio 0:699e70ed46ee 49 }
emmanuelchio 0:699e70ed46ee 50 for(i=0;i<4;i++){
emmanuelchio 0:699e70ed46ee 51 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
emmanuelchio 0:699e70ed46ee 52 }
emmanuelchio 0:699e70ed46ee 53
emmanuelchio 0:699e70ed46ee 54 lcd.string(70,10,319,239,"Touch image to load!",&charsPrinted);
emmanuelchio 0:699e70ed46ee 55 while(lcd.touchScreen(&point)==INVALID); //Wait for a touch on the screen to show next or previous picture
emmanuelchio 0:699e70ed46ee 56
emmanuelchio 0:699e70ed46ee 57 if(point.y<120){ //touch on upper part
emmanuelchio 0:699e70ed46ee 58 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
emmanuelchio 0:699e70ed46ee 59 }else{ //touch on upper part
emmanuelchio 0:699e70ed46ee 60 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
emmanuelchio 0:699e70ed46ee 61 }
emmanuelchio 0:699e70ed46ee 62
emmanuelchio 0:699e70ed46ee 63 lcd.string(70,215,319,239,"Touch image to exit!",&charsPrinted);
emmanuelchio 0:699e70ed46ee 64 while(lcd.touchScreen(&point)==INVALID); //Wait for a touch on the screen to show next or previous picture
emmanuelchio 0:699e70ed46ee 65 lcd.erase();
emmanuelchio 0:699e70ed46ee 66 }
emmanuelchio 0:699e70ed46ee 67 }