AirsoftTimer software based on mbed
Dependencies: mbed TextLCD keypad
Airsofttimer.cpp@5:be598835bab0, 2014-12-13 (annotated)
- Committer:
- sillevl
- Date:
- Sat Dec 13 12:24:37 2014 +0000
- Revision:
- 5:be598835bab0
- Parent:
- 4:2c91c9eccf3a
- Child:
- 8:e9fb60f5a56f
Refactored game board (all hardware) and added abstract game class
Who changed what in which revision?
User | Revision | Line number | New 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 | 5:be598835bab0 | 16 | |
sillevl | 5:be598835bab0 | 17 | while(true){ |
sillevl | 5:be598835bab0 | 18 | Game* game = Game::create_game(board, 0); |
sillevl | 5:be598835bab0 | 19 | game->run(); |
sillevl | 5:be598835bab0 | 20 | delete game; |
sillevl | 5:be598835bab0 | 21 | } |
sillevl | 4:2c91c9eccf3a | 22 | } |
sillevl | 0:4a0929f1b4fd | 23 | |
sillevl | 4:2c91c9eccf3a | 24 | const char* Airsofttimer::LOGO[16] = { |
sillevl | 4:2c91c9eccf3a | 25 | " \xFF\xFF\xFF \xFF \xFF\xFF\xFF", |
sillevl | 4:2c91c9eccf3a | 26 | " \xFF \xFF \xFF \xFF", |
sillevl | 4:2c91c9eccf3a | 27 | " \xFF\xFF\xFF \xFF \xFF", |
sillevl | 4:2c91c9eccf3a | 28 | " \xFF \xFF \xFF\xFF\xFF" |
sillevl | 4:2c91c9eccf3a | 29 | }; |
sillevl | 4:2c91c9eccf3a | 30 | |
sillevl | 4:2c91c9eccf3a | 31 | void Airsofttimer::init(){ |
sillevl | 5:be598835bab0 | 32 | board->buzzer->startupBeep(); |
sillevl | 5:be598835bab0 | 33 | board->lcd->cls(); |
sillevl | 5:be598835bab0 | 34 | board->lcd->showLogo(LOGO); |
sillevl | 5:be598835bab0 | 35 | wait(5.0); |
sillevl | 5:be598835bab0 | 36 | board->lcd->cls(); |
sillevl | 4:2c91c9eccf3a | 37 | } |