Full IPOD Like GUI Demo - MBED + SmartGPU2 board

Dependencies:   SMARTGPU2 mbed

Committer:
emmanuelchio
Date:
Wed Jul 10 03:29:21 2013 +0000
Revision:
0:9ec50d21947d
Child:
1:2845aaa91e22
Full IPOD Like GUI - MBED + SmartGPU2 board

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emmanuelchio 0:9ec50d21947d 1 /**************************************************************************************/
emmanuelchio 0:9ec50d21947d 2 /*SMARTGPU2 intelligent embedded graphics processor unit
emmanuelchio 0:9ec50d21947d 3 those examples are for use the SMARTGPU2 with the mbed microcontoller, just connect tx,rx,and reset
emmanuelchio 0:9ec50d21947d 4 Board:
emmanuelchio 0:9ec50d21947d 5 http://vizictechnologies.com/#/smart-gpu-2/4577779046
emmanuelchio 0:9ec50d21947d 6
emmanuelchio 0:9ec50d21947d 7 www.vizictechnologies.com
emmanuelchio 0:9ec50d21947d 8 Vizic Technologies copyright 2013 */
emmanuelchio 0:9ec50d21947d 9 /**************************************************************************************/
emmanuelchio 0:9ec50d21947d 10
emmanuelchio 0:9ec50d21947d 11 #include "mbed.h"
emmanuelchio 0:9ec50d21947d 12 #include "SMARTGPU2.h"
emmanuelchio 0:9ec50d21947d 13 #include "stdlib.h"
emmanuelchio 0:9ec50d21947d 14
emmanuelchio 0:9ec50d21947d 15 SMARTGPU2 lcd(TXPIN,RXPIN,RESETPIN); //create our object called "lcd"
emmanuelchio 0:9ec50d21947d 16
emmanuelchio 0:9ec50d21947d 17 //defines for GUI
emmanuelchio 0:9ec50d21947d 18 #define HALFX 240/2
emmanuelchio 0:9ec50d21947d 19 #define HALFY 320/2
emmanuelchio 0:9ec50d21947d 20
emmanuelchio 0:9ec50d21947d 21 //declare our structures POINT and ICON
emmanuelchio 0:9ec50d21947d 22 POINT point;
emmanuelchio 0:9ec50d21947d 23 ICON icon;
emmanuelchio 0:9ec50d21947d 24
emmanuelchio 0:9ec50d21947d 25 //array to store file names 25 characters max, also used as working file array
emmanuelchio 0:9ec50d21947d 26 char name[25];
emmanuelchio 0:9ec50d21947d 27
emmanuelchio 0:9ec50d21947d 28 //Array with the names of the icons under "FullGUI/Ics" folder, names of 25 characters max
emmanuelchio 0:9ec50d21947d 29 #define TOTALICONS 13 //number of available icons, current sketch supports 25 icons max
emmanuelchio 0:9ec50d21947d 30 const char iconNames[TOTALICONS][25]={"backlight","calculator","clock","games","maps","media","notes","photos","wifi","settings","calls","music","wall"};
emmanuelchio 0:9ec50d21947d 31
emmanuelchio 0:9ec50d21947d 32 //array used by games
emmanuelchio 0:9ec50d21947d 33 #define MOLEHOLE 3 //position of the array where mole hole image is contained
emmanuelchio 0:9ec50d21947d 34 #define HITMOLE 4 //position of the array where hit mole image is contained
emmanuelchio 0:9ec50d21947d 35 #define MISSMOLE 5 //position of the array where miss mole image is contained
emmanuelchio 0:9ec50d21947d 36 const char moleType[6][9]={"MoleHap","MoleSee","MoleBad","MoleHole","MolePun","MoleMiss"}; //array containing the names of the different called images
emmanuelchio 0:9ec50d21947d 37
emmanuelchio 0:9ec50d21947d 38 //General/Miscellaneous Functions
emmanuelchio 0:9ec50d21947d 39 /**************************************************/
emmanuelchio 0:9ec50d21947d 40 /**************************************************/
emmanuelchio 0:9ec50d21947d 41 /**************************************************/
emmanuelchio 0:9ec50d21947d 42 unsigned char getTouchIconMainMenu(void){
emmanuelchio 0:9ec50d21947d 43 unsigned int icPress;
emmanuelchio 0:9ec50d21947d 44
emmanuelchio 0:9ec50d21947d 45 while(lcd.touchScreen(&point)==INVALID); //wait for a touch
emmanuelchio 0:9ec50d21947d 46 //PROCEDURE TO DIVIDE THE TOUCHSCREEN AREA IN 4 x 5 EQUAL PARTS--------------------------------------------
emmanuelchio 0:9ec50d21947d 47 //Divide screen into 4 equal horizontal parts for icons
emmanuelchio 0:9ec50d21947d 48 icPress= (point.x/(LCD_HEIGHT/4)) + 1; //LCD_HEIGHT is 240
emmanuelchio 0:9ec50d21947d 49 //Divide Screen into 5 equal vertical parts for icons
emmanuelchio 0:9ec50d21947d 50 icPress = icPress + (((point.y)/(LCD_WIDTH/5)) * 4); //LCD_WIDTH is 320
emmanuelchio 0:9ec50d21947d 51 //-------------------------------------------------------------------------------------------------
emmanuelchio 0:9ec50d21947d 52 return icPress; //return decoded coordinate from 1 to 20
emmanuelchio 0:9ec50d21947d 53 }
emmanuelchio 0:9ec50d21947d 54
emmanuelchio 0:9ec50d21947d 55 //obtain from EEPROM FLASH memory the name of the current stored wallpaper on the "name" array
emmanuelchio 0:9ec50d21947d 56 void getCurrentWallFromEEPROM(void){
emmanuelchio 0:9ec50d21947d 57 NUMBEROFBYTES bytesRead;
emmanuelchio 0:9ec50d21947d 58 lcd.fillBuffFromEEPROMPage(PAGE0); //copy PAGE0 to EEPROM RAM buffer
emmanuelchio 0:9ec50d21947d 59 lcd.readEEPROMBuff(name,0,14,&bytesRead); //read 14 bytes of the EEPROM RAM buffer to name array, wallpapers must not exceed 14 chars in name lenght
emmanuelchio 0:9ec50d21947d 60 if(strstr(name, 0x00) != 0x00){ //find a null character in name, if not find, add the 0x00 NULL character
emmanuelchio 0:9ec50d21947d 61 name[0] = 0x00;
emmanuelchio 0:9ec50d21947d 62 }
emmanuelchio 0:9ec50d21947d 63 }
emmanuelchio 0:9ec50d21947d 64
emmanuelchio 0:9ec50d21947d 65 //save current contents of "name" array on EEPROM PAGE0 at address 0x0000
emmanuelchio 0:9ec50d21947d 66 void saveWallpaperToEEPROM(void){
emmanuelchio 0:9ec50d21947d 67 NUMBEROFBYTES bytesWritten;
emmanuelchio 0:9ec50d21947d 68 lcd.initClearEEPROMBuff(); //Initialize EEPROM RAM Buffer
emmanuelchio 0:9ec50d21947d 69 lcd.writeEEPROMBuff(name,0,sizeof(name),&bytesWritten); //write all the contents of "name" array to EEPROM RAM Buffer
emmanuelchio 0:9ec50d21947d 70 lcd.eraseEEPROMPage(PAGE0); //erase all contents on the PAGE0
emmanuelchio 0:9ec50d21947d 71 lcd.saveBuffToEEPROMPage(PAGE0); //now save to EEPROM PAGE0 the contents of the EEPROM RAM Buffer(the name array + 0xFFs)
emmanuelchio 0:9ec50d21947d 72 }
emmanuelchio 0:9ec50d21947d 73
emmanuelchio 0:9ec50d21947d 74 /**************************************************/
emmanuelchio 0:9ec50d21947d 75 void drawHeader(char *text){
emmanuelchio 0:9ec50d21947d 76 NUMBEROFBYTES charsPrinted;
emmanuelchio 0:9ec50d21947d 77 unsigned int batteryPercentage = 65;
emmanuelchio 0:9ec50d21947d 78 //draw header and text
emmanuelchio 0:9ec50d21947d 79 lcd.drawRectangle(0,0,MAX_X_PORTRAIT,13,BLACK,FILL); //draw upper bar
emmanuelchio 0:9ec50d21947d 80 lcd.setTextSize(FONT0);
emmanuelchio 0:9ec50d21947d 81 lcd.setTextColour(WHITE);
emmanuelchio 0:9ec50d21947d 82 lcd.setTextBackFill(TRANS);
emmanuelchio 0:9ec50d21947d 83 lcd.string(2,0,MAX_X_PORTRAIT,20,"Vizic",&charsPrinted); //draw Vizic string
emmanuelchio 0:9ec50d21947d 84 lcd.string(85,0,MAX_X_PORTRAIT,20,text,&charsPrinted); //draw string
emmanuelchio 0:9ec50d21947d 85 //draw battery icon according to the battery percentage variable
emmanuelchio 0:9ec50d21947d 86 lcd.drawRectangle(215,0,215+((batteryPercentage*15)/100),10,GREEN,FILL);
emmanuelchio 0:9ec50d21947d 87 lcd.drawRectangle(215,0,230,10,WHITE,UNFILL);
emmanuelchio 0:9ec50d21947d 88 lcd.drawRectangle(230,4,232,6,WHITE,FILL);
emmanuelchio 0:9ec50d21947d 89 }
emmanuelchio 0:9ec50d21947d 90
emmanuelchio 0:9ec50d21947d 91 //Cuts the .ext and updates the name
emmanuelchio 0:9ec50d21947d 92 void cutFileExtension(char *name, char *ext){
emmanuelchio 0:9ec50d21947d 93 char *pch;
emmanuelchio 0:9ec50d21947d 94 pch=strstr(name,ext); //find the .ext extension to the name
emmanuelchio 0:9ec50d21947d 95 strncpy(pch,0x00,1); //cut/replace the .ext extension for the NULL 0x00 character
emmanuelchio 0:9ec50d21947d 96 }
emmanuelchio 0:9ec50d21947d 97
emmanuelchio 0:9ec50d21947d 98 //This function call the desired image in the position of the desired hole - used by games()
emmanuelchio 0:9ec50d21947d 99 void showMole(char mole, char hole){
emmanuelchio 0:9ec50d21947d 100 switch(hole){
emmanuelchio 0:9ec50d21947d 101 case 1:
emmanuelchio 0:9ec50d21947d 102 lcd.imageBMPSD(38,70,(char*)moleType[mole]); // hole 1
emmanuelchio 0:9ec50d21947d 103 break;
emmanuelchio 0:9ec50d21947d 104 case 2:
emmanuelchio 0:9ec50d21947d 105 lcd.imageBMPSD(138,70,(char*)moleType[mole]); // hole 2
emmanuelchio 0:9ec50d21947d 106 break;
emmanuelchio 0:9ec50d21947d 107 case 3:
emmanuelchio 0:9ec50d21947d 108 lcd.imageBMPSD(240,70,(char*)moleType[mole]); // hole 3
emmanuelchio 0:9ec50d21947d 109 break;
emmanuelchio 0:9ec50d21947d 110 case 4:
emmanuelchio 0:9ec50d21947d 111 lcd.imageBMPSD(38,147,(char*)moleType[mole]); // hole 4
emmanuelchio 0:9ec50d21947d 112 break;
emmanuelchio 0:9ec50d21947d 113 case 5:
emmanuelchio 0:9ec50d21947d 114 lcd.imageBMPSD(138,147,(char*)moleType[mole]); // hole 5
emmanuelchio 0:9ec50d21947d 115 break;
emmanuelchio 0:9ec50d21947d 116 case 6:
emmanuelchio 0:9ec50d21947d 117 lcd.imageBMPSD(240,147,(char*)moleType[mole]); // hole 6
emmanuelchio 0:9ec50d21947d 118 break;
emmanuelchio 0:9ec50d21947d 119 default:
emmanuelchio 0:9ec50d21947d 120 break;
emmanuelchio 0:9ec50d21947d 121 }
emmanuelchio 0:9ec50d21947d 122 }
emmanuelchio 0:9ec50d21947d 123
emmanuelchio 0:9ec50d21947d 124 //This function returns 1 if a touch has been made in a specified hole -used by games
emmanuelchio 0:9ec50d21947d 125 char touchOnHole(char hole){
emmanuelchio 0:9ec50d21947d 126 char hit=0;
emmanuelchio 0:9ec50d21947d 127 switch(hole){
emmanuelchio 0:9ec50d21947d 128 case 1:
emmanuelchio 0:9ec50d21947d 129 if(point.x>0 && point.x<111 && point.y>65 && point.y<146) hit=1; //check if the last touch was inside this area
emmanuelchio 0:9ec50d21947d 130 break;
emmanuelchio 0:9ec50d21947d 131 case 2:
emmanuelchio 0:9ec50d21947d 132 if(point.x>110 && point.x<211 && point.y>65 && point.y<146) hit=1; //check if the last touch was inside this area
emmanuelchio 0:9ec50d21947d 133 break;
emmanuelchio 0:9ec50d21947d 134 case 3:
emmanuelchio 0:9ec50d21947d 135 if(point.x>210 && point.x<320 && point.y>65 && point.y<146) hit=1; //check if the last touch was inside this area
emmanuelchio 0:9ec50d21947d 136 break;
emmanuelchio 0:9ec50d21947d 137 case 4:
emmanuelchio 0:9ec50d21947d 138 if(point.x>0 && point.x<111 && point.y>145 && point.y<240) hit=1; //check if the last touch was inside this area
emmanuelchio 0:9ec50d21947d 139 break;
emmanuelchio 0:9ec50d21947d 140 case 5:
emmanuelchio 0:9ec50d21947d 141 if(point.x>110 && point.x<211 && point.y>145 && point.y<240) hit=1;//check if the last touch was inside this area
emmanuelchio 0:9ec50d21947d 142 break;
emmanuelchio 0:9ec50d21947d 143 case 6:
emmanuelchio 0:9ec50d21947d 144 if(point.x>210 && point.x<320 && point.y>145 && point.y<240) hit=1;//check if the last touch was inside this area
emmanuelchio 0:9ec50d21947d 145 break;
emmanuelchio 0:9ec50d21947d 146 default:
emmanuelchio 0:9ec50d21947d 147 break;
emmanuelchio 0:9ec50d21947d 148 }
emmanuelchio 0:9ec50d21947d 149 return hit;
emmanuelchio 0:9ec50d21947d 150 }
emmanuelchio 0:9ec50d21947d 151
emmanuelchio 0:9ec50d21947d 152 //function used by music
emmanuelchio 0:9ec50d21947d 153 void drawControlRR(ACTIVE state){
emmanuelchio 0:9ec50d21947d 154 //draw button
emmanuelchio 0:9ec50d21947d 155 lcd.objButton(0,265,79,315,state,"");
emmanuelchio 0:9ec50d21947d 156 //draw symbol
emmanuelchio 0:9ec50d21947d 157 lcd.drawTriangle(0+10,265+((315-265)/2),0+39,265+10,0+39,315-10,BLACK,FILL);
emmanuelchio 0:9ec50d21947d 158 lcd.drawTriangle(0+39,265+((315-265)/2),0+79-10,265+10,0+79-10,315-10,BLACK,FILL);
emmanuelchio 0:9ec50d21947d 159 }
emmanuelchio 0:9ec50d21947d 160
emmanuelchio 0:9ec50d21947d 161 //function used by music
emmanuelchio 0:9ec50d21947d 162 void drawControlFF(ACTIVE state){
emmanuelchio 0:9ec50d21947d 163 //draw button
emmanuelchio 0:9ec50d21947d 164 lcd.objButton(160,265,MAX_X_PORTRAIT,315,state,"");
emmanuelchio 0:9ec50d21947d 165 //draw symbol
emmanuelchio 0:9ec50d21947d 166 lcd.drawTriangle(160+10,265+10,160+10,315-10,160+39,265+((315-265)/2),BLACK,FILL);
emmanuelchio 0:9ec50d21947d 167 lcd.drawTriangle(160+39,265+10,160+39,315-10,239-10,265+((315-265)/2),BLACK,FILL);
emmanuelchio 0:9ec50d21947d 168 }
emmanuelchio 0:9ec50d21947d 169
emmanuelchio 0:9ec50d21947d 170 //function used by music
emmanuelchio 0:9ec50d21947d 171 void drawControlPLAY(char symbol){
emmanuelchio 0:9ec50d21947d 172 //draw button
emmanuelchio 0:9ec50d21947d 173 lcd.objButton(80,265,159,315,SELECTED,"");
emmanuelchio 0:9ec50d21947d 174 //draw symbol
emmanuelchio 0:9ec50d21947d 175 if(symbol){ //PLAY
emmanuelchio 0:9ec50d21947d 176 lcd.drawTriangle(80+10,265+10,80+10,315-10,159-10,265+((315-265)/2),BLACK,FILL);
emmanuelchio 0:9ec50d21947d 177 }else{ //PAUSE
emmanuelchio 0:9ec50d21947d 178 lcd.drawRectangle(80+10,265+10,80+10+25,315-10,BLACK,FILL);
emmanuelchio 0:9ec50d21947d 179 lcd.drawRectangle(159-10-25,265+10,159-10,315-10,BLACK,FILL);
emmanuelchio 0:9ec50d21947d 180 }
emmanuelchio 0:9ec50d21947d 181 }
emmanuelchio 0:9ec50d21947d 182
emmanuelchio 0:9ec50d21947d 183 //function that draws buttons and current progress bar - used by media
emmanuelchio 0:9ec50d21947d 184 void drawButtonsAndProgress(unsigned long currFrame, unsigned long totFrames){
emmanuelchio 0:9ec50d21947d 185 lcd.objButton(0,200,159,230,DESELECTED,"Continue");
emmanuelchio 0:9ec50d21947d 186 lcd.objButton(161,200,MAX_X_LANDSCAPE,230,DESELECTED,"Return...");
emmanuelchio 0:9ec50d21947d 187 lcd.drawRectangle(0,170,(currFrame*MAX_X_LANDSCAPE)/(totFrames),190,RED,FILL); //scale currentFrame value to 0-319 pixels
emmanuelchio 0:9ec50d21947d 188 lcd.drawRectangle((currFrame*MAX_X_LANDSCAPE)/(totFrames),170,MAX_X_LANDSCAPE,190,BLACK,FILL); //scale currentFrame value to 0-319 pixels
emmanuelchio 0:9ec50d21947d 189 }
emmanuelchio 0:9ec50d21947d 190
emmanuelchio 0:9ec50d21947d 191 //Main applications, the next applications are called by the main loop menu
emmanuelchio 0:9ec50d21947d 192 /**************************************************/
emmanuelchio 0:9ec50d21947d 193 /**************************************************/
emmanuelchio 0:9ec50d21947d 194 /**************************************************/
emmanuelchio 0:9ec50d21947d 195 //draws Main Menu
emmanuelchio 0:9ec50d21947d 196 void drawMainMenu(void){
emmanuelchio 0:9ec50d21947d 197 unsigned int i=0, x=8, y=20;
emmanuelchio 0:9ec50d21947d 198 SMARTGPUREPLY res;
emmanuelchio 0:9ec50d21947d 199 char aux[25];
emmanuelchio 0:9ec50d21947d 200
emmanuelchio 0:9ec50d21947d 201 strcpy(aux,"Wall/"); //copy to name the string "Wall/"
emmanuelchio 0:9ec50d21947d 202 getCurrentWallFromEEPROM(); //fill global "name" array with the current EEPROM Stored name
emmanuelchio 0:9ec50d21947d 203 strcat(aux,name); //concatenate the currentWall name to "Wall/"
emmanuelchio 0:9ec50d21947d 204 if(lcd.imageBMPSD(0,0,aux)!=OK) lcd.erase(); //try to draw WallPaper Image, if fail, just erase screen
emmanuelchio 0:9ec50d21947d 205 //now draw all top icons
emmanuelchio 0:9ec50d21947d 206 lcd.SDFopenDir("Ics"); //open the folder with the icons
emmanuelchio 0:9ec50d21947d 207 while(i<TOTALICONS){
emmanuelchio 0:9ec50d21947d 208 res=lcd.imageBMPSD(x,y,(char*)iconNames[i++]); //try to draw icon and advance i
emmanuelchio 0:9ec50d21947d 209 if(res == OK){ //draw icon file, only if command success then advance x and y position
emmanuelchio 0:9ec50d21947d 210 x+=50+8; //advance the icon size 50 + 8 the space between icons
emmanuelchio 0:9ec50d21947d 211 if(x>230){ //if x > 230, means we have reach the end of file and must advance 1 coloumn
emmanuelchio 0:9ec50d21947d 212 x=8; //reset x
emmanuelchio 0:9ec50d21947d 213 y+=50+10; //advance the icon size 50 + 10 the space between icons
emmanuelchio 0:9ec50d21947d 214 if(y>300) break; //if there are more than 20 icons, break and ignore, current sketch supports only 20 icons max
emmanuelchio 0:9ec50d21947d 215 }
emmanuelchio 0:9ec50d21947d 216 }
emmanuelchio 0:9ec50d21947d 217 }
emmanuelchio 0:9ec50d21947d 218 lcd.SDFopenDir(".."); //return/go up to parent dir one level
emmanuelchio 0:9ec50d21947d 219 drawHeader("Main Menu");
emmanuelchio 0:9ec50d21947d 220 wait_ms(350); //A little delay to avoid fast image changing
emmanuelchio 0:9ec50d21947d 221 }
emmanuelchio 0:9ec50d21947d 222
emmanuelchio 0:9ec50d21947d 223 /**************************************************/
emmanuelchio 0:9ec50d21947d 224 void backlight(void){
emmanuelchio 0:9ec50d21947d 225 static unsigned char currentBacklightValue=100; //0-100
emmanuelchio 0:9ec50d21947d 226 NUMBEROFBYTES charsPrinted;
emmanuelchio 0:9ec50d21947d 227
emmanuelchio 0:9ec50d21947d 228 lcd.drawGradientRect(0,0,MAX_X_PORTRAIT,MAX_Y_PORTRAIT,BLACK,MAGENTA,VERTICAL); //draw a fullscreen gradient rectangle
emmanuelchio 0:9ec50d21947d 229 lcd.setTextSize(FONT3);
emmanuelchio 0:9ec50d21947d 230 lcd.setTextColour(WHITE);
emmanuelchio 0:9ec50d21947d 231 lcd.setTextBackFill(TRANS);
emmanuelchio 0:9ec50d21947d 232 lcd.string(40,45,MAX_X_PORTRAIT,MAX_Y_PORTRAIT,"Brightness Bar",&charsPrinted);
emmanuelchio 0:9ec50d21947d 233 lcd.objSlider(10,80,MAX_X_PORTRAIT-10,150,currentBacklightValue,101,HORIZONTAL);
emmanuelchio 0:9ec50d21947d 234 lcd.objButton(10,280,MAX_X_PORTRAIT-10,310,DESELECTED,"Return");
emmanuelchio 0:9ec50d21947d 235 drawHeader("Adjustments:");
emmanuelchio 0:9ec50d21947d 236 while(1){
emmanuelchio 0:9ec50d21947d 237 while(lcd.touchScreen(&point)==INVALID);//wait for a touch on screen to do something
emmanuelchio 0:9ec50d21947d 238 if((point.x>10) && (point.x<MAX_X_PORTRAIT-10) && (point.y>80) && (point.y<150)){ //if touch inside brightness bar
emmanuelchio 0:9ec50d21947d 239 currentBacklightValue= ((point.x-10)*100)/(MAX_X_PORTRAIT-10-10); //scale obtained touch value to 0-100
emmanuelchio 0:9ec50d21947d 240 lcd.objSlider(10,80,MAX_X_PORTRAIT-10,150,currentBacklightValue,101,HORIZONTAL); //update slider
emmanuelchio 0:9ec50d21947d 241 lcd.bright(currentBacklightValue); //set new brightness value
emmanuelchio 0:9ec50d21947d 242 wait_ms(150);
emmanuelchio 0:9ec50d21947d 243 }
emmanuelchio 0:9ec50d21947d 244 if(point.y>280){ //if touch inside return button
emmanuelchio 0:9ec50d21947d 245 lcd.objButton(10,280,MAX_X_PORTRAIT-10,310,SELECTED,"Return");
emmanuelchio 0:9ec50d21947d 246 wait_ms(300);
emmanuelchio 0:9ec50d21947d 247 return; //exit function
emmanuelchio 0:9ec50d21947d 248 }
emmanuelchio 0:9ec50d21947d 249 }
emmanuelchio 0:9ec50d21947d 250 }
emmanuelchio 0:9ec50d21947d 251
emmanuelchio 0:9ec50d21947d 252 /**************************************************/
emmanuelchio 0:9ec50d21947d 253 void clocks(void){
emmanuelchio 0:9ec50d21947d 254 int hours=4,mins=48,secs=0,i=0;
emmanuelchio 0:9ec50d21947d 255 int xs,ys,xm,ym,xh,yh;
emmanuelchio 0:9ec50d21947d 256 int angleH,angleM,angleS;
emmanuelchio 0:9ec50d21947d 257 int handHour=55;//hand size
emmanuelchio 0:9ec50d21947d 258 int handMin=70; //hand size
emmanuelchio 0:9ec50d21947d 259 int handSec=75; //hand size
emmanuelchio 0:9ec50d21947d 260
emmanuelchio 0:9ec50d21947d 261 lcd.drawGradientRect(0,0,MAX_X_PORTRAIT,MAX_Y_PORTRAIT,BLACK,MAGENTA,VERTICAL); //draw a fullscreen gradient rectangle
emmanuelchio 0:9ec50d21947d 262 lcd.objButton(10,280,MAX_X_PORTRAIT-10,310,DESELECTED,"Return");
emmanuelchio 0:9ec50d21947d 263 drawHeader("Clocks:");
emmanuelchio 0:9ec50d21947d 264 //drawClock Body
emmanuelchio 0:9ec50d21947d 265 lcd.drawCircle(HALFX,HALFY,80,BLACK,FILL);
emmanuelchio 0:9ec50d21947d 266 lcd.drawCircle(HALFX,HALFY,80,WHITE,UNFILL);
emmanuelchio 0:9ec50d21947d 267
emmanuelchio 0:9ec50d21947d 268 while(1){
emmanuelchio 0:9ec50d21947d 269 //Do some Math to get the second point of the clock hands. (first point is always the center of the clock)
emmanuelchio 0:9ec50d21947d 270 angleS=secs*6; //get the current seconds in angle form, a circle have 360 degrees divided by 60 seconds = 6, then we multiply the 6 by the current seconds to get current angle
emmanuelchio 0:9ec50d21947d 271 xs=(sin((angleS*3.14)/180)) * handSec; //get X component of the second's hand
emmanuelchio 0:9ec50d21947d 272 ys=(cos((angleS*3.14)/180)) * handSec; //get Y component of the second's hand
emmanuelchio 0:9ec50d21947d 273 angleM=mins*6; //get the current minutes in angle form, a circle have 360 degrees divided by 60 minutes = 6, then we multiply the 6 by the current minutes to get current angle
emmanuelchio 0:9ec50d21947d 274 xm=(sin((angleM*3.14)/180)) * handMin; //get X component of the minutes's hand
emmanuelchio 0:9ec50d21947d 275 ym=(cos((angleM*3.14)/180)) * handMin; //get Y component of the minutes's hand
emmanuelchio 0:9ec50d21947d 276 angleH=hours*30; //get the current hours in angle form, a circle have 360 degrees divided by 12 hours = 30, then we multiply the 30 by the current hours to get current angle
emmanuelchio 0:9ec50d21947d 277 xh=(sin((angleH*3.14)/180)) * handHour; //get X component of the hours's hand
emmanuelchio 0:9ec50d21947d 278 yh=(cos((angleH*3.14)/180)) * handHour; //get Y component of the hours's hand
emmanuelchio 0:9ec50d21947d 279
emmanuelchio 0:9ec50d21947d 280 //Draw current time hands
emmanuelchio 0:9ec50d21947d 281 lcd.drawLine(HALFX,HALFY,HALFX+xm,HALFY-ym,WHITE); // Draw the minutes hand, first point is the center of the clock, and the second is the point obtained by doing math
emmanuelchio 0:9ec50d21947d 282 lcd.drawLine(HALFX,HALFY,HALFX+xh,HALFY-yh,WHITE); // Draw the hours hand, first point is the center of the clock, and the second is the point obtained by doing math
emmanuelchio 0:9ec50d21947d 283 lcd.drawLine(HALFX,HALFY,HALFX+xs,HALFY-ys,RED); // Draw the seconds hand, first point is the center of the clock, and the second is the point obtained by doing math
emmanuelchio 0:9ec50d21947d 284 lcd.drawCircle(HALFX,HALFY,3,RED,FILL); // Draw the center of the second's hand
emmanuelchio 0:9ec50d21947d 285
emmanuelchio 0:9ec50d21947d 286 for(i=0;i<10;i++){ //loop for 10 times a delay of 100ms asking for a touch - this gives a total delay of 1 second
emmanuelchio 0:9ec50d21947d 287 if(lcd.touchScreen(&point)==VALID){ //ask for a touch on screen to do something
emmanuelchio 0:9ec50d21947d 288 if(point.y>280){ //if touch inside return button
emmanuelchio 0:9ec50d21947d 289 lcd.objButton(10,280,MAX_X_PORTRAIT-10,310,SELECTED,"Return");
emmanuelchio 0:9ec50d21947d 290 wait_ms(300);
emmanuelchio 0:9ec50d21947d 291 return; //exit function
emmanuelchio 0:9ec50d21947d 292 }
emmanuelchio 0:9ec50d21947d 293 }
emmanuelchio 0:9ec50d21947d 294 wait_ms(100);
emmanuelchio 0:9ec50d21947d 295 }
emmanuelchio 0:9ec50d21947d 296
emmanuelchio 0:9ec50d21947d 297 //time managing
emmanuelchio 0:9ec50d21947d 298 secs++; // increase seconds
emmanuelchio 0:9ec50d21947d 299 if(secs==60){ // if we reach 60 seconds
emmanuelchio 0:9ec50d21947d 300 mins++; // increase the minutes
emmanuelchio 0:9ec50d21947d 301 if(mins==60){ // if we reach 60 minutes
emmanuelchio 0:9ec50d21947d 302 hours++; // increase the minutes
emmanuelchio 0:9ec50d21947d 303 if(hours==12){ // if we reach 12 hours
emmanuelchio 0:9ec50d21947d 304 hours=0; // clear hours
emmanuelchio 0:9ec50d21947d 305 }
emmanuelchio 0:9ec50d21947d 306 mins=0; // clear minutes
emmanuelchio 0:9ec50d21947d 307 }
emmanuelchio 0:9ec50d21947d 308 secs=0; // clear seconds
emmanuelchio 0:9ec50d21947d 309 }
emmanuelchio 0:9ec50d21947d 310 //Erase all hands
emmanuelchio 0:9ec50d21947d 311 lcd.drawLine(HALFX,HALFY,HALFX+xs,HALFY-ys,BLACK); // Erase Second's hand
emmanuelchio 0:9ec50d21947d 312 lcd.drawLine(HALFX,HALFY,HALFX+xm,HALFY-ym,BLACK); // Erase Minute's hand
emmanuelchio 0:9ec50d21947d 313 lcd.drawLine(HALFX,HALFY,HALFX+xh,HALFY-yh,BLACK); // Erase Hour's hand
emmanuelchio 0:9ec50d21947d 314 }
emmanuelchio 0:9ec50d21947d 315 }
emmanuelchio 0:9ec50d21947d 316
emmanuelchio 0:9ec50d21947d 317 /**************************************************/
emmanuelchio 0:9ec50d21947d 318 void photos(void){
emmanuelchio 0:9ec50d21947d 319 unsigned int dirs=0,pics=0;
emmanuelchio 0:9ec50d21947d 320 static unsigned int i=0; //static to save last image position even we exit function
emmanuelchio 0:9ec50d21947d 321 NUMBEROFBYTES charsPrinted;
emmanuelchio 0:9ec50d21947d 322
emmanuelchio 0:9ec50d21947d 323 lcd.orientation(LANDSCAPE_LEFT); //set orientation as landscape
emmanuelchio 0:9ec50d21947d 324 lcd.setTextColour(WHITE);
emmanuelchio 0:9ec50d21947d 325 lcd.setTextSize(FONT3);
emmanuelchio 0:9ec50d21947d 326 lcd.setTextBackFill(TRANS);
emmanuelchio 0:9ec50d21947d 327 lcd.drawGradientRect(0,0,MAX_X_LANDSCAPE,MAX_Y_LANDSCAPE,BLACK,MAGENTA,VERTICAL);
emmanuelchio 0:9ec50d21947d 328 lcd.string(80,110,MAX_X_LANDSCAPE,MAX_Y_LANDSCAPE,"Photo Gallery",&charsPrinted);
emmanuelchio 0:9ec50d21947d 329 lcd.setTextSize(FONT2);
emmanuelchio 0:9ec50d21947d 330 wait_ms(1000);
emmanuelchio 0:9ec50d21947d 331 lcd.SDFopenDir("Photos"); //open the folder with the photos
emmanuelchio 0:9ec50d21947d 332 lcd.SDFgetList(&dirs,&pics); //get number of files/Pics under the current folder "Photos"
emmanuelchio 0:9ec50d21947d 333
emmanuelchio 0:9ec50d21947d 334 while(1){
emmanuelchio 0:9ec50d21947d 335 lcd.SDFgetFileName(i,name); //get the name of the pic file number i
emmanuelchio 0:9ec50d21947d 336 cutFileExtension(name,".bmp"); //cut to name the .bmp extension
emmanuelchio 0:9ec50d21947d 337 lcd.imageBMPSD(0,0,name); //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:9ec50d21947d 338 wait_ms(200); //A little delay to avoid fast image changing
emmanuelchio 0:9ec50d21947d 339 lcd.string(60,220,319,239,"<Tap center to Exit>",&charsPrinted); //Show text
emmanuelchio 0:9ec50d21947d 340 while(lcd.touchScreen(&point)==INVALID); //wait for a touch to do something
emmanuelchio 0:9ec50d21947d 341 //check if we go to the next image, or to the previous one
emmanuelchio 0:9ec50d21947d 342 if(point.x>219){ //if the received touch was on the right corner of the screen we advance the image, else we decrease and go to previous image
emmanuelchio 0:9ec50d21947d 343 i++; //decrease image selector
emmanuelchio 0:9ec50d21947d 344 if(i>=pics){ //if we reach the position of the last image, we restart to image 0
emmanuelchio 0:9ec50d21947d 345 i=0;
emmanuelchio 0:9ec50d21947d 346 }
emmanuelchio 0:9ec50d21947d 347 }
emmanuelchio 0:9ec50d21947d 348 else if(point.x<100){
emmanuelchio 0:9ec50d21947d 349 if(i>0){ //if we can decrease i
emmanuelchio 0:9ec50d21947d 350 i--;
emmanuelchio 0:9ec50d21947d 351 }else{ //if we decrease i will be less than zero, so we move to last image instead
emmanuelchio 0:9ec50d21947d 352 i=pics-1;
emmanuelchio 0:9ec50d21947d 353 }
emmanuelchio 0:9ec50d21947d 354 }
emmanuelchio 0:9ec50d21947d 355 else{ //touch on center, EXIT
emmanuelchio 0:9ec50d21947d 356 break;
emmanuelchio 0:9ec50d21947d 357 }
emmanuelchio 0:9ec50d21947d 358 }
emmanuelchio 0:9ec50d21947d 359 lcd.SDFopenDir(".."); //return/go up to parent dir one level
emmanuelchio 0:9ec50d21947d 360 lcd.orientation(PORTRAIT_LOW); //change to portrait mode
emmanuelchio 0:9ec50d21947d 361 wait_ms(300);
emmanuelchio 0:9ec50d21947d 362 }
emmanuelchio 0:9ec50d21947d 363
emmanuelchio 0:9ec50d21947d 364 /**************************************************/
emmanuelchio 0:9ec50d21947d 365 void media(){
emmanuelchio 0:9ec50d21947d 366 unsigned int i=0, row=0, vids=0;
emmanuelchio 0:9ec50d21947d 367 unsigned long currentFrame=0, currentSecond=0;
emmanuelchio 0:9ec50d21947d 368 VIDDATA videoData;
emmanuelchio 0:9ec50d21947d 369 NUMBEROFBYTES charsPrinted;
emmanuelchio 0:9ec50d21947d 370
emmanuelchio 0:9ec50d21947d 371 lcd.orientation(LANDSCAPE_LEFT); //set orientation as landscape
emmanuelchio 0:9ec50d21947d 372 lcd.setTextColour(WHITE);
emmanuelchio 0:9ec50d21947d 373 lcd.setTextSize(FONT3);
emmanuelchio 0:9ec50d21947d 374 lcd.setTextBackFill(TRANS);
emmanuelchio 0:9ec50d21947d 375 lcd.drawGradientRect(0,0,MAX_X_LANDSCAPE,MAX_Y_LANDSCAPE,BLACK,MAGENTA,VERTICAL);
emmanuelchio 0:9ec50d21947d 376 lcd.string(80,110,MAX_X_LANDSCAPE,MAX_Y_LANDSCAPE,"Video Player",&charsPrinted);
emmanuelchio 0:9ec50d21947d 377 lcd.stopWAVFile(); //stop current playing song if any
emmanuelchio 0:9ec50d21947d 378 wait_ms(1000);
emmanuelchio 0:9ec50d21947d 379 lcd.SDFopenDir("Videos"); //open the folder with the videos
emmanuelchio 0:9ec50d21947d 380 lcd.setTextSize(FONT2);
emmanuelchio 0:9ec50d21947d 381
emmanuelchio 0:9ec50d21947d 382 while(1){
emmanuelchio 0:9ec50d21947d 383 lcd.drawGradientRect(0,0,MAX_X_LANDSCAPE,MAX_Y_LANDSCAPE,BLACK,MAGENTA,VERTICAL);
emmanuelchio 0:9ec50d21947d 384 lcd.string(5,0,MAX_X_LANDSCAPE,MAX_Y_LANDSCAPE,"Available Videos: (EXIT)",&charsPrinted);
emmanuelchio 0:9ec50d21947d 385 i=0; row=1; vids=0;
emmanuelchio 0:9ec50d21947d 386 while(1){ //list names
emmanuelchio 0:9ec50d21947d 387 lcd.SDFgetFileName(i++,name); //get the name of the vid file number i
emmanuelchio 0:9ec50d21947d 388 if(name[0]==0x00) break; //if name is invalid, meand end of files
emmanuelchio 0:9ec50d21947d 389 if(strstr(name,".vid")!=0x00){ //if .vid extension is found in the file name: print
emmanuelchio 0:9ec50d21947d 390 lcd.objButton(15,(row*30),MAX_X_LANDSCAPE-15,30+(row*30),DESELECTED,name); row++;
emmanuelchio 0:9ec50d21947d 391 vids++;
emmanuelchio 0:9ec50d21947d 392 }//else ignore name/file
emmanuelchio 0:9ec50d21947d 393 }
emmanuelchio 0:9ec50d21947d 394
emmanuelchio 0:9ec50d21947d 395 while(lcd.touchScreen(&point)==INVALID); //wait for a touch to perform action
emmanuelchio 0:9ec50d21947d 396 row=point.y/30; //decode touch point by dividing it by 30 (240/8) which gives the 30 pixels spacing between buttons
emmanuelchio 0:9ec50d21947d 397 if(row==0){ //touch on header (EXIT);
emmanuelchio 0:9ec50d21947d 398 lcd.SDFopenDir(".."); //return/go up to parent dir one level
emmanuelchio 0:9ec50d21947d 399 lcd.orientation(PORTRAIT_LOW); //change to portrait mode
emmanuelchio 0:9ec50d21947d 400 wait_ms(300);
emmanuelchio 0:9ec50d21947d 401 return; //EXIT media()
emmanuelchio 0:9ec50d21947d 402 }else if(row > vids) continue; //if touch on invalid row, where no button is present, go to top while(1)
emmanuelchio 0:9ec50d21947d 403 i=0;
emmanuelchio 0:9ec50d21947d 404 while(row){ //get name of obtained row
emmanuelchio 0:9ec50d21947d 405 lcd.SDFgetFileName(i++,name); //get the name of the vid file number i
emmanuelchio 0:9ec50d21947d 406 if(strstr(name,".vid")!=0x00) row--; //if .vid extension is found in the file name: decrease row variable
emmanuelchio 0:9ec50d21947d 407 }
emmanuelchio 0:9ec50d21947d 408 //Try to play video
emmanuelchio 0:9ec50d21947d 409 cutFileExtension(name,".vid"); //cut to name the .vid extension
emmanuelchio 0:9ec50d21947d 410 if(lcd.allocateVideoSD(name,&videoData)!=OK) continue; //try to allocate video, if fail, continue to top while(1)
emmanuelchio 0:9ec50d21947d 411 //up to here video is successfully allocated..
emmanuelchio 0:9ec50d21947d 412 currentFrame=0; currentSecond=0; //reset variables
emmanuelchio 0:9ec50d21947d 413 lcd.playWAVFile(name,&charsPrinted); //open audio if any, must be named the same as the video expept for the .extension
emmanuelchio 0:9ec50d21947d 414 while(1){
emmanuelchio 0:9ec50d21947d 415 if(lcd.playVideoSD(0,0,videoData.framesPerSec)!=OK) break; //play video for 1 second(this equal the obtained frames per second parameter) break if error
emmanuelchio 0:9ec50d21947d 416 currentSecond++; currentFrame+=videoData.framesPerSec;
emmanuelchio 0:9ec50d21947d 417 if(lcd.touchScreen(&point)==VALID){ //check about each ~1 second for a touch, if Valid:
emmanuelchio 0:9ec50d21947d 418 lcd.pauseWAVFile(); //stop audio
emmanuelchio 0:9ec50d21947d 419 //draw buttons and progress bar
emmanuelchio 0:9ec50d21947d 420 drawButtonsAndProgress(currentFrame, videoData.totalFrames);
emmanuelchio 0:9ec50d21947d 421 wait_ms(300);
emmanuelchio 0:9ec50d21947d 422 while(1){
emmanuelchio 0:9ec50d21947d 423 while(lcd.touchScreen(&point)==INVALID || point.y<170); //while no valid touch or touch outside buttons
emmanuelchio 0:9ec50d21947d 424 if(point.y > 200) break; //if touch on buttons, break while(1) and go to next ifs
emmanuelchio 0:9ec50d21947d 425 //advance file to received touch in progress bar value...
emmanuelchio 0:9ec50d21947d 426 currentFrame=((unsigned long)point.x * (unsigned long)videoData.totalFrames) / MAX_X_LANDSCAPE; //obtain new current frame value 0-319
emmanuelchio 0:9ec50d21947d 427 currentFrame= (currentFrame/(unsigned long)videoData.framesPerSec)*((unsigned long)videoData.framesPerSec); //convert currentFrame to a factor of videoData.framesPerSecond
emmanuelchio 0:9ec50d21947d 428 currentSecond=(currentFrame/(unsigned long)videoData.framesPerSec);
emmanuelchio 0:9ec50d21947d 429 lcd.setFrameVideoSD(currentFrame); //set new obtained frame
emmanuelchio 0:9ec50d21947d 430 lcd.playVideoSD(0,0,1); //show new frame
emmanuelchio 0:9ec50d21947d 431 lcd.advanceWAVFile(currentSecond); //set new value to audio file
emmanuelchio 0:9ec50d21947d 432 //update buttons and progress bar
emmanuelchio 0:9ec50d21947d 433 drawButtonsAndProgress(currentFrame, videoData.totalFrames);
emmanuelchio 0:9ec50d21947d 434 wait_ms(50);
emmanuelchio 0:9ec50d21947d 435 }
emmanuelchio 0:9ec50d21947d 436 if(point.x < 160){ //touch on continue button
emmanuelchio 0:9ec50d21947d 437 lcd.objButton(0,200,159,230,SELECTED,"Continue");
emmanuelchio 0:9ec50d21947d 438 wait_ms(300);
emmanuelchio 0:9ec50d21947d 439 lcd.pauseWAVFile(); //resume audio
emmanuelchio 0:9ec50d21947d 440 }else{ //touch on return button
emmanuelchio 0:9ec50d21947d 441 lcd.objButton(161,200,319,230,SELECTED,"Return...");
emmanuelchio 0:9ec50d21947d 442 lcd.stopWAVFile();
emmanuelchio 0:9ec50d21947d 443 wait_ms(300);
emmanuelchio 0:9ec50d21947d 444 break; //exit playback
emmanuelchio 0:9ec50d21947d 445 }
emmanuelchio 0:9ec50d21947d 446 }
emmanuelchio 0:9ec50d21947d 447 }
emmanuelchio 0:9ec50d21947d 448 }
emmanuelchio 0:9ec50d21947d 449 }
emmanuelchio 0:9ec50d21947d 450
emmanuelchio 0:9ec50d21947d 451 /**************************************************/
emmanuelchio 0:9ec50d21947d 452 void notes(){
emmanuelchio 0:9ec50d21947d 453 lcd.imageBMPSD(0,0,"Misc/notes"); //load notes design
emmanuelchio 0:9ec50d21947d 454 lcd.objButton(10,280,MAX_X_PORTRAIT-10,310,DESELECTED,"Return");
emmanuelchio 0:9ec50d21947d 455 drawHeader("Adjustments:");
emmanuelchio 0:9ec50d21947d 456 wait_ms(200); //A little delay to avoid fast image changing
emmanuelchio 0:9ec50d21947d 457
emmanuelchio 0:9ec50d21947d 458 while(1){
emmanuelchio 0:9ec50d21947d 459 while(lcd.touchScreen(&point)==INVALID); //wait for a touch to do something
emmanuelchio 0:9ec50d21947d 460 if(point.y<65){ //Touch on upper Icons
emmanuelchio 0:9ec50d21947d 461 //clear note block
emmanuelchio 0:9ec50d21947d 462 lcd.imageBMPSD(0,0,"Misc/notes"); //load notes design
emmanuelchio 0:9ec50d21947d 463 lcd.objButton(10,280,MAX_X_PORTRAIT-10,310,DESELECTED,"Return");
emmanuelchio 0:9ec50d21947d 464 drawHeader("Note pad:");
emmanuelchio 0:9ec50d21947d 465 }else if(point.y<280){ //touch on notepad
emmanuelchio 0:9ec50d21947d 466 lcd.drawCircle(point.x,point.y,1,BLACK,FILL); //draw
emmanuelchio 0:9ec50d21947d 467 }else{ //touch on return button
emmanuelchio 0:9ec50d21947d 468 lcd.objButton(10,280,MAX_X_PORTRAIT-10,310,SELECTED,"Return");
emmanuelchio 0:9ec50d21947d 469 wait_ms(300);
emmanuelchio 0:9ec50d21947d 470 return; //exit
emmanuelchio 0:9ec50d21947d 471 }
emmanuelchio 0:9ec50d21947d 472 }
emmanuelchio 0:9ec50d21947d 473 }
emmanuelchio 0:9ec50d21947d 474
emmanuelchio 0:9ec50d21947d 475 /**************************************************/
emmanuelchio 0:9ec50d21947d 476 void games(){
emmanuelchio 0:9ec50d21947d 477 int x;
emmanuelchio 0:9ec50d21947d 478 char hitFlag=0,hole,mole,moleCounter=20,points=0,pointsTotal[4]="00 "; //array to store the points
emmanuelchio 0:9ec50d21947d 479 NUMBEROFBYTES charsPrinted;
emmanuelchio 0:9ec50d21947d 480
emmanuelchio 0:9ec50d21947d 481 lcd.orientation(LANDSCAPE_LEFT); //set orientation as landscape
emmanuelchio 0:9ec50d21947d 482 lcd.SDFopenDir("Games"); //Open the Games folder that contains the images of the Application
emmanuelchio 0:9ec50d21947d 483
emmanuelchio 0:9ec50d21947d 484 while(1){ //loop forever
emmanuelchio 0:9ec50d21947d 485 lcd.drawGradientRect(0,0,MAX_X_LANDSCAPE,MAX_Y_LANDSCAPE,BLACK,MAGENTA,VERTICAL);
emmanuelchio 0:9ec50d21947d 486 lcd.setTextColour(WHITE);
emmanuelchio 0:9ec50d21947d 487 lcd.setTextSize(FONT5);
emmanuelchio 0:9ec50d21947d 488 lcd.setTextBackFill(TRANS);
emmanuelchio 0:9ec50d21947d 489 lcd.string(10,80,MAX_X_LANDSCAPE,MAX_Y_LANDSCAPE,"MOLE STOMP!!!",&charsPrinted); //show name string
emmanuelchio 0:9ec50d21947d 490 wait_ms(1000);
emmanuelchio 0:9ec50d21947d 491 lcd.string(22,130,MAX_X_LANDSCAPE,MAX_Y_LANDSCAPE,"GET READY!!!",&charsPrinted); //show ready string
emmanuelchio 0:9ec50d21947d 492 wait_ms(1500);
emmanuelchio 0:9ec50d21947d 493 lcd.imageBMPSD(0,0,"MoleArea"); //show area
emmanuelchio 0:9ec50d21947d 494 lcd.setTextSize(FONT2);
emmanuelchio 0:9ec50d21947d 495 lcd.setTextBackFill(FILLED);
emmanuelchio 0:9ec50d21947d 496 lcd.setTextBackColour(BLUE); //set the all text background to blue
emmanuelchio 0:9ec50d21947d 497
emmanuelchio 0:9ec50d21947d 498 //Start the game!
emmanuelchio 0:9ec50d21947d 499 while(moleCounter>0){ //loop the game while moleCounter reaches zero moles
emmanuelchio 0:9ec50d21947d 500 mole=rand()%3; //get a random mole 0-2
emmanuelchio 0:9ec50d21947d 501 hole=rand()%7; //get a random hole 0-6
emmanuelchio 0:9ec50d21947d 502 showMole(mole,hole); //show the random mole on the random hole
emmanuelchio 0:9ec50d21947d 503 for(x=0;x<3000;x++){ //wait some time for the player hit the mole(less time=more difficulty, more time=easy play)
emmanuelchio 0:9ec50d21947d 504 if(lcd.touchScreen(&point)==VALID){ //if we receive a touch on screen
emmanuelchio 0:9ec50d21947d 505 if(touchOnHole(hole)){ //if the touch is on the hole of the current mole
emmanuelchio 0:9ec50d21947d 506 hitFlag=1; //turn on the hit mole flag
emmanuelchio 0:9ec50d21947d 507 break; //end the waiting time
emmanuelchio 0:9ec50d21947d 508 }
emmanuelchio 0:9ec50d21947d 509 if(point.x > 270 && point.y < 50) moleCounter=0; //touch on X symbol, end game
emmanuelchio 0:9ec50d21947d 510 }
emmanuelchio 0:9ec50d21947d 511 }
emmanuelchio 0:9ec50d21947d 512 if(hitFlag==1){ //if the last mole was hit
emmanuelchio 0:9ec50d21947d 513 showMole(HITMOLE,hole); //we show the hit mole
emmanuelchio 0:9ec50d21947d 514 points++; //increase hit mole counter or points
emmanuelchio 0:9ec50d21947d 515 hitFlag=0; //clear the hit flag
emmanuelchio 0:9ec50d21947d 516 }else{ //if the last mole was missed
emmanuelchio 0:9ec50d21947d 517 showMole(MISSMOLE,hole); //show the mole hiding
emmanuelchio 0:9ec50d21947d 518 }
emmanuelchio 0:9ec50d21947d 519 pointsTotal[0]=(points/10)+0x30; //get the tens of the points and convert them to ascii
emmanuelchio 0:9ec50d21947d 520 pointsTotal[1]=(points%10)+0x30; //get the ones of the points and convert them to ascii
emmanuelchio 0:9ec50d21947d 521 lcd.string(33,27,100,100,pointsTotal,&charsPrinted); //draw the points
emmanuelchio 0:9ec50d21947d 522 wait_ms(350);
emmanuelchio 0:9ec50d21947d 523 showMole(MOLEHOLE,hole); //show the bare hole
emmanuelchio 0:9ec50d21947d 524 moleCounter--; //decrease the mole counter
emmanuelchio 0:9ec50d21947d 525 }
emmanuelchio 0:9ec50d21947d 526
emmanuelchio 0:9ec50d21947d 527 //Game over, display results
emmanuelchio 0:9ec50d21947d 528 lcd.setTextColour(YELLOW);
emmanuelchio 0:9ec50d21947d 529 lcd.setTextSize(FONT3);
emmanuelchio 0:9ec50d21947d 530 lcd.setTextBackFill(TRANS);
emmanuelchio 0:9ec50d21947d 531 lcd.string(80,50,300,220,"Whacked Moles:",&charsPrinted);
emmanuelchio 0:9ec50d21947d 532 lcd.setTextColour(BLUE);
emmanuelchio 0:9ec50d21947d 533 lcd.string(153,75,300,220,pointsTotal,&charsPrinted); //draw the converted to ascii points array
emmanuelchio 0:9ec50d21947d 534 lcd.setTextColour(RED);
emmanuelchio 0:9ec50d21947d 535 lcd.setTextSize(FONT2);
emmanuelchio 0:9ec50d21947d 536 lcd.string(50,140,319,239,"TOUCH TO RESTART",&charsPrinted);
emmanuelchio 0:9ec50d21947d 537 lcd.objButton(10,200,MAX_X_LANDSCAPE-10,230,DESELECTED,"Return");
emmanuelchio 0:9ec50d21947d 538 wait_ms(1000);
emmanuelchio 0:9ec50d21947d 539
emmanuelchio 0:9ec50d21947d 540 while(lcd.touchScreen(&point)==INVALID); //wait for a touch on screen to restart or exit
emmanuelchio 0:9ec50d21947d 541 if(point.y>200){ //touch on return button
emmanuelchio 0:9ec50d21947d 542 lcd.objButton(10,200,MAX_X_LANDSCAPE-10,230,SELECTED,"Return");
emmanuelchio 0:9ec50d21947d 543 break; //exit while(1) loop
emmanuelchio 0:9ec50d21947d 544 }//else re-start game
emmanuelchio 0:9ec50d21947d 545 moleCounter=20; //reset the moleCounter
emmanuelchio 0:9ec50d21947d 546 points=0; //reset points
emmanuelchio 0:9ec50d21947d 547 lcd.erase(); //erase screen and restart all
emmanuelchio 0:9ec50d21947d 548 }
emmanuelchio 0:9ec50d21947d 549 lcd.SDFopenDir(".."); //return/go up to parent dir one level
emmanuelchio 0:9ec50d21947d 550 lcd.orientation(PORTRAIT_LOW); //change to portrait mode
emmanuelchio 0:9ec50d21947d 551 wait_ms(300);
emmanuelchio 0:9ec50d21947d 552 }
emmanuelchio 0:9ec50d21947d 553
emmanuelchio 0:9ec50d21947d 554 /**************************************************/
emmanuelchio 0:9ec50d21947d 555 void music(){
emmanuelchio 0:9ec50d21947d 556 STATE state; static char pause=1;
emmanuelchio 0:9ec50d21947d 557 unsigned int dirs=0,songs=0;
emmanuelchio 0:9ec50d21947d 558 static unsigned int currentSong=0, volume=100;//static to save current song and volume even we exit function
emmanuelchio 0:9ec50d21947d 559 NUMBEROFBYTES charsPrinted;
emmanuelchio 0:9ec50d21947d 560
emmanuelchio 0:9ec50d21947d 561 lcd.SDFopenDir("Music"); //Open the folder that contains the songs in .wav format
emmanuelchio 0:9ec50d21947d 562 lcd.SDFgetList(&dirs,&songs); //get number of files/songs under the current folder "Music"
emmanuelchio 0:9ec50d21947d 563
emmanuelchio 0:9ec50d21947d 564 lcd.setTextColour(WHITE);
emmanuelchio 0:9ec50d21947d 565 lcd.setTextSize(FONT3);
emmanuelchio 0:9ec50d21947d 566 lcd.setTextBackFill(TRANS);
emmanuelchio 0:9ec50d21947d 567 lcd.drawGradientRect(0,0,MAX_X_PORTRAIT,MAX_Y_PORTRAIT,BLACK,MAGENTA,VERTICAL);
emmanuelchio 0:9ec50d21947d 568 lcd.string(50,140,MAX_X_PORTRAIT,MAX_Y_PORTRAIT,"Music Player",&charsPrinted);
emmanuelchio 0:9ec50d21947d 569 wait_ms(1000);
emmanuelchio 0:9ec50d21947d 570 lcd.erase();
emmanuelchio 0:9ec50d21947d 571 drawHeader("Music:");
emmanuelchio 0:9ec50d21947d 572 lcd.getWAVPlayState(&state); //get playing state
emmanuelchio 0:9ec50d21947d 573 if(state==DISABLE) pause=1; //if not playing, set pause to active
emmanuelchio 0:9ec50d21947d 574 drawControlPLAY(pause); //draw button according to pause
emmanuelchio 0:9ec50d21947d 575 drawControlRR(DESELECTED);
emmanuelchio 0:9ec50d21947d 576 drawControlFF(DESELECTED);
emmanuelchio 0:9ec50d21947d 577 //draw current volume bar
emmanuelchio 0:9ec50d21947d 578 lcd.drawRectangle(0,245,(volume*MAX_X_PORTRAIT)/(100),260,YELLOW,FILL); //scale volume value to 0-239 pixels
emmanuelchio 0:9ec50d21947d 579 lcd.drawRectangle((volume*MAX_X_PORTRAIT)/(100),245,319,260,BLACK,FILL); //scale volume value to 0-239 pixels
emmanuelchio 0:9ec50d21947d 580
emmanuelchio 0:9ec50d21947d 581 while(1){
emmanuelchio 0:9ec50d21947d 582 lcd.getWAVPlayState(&state); //get playing state
emmanuelchio 0:9ec50d21947d 583 if(state==DISABLE){pause=1; drawControlPLAY(pause);} //if not playing, set pause to active and update button
emmanuelchio 0:9ec50d21947d 584 if(pause==0) lcd.drawGradientRect(0,70,MAX_X_PORTRAIT,240,(rand()%0xFFFF),(rand()%0xFFFF),HORIZONTAL);
emmanuelchio 0:9ec50d21947d 585
emmanuelchio 0:9ec50d21947d 586 wait_ms(100);
emmanuelchio 0:9ec50d21947d 587 if(lcd.touchScreen(&point)==VALID){ //ask for touch and if valid..
emmanuelchio 0:9ec50d21947d 588 if(point.y>265){ //Touch on controls
emmanuelchio 0:9ec50d21947d 589 if(point.x<80){ //touch on << icon
emmanuelchio 0:9ec50d21947d 590 drawControlRR(SELECTED);
emmanuelchio 0:9ec50d21947d 591 lcd.advanceWAVFile(0); //rewind song to beginning
emmanuelchio 0:9ec50d21947d 592 wait_ms(300); //wait
emmanuelchio 0:9ec50d21947d 593 drawControlRR(DESELECTED);
emmanuelchio 0:9ec50d21947d 594 }else if(point.x<160){ //touch on Play/Pause icon
emmanuelchio 0:9ec50d21947d 595 if(state == ENABLE){ //if playing
emmanuelchio 0:9ec50d21947d 596 lcd.pauseWAVFile(); //pause playing
emmanuelchio 0:9ec50d21947d 597 pause=!pause;
emmanuelchio 0:9ec50d21947d 598 }else{ //begin to play any song
emmanuelchio 0:9ec50d21947d 599 lcd.SDFgetFileName(currentSong,name); //get the name of the song file number currentSong
emmanuelchio 0:9ec50d21947d 600 cutFileExtension(name,".wav"); //cut to name the .wav extension
emmanuelchio 0:9ec50d21947d 601 lcd.playWAVFile(name,&charsPrinted); //play file - returns the duration of the song in seconds
emmanuelchio 0:9ec50d21947d 602 lcd.drawRectangle(0,25,MAX_X_PORTRAIT,70,BLACK,FILL); //erase previous name
emmanuelchio 0:9ec50d21947d 603 lcd.string(10,30,MAX_X_PORTRAIT,MAX_Y_PORTRAIT,name,&charsPrinted); //print new name
emmanuelchio 0:9ec50d21947d 604 pause=0;
emmanuelchio 0:9ec50d21947d 605 }
emmanuelchio 0:9ec50d21947d 606 wait_ms(300);
emmanuelchio 0:9ec50d21947d 607 }else{ //point.x<240 //touch on >> icon
emmanuelchio 0:9ec50d21947d 608 drawControlFF(SELECTED);
emmanuelchio 0:9ec50d21947d 609 lcd.stopWAVFile(); //stop current playing song if any
emmanuelchio 0:9ec50d21947d 610 currentSong++; //advance current song
emmanuelchio 0:9ec50d21947d 611 if(currentSong>=songs) currentSong=0; //check
emmanuelchio 0:9ec50d21947d 612 lcd.SDFgetFileName(currentSong,name); //get the name of the song file number currentSong
emmanuelchio 0:9ec50d21947d 613 cutFileExtension(name,".wav"); //cut to name the .wav extension
emmanuelchio 0:9ec50d21947d 614 lcd.playWAVFile(name,&charsPrinted); //play file
emmanuelchio 0:9ec50d21947d 615 lcd.drawRectangle(0,25,MAX_X_PORTRAIT,70,BLACK,FILL); //erase previous name
emmanuelchio 0:9ec50d21947d 616 lcd.string(10,30,MAX_X_PORTRAIT,MAX_Y_PORTRAIT,name,&charsPrinted); //print new name
emmanuelchio 0:9ec50d21947d 617 pause=0;
emmanuelchio 0:9ec50d21947d 618 wait_ms(300); //wait
emmanuelchio 0:9ec50d21947d 619 drawControlFF(DESELECTED);
emmanuelchio 0:9ec50d21947d 620 }
emmanuelchio 0:9ec50d21947d 621 drawControlPLAY(pause); //update button
emmanuelchio 0:9ec50d21947d 622 }else if(point.y>240){ //Touch on volume bar
emmanuelchio 0:9ec50d21947d 623 volume=(point.x*100)/MAX_X_PORTRAIT; //obtain new volume parameter by scaling to 0-239 pixels
emmanuelchio 0:9ec50d21947d 624 lcd.setVolumeWAV(volume); //set new volume to SmartGPU Audio
emmanuelchio 0:9ec50d21947d 625 //update volume bar
emmanuelchio 0:9ec50d21947d 626 lcd.drawRectangle(0,245,(volume*MAX_X_PORTRAIT)/(100),260,YELLOW,FILL); //scale volume value to 0-239 pixels
emmanuelchio 0:9ec50d21947d 627 lcd.drawRectangle((volume*MAX_X_PORTRAIT)/(100),245,MAX_X_PORTRAIT,260,BLACK,FILL); //scale volume value to 0-239 pixels
emmanuelchio 0:9ec50d21947d 628 wait_ms(50);
emmanuelchio 0:9ec50d21947d 629 }else if(point.y<20){ //if touch on main header, go to main menu
emmanuelchio 0:9ec50d21947d 630 lcd.SDFopenDir(".."); //return/go up to parent dir one level
emmanuelchio 0:9ec50d21947d 631 wait_ms(300);
emmanuelchio 0:9ec50d21947d 632 return;
emmanuelchio 0:9ec50d21947d 633 }
emmanuelchio 0:9ec50d21947d 634 }
emmanuelchio 0:9ec50d21947d 635 }
emmanuelchio 0:9ec50d21947d 636 }
emmanuelchio 0:9ec50d21947d 637
emmanuelchio 0:9ec50d21947d 638 /**************************************************/
emmanuelchio 0:9ec50d21947d 639 void wallpaper(){
emmanuelchio 0:9ec50d21947d 640 unsigned int dirs=0,walls=0, i=0;
emmanuelchio 0:9ec50d21947d 641 NUMBEROFBYTES charsPrinted;
emmanuelchio 0:9ec50d21947d 642
emmanuelchio 0:9ec50d21947d 643 lcd.SDFopenDir("Wall") ; //Open the folder that contains the wallpaper images
emmanuelchio 0:9ec50d21947d 644 lcd.SDFgetList(&dirs,&walls); //get number of files/Pics under the current folder "Wall"
emmanuelchio 0:9ec50d21947d 645
emmanuelchio 0:9ec50d21947d 646 lcd.setTextColour(WHITE);
emmanuelchio 0:9ec50d21947d 647 lcd.setTextSize(FONT3);
emmanuelchio 0:9ec50d21947d 648 lcd.setTextBackFill(TRANS);
emmanuelchio 0:9ec50d21947d 649 lcd.drawGradientRect(0,0,MAX_X_PORTRAIT,MAX_Y_PORTRAIT,BLACK,MAGENTA,VERTICAL);
emmanuelchio 0:9ec50d21947d 650 lcd.string(55,140,MAX_X_PORTRAIT,MAX_Y_PORTRAIT,"Wallpapers",&charsPrinted);
emmanuelchio 0:9ec50d21947d 651 wait_ms(1000);
emmanuelchio 0:9ec50d21947d 652
emmanuelchio 0:9ec50d21947d 653 while(1){
emmanuelchio 0:9ec50d21947d 654 lcd.SDFgetFileName(i,name); //get the name of the wall file number i
emmanuelchio 0:9ec50d21947d 655 cutFileExtension(name,".bmp"); //cut to name the .bmp extension
emmanuelchio 0:9ec50d21947d 656 lcd.imageBMPSD(0,0,name); //Load image from SD card, all images are 240x320(full screen) so we load them from top left corner X:0,Y:0
emmanuelchio 0:9ec50d21947d 657 drawHeader("Wallpapers:");
emmanuelchio 0:9ec50d21947d 658 wait_ms(200); //A little delay to avoid fast image changing
emmanuelchio 0:9ec50d21947d 659 lcd.objButton(10,25,MAX_X_PORTRAIT-10,55,DESELECTED,"Set as Wall");
emmanuelchio 0:9ec50d21947d 660 lcd.objButton(10,280,MAX_X_PORTRAIT-10,310,DESELECTED,"Return");
emmanuelchio 0:9ec50d21947d 661
emmanuelchio 0:9ec50d21947d 662 while(lcd.touchScreen(&point)==INVALID); //wait for a touch to do something
emmanuelchio 0:9ec50d21947d 663
emmanuelchio 0:9ec50d21947d 664 if(point.y > 280){ //if touch on "return" button, break to exit while(1);
emmanuelchio 0:9ec50d21947d 665 lcd.objButton(10,280,MAX_X_PORTRAIT-10,310,SELECTED,"Return");
emmanuelchio 0:9ec50d21947d 666 lcd.SDFopenDir(".."); //return/go up to parent dir one level
emmanuelchio 0:9ec50d21947d 667 wait_ms(300);
emmanuelchio 0:9ec50d21947d 668 return; //EXIT
emmanuelchio 0:9ec50d21947d 669 }
emmanuelchio 0:9ec50d21947d 670 if(point.y < 60){ //if touch on "set as wall" button
emmanuelchio 0:9ec50d21947d 671 lcd.objButton(10,25,MAX_X_PORTRAIT-10,55,SELECTED,"Set as Wall");
emmanuelchio 0:9ec50d21947d 672 lcd.setTextSize(FONT2);
emmanuelchio 0:9ec50d21947d 673 lcd.string(22,140,MAX_X_PORTRAIT,MAX_Y_PORTRAIT,"Saved on EEPROM",&charsPrinted);
emmanuelchio 0:9ec50d21947d 674 saveWallpaperToEEPROM(); //Save the current contents of "name" array to EEPROM
emmanuelchio 0:9ec50d21947d 675 wait_ms(500);
emmanuelchio 0:9ec50d21947d 676 continue;
emmanuelchio 0:9ec50d21947d 677 }
emmanuelchio 0:9ec50d21947d 678 //check if we go to the next image, or to the previous one
emmanuelchio 0:9ec50d21947d 679 if(point.x>120){ //if the received touch was on the right side of the screen we advance the image, else we decrease and go to previous image
emmanuelchio 0:9ec50d21947d 680 i++; //decrease image selector
emmanuelchio 0:9ec50d21947d 681 if(i>=walls){ //if we reach the position of the last image, we restart to image 0
emmanuelchio 0:9ec50d21947d 682 i=0;
emmanuelchio 0:9ec50d21947d 683 }
emmanuelchio 0:9ec50d21947d 684 }else{ //touch on left side of screen
emmanuelchio 0:9ec50d21947d 685 if(i>0){ //if we can decrease i
emmanuelchio 0:9ec50d21947d 686 i--;
emmanuelchio 0:9ec50d21947d 687 }else{ //if we decrease i will be less than zero, so we move to last image instead
emmanuelchio 0:9ec50d21947d 688 i=walls-1;
emmanuelchio 0:9ec50d21947d 689 }
emmanuelchio 0:9ec50d21947d 690 }
emmanuelchio 0:9ec50d21947d 691 }
emmanuelchio 0:9ec50d21947d 692 }
emmanuelchio 0:9ec50d21947d 693
emmanuelchio 0:9ec50d21947d 694 /***************************************************/
emmanuelchio 0:9ec50d21947d 695 /***************************************************/
emmanuelchio 0:9ec50d21947d 696 void initializeSmartGPU2(void){ //Initialize SMARTGPU2 Board
emmanuelchio 0:9ec50d21947d 697 lcd.reset(); //physically reset SMARTGPU2
emmanuelchio 0:9ec50d21947d 698 lcd.start(); //initialize the SMARTGPU2 processor
emmanuelchio 0:9ec50d21947d 699 }
emmanuelchio 0:9ec50d21947d 700
emmanuelchio 0:9ec50d21947d 701 /***************************************************/
emmanuelchio 0:9ec50d21947d 702 /***************************************************/
emmanuelchio 0:9ec50d21947d 703 /***************************************************/
emmanuelchio 0:9ec50d21947d 704 /***************************************************/
emmanuelchio 0:9ec50d21947d 705 int main() {
emmanuelchio 0:9ec50d21947d 706 unsigned char icons;
emmanuelchio 0:9ec50d21947d 707
emmanuelchio 0:9ec50d21947d 708 initializeSmartGPU2(); //Init communication with SmartGPU2 board
emmanuelchio 0:9ec50d21947d 709
emmanuelchio 0:9ec50d21947d 710 lcd.baudChange(BAUD7); //set high baud for advanced applications
emmanuelchio 0:9ec50d21947d 711 lcd.orientation(PORTRAIT_LOW); //set orientation as portrait
emmanuelchio 0:9ec50d21947d 712 lcd.initDACAudio(ENABLE); //Turn on the Audio DACs
emmanuelchio 0:9ec50d21947d 713 lcd.audioBoost(ENABLE); //ENABLE boost
emmanuelchio 0:9ec50d21947d 714 lcd.SDFopenDir("FullGUI"); //Open the FullGUI folder that contains the images of the Application
emmanuelchio 0:9ec50d21947d 715
emmanuelchio 0:9ec50d21947d 716 while(1){
emmanuelchio 0:9ec50d21947d 717 //draw MainMenu
emmanuelchio 0:9ec50d21947d 718 drawMainMenu();
emmanuelchio 0:9ec50d21947d 719
emmanuelchio 0:9ec50d21947d 720 icons=getTouchIconMainMenu(); //ask for a touch on one of the icons of main menu and return icon#
emmanuelchio 0:9ec50d21947d 721 switch(icons){
emmanuelchio 0:9ec50d21947d 722 case 1: //case icon 1
emmanuelchio 0:9ec50d21947d 723 backlight();
emmanuelchio 0:9ec50d21947d 724 break;
emmanuelchio 0:9ec50d21947d 725 case 2: //case icon 2
emmanuelchio 0:9ec50d21947d 726 //calculator();
emmanuelchio 0:9ec50d21947d 727 break;
emmanuelchio 0:9ec50d21947d 728 case 3: //case icon 3
emmanuelchio 0:9ec50d21947d 729 clocks();
emmanuelchio 0:9ec50d21947d 730 break;
emmanuelchio 0:9ec50d21947d 731 case 4: //case icon 4
emmanuelchio 0:9ec50d21947d 732 games();
emmanuelchio 0:9ec50d21947d 733 break;
emmanuelchio 0:9ec50d21947d 734 case 5: //case icon 5
emmanuelchio 0:9ec50d21947d 735 //maps();
emmanuelchio 0:9ec50d21947d 736 break;
emmanuelchio 0:9ec50d21947d 737 case 6: //case icon 6
emmanuelchio 0:9ec50d21947d 738 media();
emmanuelchio 0:9ec50d21947d 739 break;
emmanuelchio 0:9ec50d21947d 740 case 7: //case icon 7
emmanuelchio 0:9ec50d21947d 741 notes();
emmanuelchio 0:9ec50d21947d 742 break;
emmanuelchio 0:9ec50d21947d 743 case 8: //case icon 8
emmanuelchio 0:9ec50d21947d 744 photos();
emmanuelchio 0:9ec50d21947d 745 break;
emmanuelchio 0:9ec50d21947d 746 case 9: //case icon 9
emmanuelchio 0:9ec50d21947d 747 //wifi();
emmanuelchio 0:9ec50d21947d 748 break;
emmanuelchio 0:9ec50d21947d 749 case 10: //case icon 10
emmanuelchio 0:9ec50d21947d 750 //settings();
emmanuelchio 0:9ec50d21947d 751 break;
emmanuelchio 0:9ec50d21947d 752 case 11: //case icon 11
emmanuelchio 0:9ec50d21947d 753 //calls();
emmanuelchio 0:9ec50d21947d 754 break;
emmanuelchio 0:9ec50d21947d 755 case 12: //case icon 12
emmanuelchio 0:9ec50d21947d 756 music();
emmanuelchio 0:9ec50d21947d 757 break;
emmanuelchio 0:9ec50d21947d 758 case 13: //case icon 13
emmanuelchio 0:9ec50d21947d 759 wallpaper();
emmanuelchio 0:9ec50d21947d 760 break;
emmanuelchio 0:9ec50d21947d 761 default:
emmanuelchio 0:9ec50d21947d 762 //do nothing
emmanuelchio 0:9ec50d21947d 763 break;
emmanuelchio 0:9ec50d21947d 764 }
emmanuelchio 0:9ec50d21947d 765 }
emmanuelchio 0:9ec50d21947d 766 }