Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: N5110 SDFileSystem mbed
main.cpp
00001 #include "mbed.h" 00002 #include "Patterns.h" 00003 #include "N5110.h" 00004 #include "SDFileSystem.h" 00005 #include "Joystick.h" 00006 #include "Game.h" 00007 #include "main.h" 00008 00009 int main() 00010 { 00011 init(); 00012 while(1) { 00013 if(g_menuTimer_flag ) { 00014 g_menuTimer_flag =0; 00015 00016 if (g_button_flag ) {// if button pressed, go to next menu according current state and pointer position input 00017 g_button_flag =0; 00018 state=fsm[state].nextState[pointer_position ]; 00019 lcd.clear(); 00020 } 00021 00022 switch(state) { 00023 case 0: // main menu 00024 pointer(); 00025 red_led=0; 00026 green_led=0; 00027 lcd.printString("Tetis Game",10,1); 00028 lcd.printString("START",25,3); 00029 lcd.printString("SCORE",25,4); 00030 lcd.refresh(); 00031 break; 00032 case 1: // game level choosing menu 00033 pointer(); 00034 red_led=0; 00035 green_led=0; 00036 lcd.printString("Game Level",10,1); 00037 lcd.printString("EASY",25,3); 00038 lcd.printString("HARD",25,4); 00039 lcd.printString("Back",60,5); 00040 lcd.refresh(); 00041 break; 00042 case 2: // highest score menu 00043 red_led=0; 00044 green_led=0; 00045 lcd.printString("Highest Score:",1,1); 00046 int top_score; 00047 top_score=read_score_SD(); 00048 char score [14]; 00049 sprintf(score,"%d",top_score); 00050 lcd.printString(score,30,3); 00051 lcd.printString("Press Button",0,4); 00052 lcd.printString("To Exit",0,5); 00053 lcd.refresh(); 00054 break; 00055 case 3: // easy game menu 00056 init_game(); 00057 game.attach(&game_isr,0.2); 00058 lcd.printString("easy",42,1); 00059 tetis_game(); 00060 break; 00061 case 4: // hard game menu 00062 init_game(); 00063 game.attach(&game_isr,0.1); 00064 lcd.printString("hard",42,1); 00065 tetis_game(); 00066 break; 00067 } 00068 } 00069 sleep(); 00070 } 00071 }
Generated on Mon Sep 12 2022 12:25:09 by
1.7.2