Vizic Technologies
/
GalleryJPG_SG2
JPG Images decompression from the microSD card using SmartGPU2 board - MBED + SmartGPU2 board
main.cpp
- Committer:
- emmanuelchio
- Date:
- 2014-04-17
- Revision:
- 1:39094523c711
- Parent:
- 0:699e70ed46ee
- Child:
- 2:b40561f97cc5
File content as of revision 1:39094523c711:
/**************************************************************************************/ /**************************************************************************************/ /*SMARTGPU2 intelligent embedded graphics processor unit those examples are for using the SMARTGPU2 with the mbed microcontoller, just connect tx,rx,and reset Board: http://www.vizictechnologies.com/ www.vizictechnologies.com Vizic Technologies copyright 2014 */ /**************************************************************************************/ /**************************************************************************************/ #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(); } }