Vizic Technologies
/
Photoframe_SG2
BMP Images Photo Frame Demo - MBED + SmartGPU2 board
Diff: main.cpp
- Revision:
- 0:cf88c34846f1
- Child:
- 1:5fbcbf55bb8f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jul 10 03:37:48 2013 +0000 @@ -0,0 +1,58 @@ +/**************************************************************************************/ +/*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; + int pic=0; + + initializeSmartGPU2(); //Init communication with SmartGPU2 board + + lcd.SDFopenDir("BMP Images"); //Open the BMP Images that contains the images + + while(1){ //Loop forever in the slide show! + lcd.imageBMPSD(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 + lcd.imageBMPSD(3,219,"previous"); //Load the previous icon + lcd.imageBMPSD(300,219,"next"); //Load the next icon + + wait_ms(100); //A little delay to avoid fast image changing + while(lcd.touchScreen(&point)==INVALID); //Wait for a touch on the screen to show next or previous picture + + //check if we go to the next image, or to the previous one + if(point.x>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 + pic++; //decrease image selector + if(pic>7){ //if we reach the position of the last image, we restart to image 0 + pic=0; + } + }else{ + pic--; + if(pic<0){ //if we reach the position of the first image, we move to image 7 + pic=7; + } + } + } +} \ No newline at end of file