![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
JPG Images decompression from the microSD card using SmartGPU2 board - MBED + SmartGPU2 board
main.cpp@0:699e70ed46ee, 2013-07-10 (annotated)
- Committer:
- emmanuelchio
- Date:
- Wed Jul 10 03:30:27 2013 +0000
- Revision:
- 0:699e70ed46ee
- Child:
- 1:39094523c711
JPG Images Gallery Demo - MBED + SmartGPU2 board
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emmanuelchio | 0:699e70ed46ee | 1 | /**************************************************************************************/ |
emmanuelchio | 0:699e70ed46ee | 2 | /*SMARTGPU2 intelligent embedded graphics processor unit |
emmanuelchio | 0:699e70ed46ee | 3 | those examples are for use the SMARTGPU2 with the mbed microcontoller, just connect tx,rx,and reset |
emmanuelchio | 0:699e70ed46ee | 4 | Board: |
emmanuelchio | 0:699e70ed46ee | 5 | http://vizictechnologies.com/#/smart-gpu-2/4577779046 |
emmanuelchio | 0:699e70ed46ee | 6 | |
emmanuelchio | 0:699e70ed46ee | 7 | www.vizictechnologies.com |
emmanuelchio | 0:699e70ed46ee | 8 | Vizic Technologies copyright 2013 */ |
emmanuelchio | 0:699e70ed46ee | 9 | /**************************************************************************************/ |
emmanuelchio | 0:699e70ed46ee | 10 | |
emmanuelchio | 0:699e70ed46ee | 11 | #include "mbed.h" |
emmanuelchio | 0:699e70ed46ee | 12 | #include "SMARTGPU2.h" |
emmanuelchio | 0:699e70ed46ee | 13 | |
emmanuelchio | 0:699e70ed46ee | 14 | SMARTGPU2 lcd(TXPIN,RXPIN,RESETPIN); //create our object called "lcd" |
emmanuelchio | 0:699e70ed46ee | 15 | |
emmanuelchio | 0:699e70ed46ee | 16 | 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 | 17 | |
emmanuelchio | 0:699e70ed46ee | 18 | /***************************************************/ |
emmanuelchio | 0:699e70ed46ee | 19 | /***************************************************/ |
emmanuelchio | 0:699e70ed46ee | 20 | void initializeSmartGPU2(void){ //Initialize SMARTGPU2 Board |
emmanuelchio | 0:699e70ed46ee | 21 | lcd.reset(); //physically reset SMARTGPU2 |
emmanuelchio | 0:699e70ed46ee | 22 | lcd.start(); //initialize the SMARTGPU2 processor |
emmanuelchio | 0:699e70ed46ee | 23 | } |
emmanuelchio | 0:699e70ed46ee | 24 | |
emmanuelchio | 0:699e70ed46ee | 25 | /***************************************************/ |
emmanuelchio | 0:699e70ed46ee | 26 | /***************************************************/ |
emmanuelchio | 0:699e70ed46ee | 27 | /***************************************************/ |
emmanuelchio | 0:699e70ed46ee | 28 | /***************************************************/ |
emmanuelchio | 0:699e70ed46ee | 29 | int main() { |
emmanuelchio | 0:699e70ed46ee | 30 | POINT point; |
emmanuelchio | 0:699e70ed46ee | 31 | char pic=0; |
emmanuelchio | 0:699e70ed46ee | 32 | unsigned char i=0; |
emmanuelchio | 0:699e70ed46ee | 33 | NUMBEROFBYTES charsPrinted; |
emmanuelchio | 0:699e70ed46ee | 34 | |
emmanuelchio | 0:699e70ed46ee | 35 | initializeSmartGPU2(); //Init communication with SmartGPU2 board |
emmanuelchio | 0:699e70ed46ee | 36 | |
emmanuelchio | 0:699e70ed46ee | 37 | lcd.baudChange(BAUD7); //set a fast baud! for fast drawing |
emmanuelchio | 0:699e70ed46ee | 38 | lcd.SDFopenDir("JPG Images"); // Open the JPG Images that contains the images |
emmanuelchio | 0:699e70ed46ee | 39 | //strings config |
emmanuelchio | 0:699e70ed46ee | 40 | lcd.setTextColour(GREEN); |
emmanuelchio | 0:699e70ed46ee | 41 | lcd.setTextSize(FONT1); |
emmanuelchio | 0:699e70ed46ee | 42 | |
emmanuelchio | 0:699e70ed46ee | 43 | while(1){ //Loop forever in the slide show! |
emmanuelchio | 0:699e70ed46ee | 44 | for(i=0;i<4;i++){ |
emmanuelchio | 0:699e70ed46ee | 45 | 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 | 46 | } |
emmanuelchio | 0:699e70ed46ee | 47 | for(i=0;i<4;i++){ |
emmanuelchio | 0:699e70ed46ee | 48 | 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 | 49 | } |
emmanuelchio | 0:699e70ed46ee | 50 | |
emmanuelchio | 0:699e70ed46ee | 51 | lcd.string(70,10,319,239,"Touch image to load!",&charsPrinted); |
emmanuelchio | 0:699e70ed46ee | 52 | while(lcd.touchScreen(&point)==INVALID); //Wait for a touch on the screen to show next or previous picture |
emmanuelchio | 0:699e70ed46ee | 53 | |
emmanuelchio | 0:699e70ed46ee | 54 | if(point.y<120){ //touch on upper part |
emmanuelchio | 0:699e70ed46ee | 55 | 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 | 56 | }else{ //touch on upper part |
emmanuelchio | 0:699e70ed46ee | 57 | 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 | 58 | } |
emmanuelchio | 0:699e70ed46ee | 59 | |
emmanuelchio | 0:699e70ed46ee | 60 | lcd.string(70,215,319,239,"Touch image to exit!",&charsPrinted); |
emmanuelchio | 0:699e70ed46ee | 61 | while(lcd.touchScreen(&point)==INVALID); //Wait for a touch on the screen to show next or previous picture |
emmanuelchio | 0:699e70ed46ee | 62 | lcd.erase(); |
emmanuelchio | 0:699e70ed46ee | 63 | } |
emmanuelchio | 0:699e70ed46ee | 64 | } |