SMARTGPU photo frame slide show application demo Be sure to load the images to the micro SD card first!

Dependencies:   SMARTGPU mbed

Committer:
emmanuelchio
Date:
Wed Sep 14 05:35:32 2011 +0000
Revision:
0:c4cc4c1460a8
Rev 1.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emmanuelchio 0:c4cc4c1460a8 1 /**************************************************************************************/
emmanuelchio 0:c4cc4c1460a8 2 /*SMARTGPU intelligent embedded graphics processor unit
emmanuelchio 0:c4cc4c1460a8 3 those examples are for use the SMARTGPU with the mbed microcontoller, just connect tx,rx,and reset
emmanuelchio 0:c4cc4c1460a8 4 Board:
emmanuelchio 0:c4cc4c1460a8 5 http://www.vizictechnologies.com/#/desarrollo/4554296549
emmanuelchio 0:c4cc4c1460a8 6
emmanuelchio 0:c4cc4c1460a8 7 This example requires pre-loaded content to the micro SD card, images and text files!
emmanuelchio 0:c4cc4c1460a8 8
emmanuelchio 0:c4cc4c1460a8 9 www.vizictechnologies.com
emmanuelchio 0:c4cc4c1460a8 10 Vizic Technologies copyright 2011 */
emmanuelchio 0:c4cc4c1460a8 11 /**************************************************************************************/
emmanuelchio 0:c4cc4c1460a8 12 /**************************************************************************************/
emmanuelchio 0:c4cc4c1460a8 13
emmanuelchio 0:c4cc4c1460a8 14 #include "mbed.h"
emmanuelchio 0:c4cc4c1460a8 15 #include "SMARTGPU.h"
emmanuelchio 0:c4cc4c1460a8 16
emmanuelchio 0:c4cc4c1460a8 17 SMARTGPU lcd(p13,p14,p15); //(TX,RX,Reset);
emmanuelchio 0:c4cc4c1460a8 18
emmanuelchio 0:c4cc4c1460a8 19 //Each time we use the touchscreen we must define a int array that stores the X and Y readed or touched coordinates.
emmanuelchio 0:c4cc4c1460a8 20 int touch[2];
emmanuelchio 0:c4cc4c1460a8 21 //Each time we use the touchicon we must define a char array that stores the name of the touched icon.
emmanuelchio 0:c4cc4c1460a8 22 char icon[3];
emmanuelchio 0:c4cc4c1460a8 23
emmanuelchio 0:c4cc4c1460a8 24 char imagesOnSDCard[8][9]={"Peng320","Koala320","Hydra320","Lig320","Sea320","Tul320","Des320","Flow320"}; //array containing the names of the different called images
emmanuelchio 0:c4cc4c1460a8 25
emmanuelchio 0:c4cc4c1460a8 26 int main() {
emmanuelchio 0:c4cc4c1460a8 27 lcd.reset(); //physically reset SMARTGPU
emmanuelchio 0:c4cc4c1460a8 28 lcd.start(); //initialize the SMARTGPU processor
emmanuelchio 0:c4cc4c1460a8 29
emmanuelchio 0:c4cc4c1460a8 30 int pic=0;
emmanuelchio 0:c4cc4c1460a8 31
emmanuelchio 0:c4cc4c1460a8 32 lcd.baudChange(500000); // Set a fast baud!, always that we use touch functions is recommended to use fast baud rates
emmanuelchio 0:c4cc4c1460a8 33
emmanuelchio 0:c4cc4c1460a8 34 while(1){ //Loop forever in the slide show!
emmanuelchio 0:c4cc4c1460a8 35 lcd.imageSD(0,0,imagesOnSDCard[pic]); //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:c4cc4c1460a8 36 lcd.imageSD(3,219,"prev"); //Load the prev icon
emmanuelchio 0:c4cc4c1460a8 37 lcd.imageSD(300,219,"next"); //Load the next icon
emmanuelchio 0:c4cc4c1460a8 38
emmanuelchio 0:c4cc4c1460a8 39 while(!lcd.touchScreen(touch)); //Wait for a touch on the screen to show next or previous picture
emmanuelchio 0:c4cc4c1460a8 40
emmanuelchio 0:c4cc4c1460a8 41 //check if we go to the next image, or to the previous one
emmanuelchio 0:c4cc4c1460a8 42 if(touch[XCOORD]>160){ //if the received touch was on the right middle of the screen we advance the image, else we decrease and go to previous image
emmanuelchio 0:c4cc4c1460a8 43 pic++; //decrease image selector
emmanuelchio 0:c4cc4c1460a8 44 if(pic>7){ //if we reach the position of the last image, we restart to image 0
emmanuelchio 0:c4cc4c1460a8 45 pic=0;
emmanuelchio 0:c4cc4c1460a8 46 }
emmanuelchio 0:c4cc4c1460a8 47 }else{
emmanuelchio 0:c4cc4c1460a8 48 pic--;
emmanuelchio 0:c4cc4c1460a8 49 if(pic<0){ //if we reach the position of the first image, we move to image 7
emmanuelchio 0:c4cc4c1460a8 50 pic=7;
emmanuelchio 0:c4cc4c1460a8 51 }
emmanuelchio 0:c4cc4c1460a8 52 }
emmanuelchio 0:c4cc4c1460a8 53 }
emmanuelchio 0:c4cc4c1460a8 54 }
emmanuelchio 0:c4cc4c1460a8 55