AirsoftTimer software based on mbed

Dependencies:   mbed TextLCD keypad

Committer:
sillevl
Date:
Sat Dec 13 12:48:28 2014 +0000
Revision:
8:e9fb60f5a56f
Parent:
5:be598835bab0
Child:
9:b587bae22691
Refactored Airsofttimer class to have start method

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sillevl 0:4a0929f1b4fd 1
sillevl 0:4a0929f1b4fd 2 #include "Airsofttimer.h"
sillevl 0:4a0929f1b4fd 3
sillevl 4:2c91c9eccf3a 4 // buttonPin = P0_4; //P0.4
sillevl 4:2c91c9eccf3a 5 // keyPin = P0_5; //P0.5
sillevl 4:2c91c9eccf3a 6 // ledAPin = P2_4; //P2.4
sillevl 4:2c91c9eccf3a 7 // ledBPin = P2_5; //P2.5
sillevl 4:2c91c9eccf3a 8 // buzzerPin = P2_3; //P2.3
sillevl 4:2c91c9eccf3a 9 // keyboardRowPins = {P0_8 , P0_9 , P0_10, P0_11}; // ROWS=P0.8 -> P0.11
sillevl 4:2c91c9eccf3a 10 // keyboardColPins = {P0_16, P0_17, P0_18}; // COLS=P0.16 -> P0.18
sillevl 4:2c91c9eccf3a 11 // 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
sillevl 0:4a0929f1b4fd 12
sillevl 4:2c91c9eccf3a 13 Airsofttimer::Airsofttimer(Pinouts pinouts){
sillevl 5:be598835bab0 14 board = new Board(pinouts);
sillevl 4:2c91c9eccf3a 15 init();
sillevl 8:e9fb60f5a56f 16 start();
sillevl 4:2c91c9eccf3a 17 }
sillevl 0:4a0929f1b4fd 18
sillevl 4:2c91c9eccf3a 19 const char* Airsofttimer::LOGO[16] = {
sillevl 4:2c91c9eccf3a 20 " \xFF\xFF\xFF \xFF \xFF\xFF\xFF",
sillevl 4:2c91c9eccf3a 21 " \xFF \xFF \xFF \xFF",
sillevl 4:2c91c9eccf3a 22 " \xFF\xFF\xFF \xFF \xFF",
sillevl 4:2c91c9eccf3a 23 " \xFF \xFF \xFF\xFF\xFF"
sillevl 4:2c91c9eccf3a 24 };
sillevl 4:2c91c9eccf3a 25
sillevl 4:2c91c9eccf3a 26 void Airsofttimer::init(){
sillevl 5:be598835bab0 27 board->buzzer->startupBeep();
sillevl 5:be598835bab0 28 board->lcd->cls();
sillevl 5:be598835bab0 29 board->lcd->showLogo(LOGO);
sillevl 5:be598835bab0 30 wait(5.0);
sillevl 5:be598835bab0 31 board->lcd->cls();
sillevl 4:2c91c9eccf3a 32 }
sillevl 8:e9fb60f5a56f 33
sillevl 8:e9fb60f5a56f 34 void Airsofttimer::start(){
sillevl 8:e9fb60f5a56f 35 while(true){
sillevl 8:e9fb60f5a56f 36 // first we need to select a game from the available games list
sillevl 8:e9fb60f5a56f 37 Game* game = Game::create_game(board, 0);
sillevl 8:e9fb60f5a56f 38 game->run();
sillevl 8:e9fb60f5a56f 39 delete game;
sillevl 8:e9fb60f5a56f 40 }
sillevl 8:e9fb60f5a56f 41 }