AirsoftTimer software based on mbed
Dependencies: mbed TextLCD keypad
Airsofttimer.cpp
00001 00002 #include "Airsofttimer.h" 00003 #include "games/GameSelector.h" 00004 00005 // buttonPin = P0_4; //P0.4 00006 // keyPin = P0_5; //P0.5 00007 // ledAPin = P2_4; //P2.4 00008 // ledBPin = P2_5; //P2.5 00009 // buzzerPin = P2_3; //P2.3 00010 // keyboardRowPins = {P0_8 , P0_9 , P0_10, P0_11}; // ROWS=P0.8 -> P0.11 00011 // keyboardColPins = {P0_16, P0_17, P0_18}; // COLS=P0.16 -> P0.18 00012 // lcdPins = {P1_31, P1_30, P0_23, P0_24, P0_23, P0_26}; // E=P1.31, RS=P1.30, D4=P0.23 -> D7=P0.26 00013 00014 Airsofttimer::Airsofttimer(Pinouts pinouts){ 00015 board = new Board(pinouts); 00016 init(); 00017 start(); 00018 } 00019 00020 const char* Airsofttimer::LOGO[16] = { 00021 " \xFF\xFF\xFF \xFF \xFF\xFF\xFF", 00022 " \xFF \xFF \xFF \xFF", 00023 " \xFF\xFF\xFF \xFF \xFF", 00024 " \xFF \xFF \xFF\xFF\xFF" 00025 }; 00026 00027 void Airsofttimer::init(){ 00028 board->buzzer->startupBeep(); 00029 board->lcd->cls(); 00030 board->lcd->showLogo(LOGO); 00031 wait(3.0); 00032 board->lcd->cls(); 00033 } 00034 00035 void Airsofttimer::start(){ 00036 while(true){ 00037 // first we need to select a game from the available games list 00038 int game_number = select_game(); 00039 Game* game = GameFactory::create(board, game_number); 00040 game->setup(); 00041 game->run(); 00042 delete game; 00043 } 00044 } 00045 00046 // show a list of games, and select one 00047 int Airsofttimer::select_game(){ 00048 GameSelector* selector = new GameSelector(board); 00049 return selector->select(); 00050 }
Generated on Tue Jul 12 2022 21:04:09 by 1.7.2