AirsoftTimer software based on mbed

Dependencies:   mbed TextLCD keypad

Committer:
sillevl
Date:
Sat Dec 13 10:11:24 2014 +0000
Revision:
4:2c91c9eccf3a
Parent:
0:4a0929f1b4fd
Child:
5:be598835bab0
refactored startup code and added class placeholders for interface devices (board)

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 4:2c91c9eccf3a 14 //create lcd
sillevl 4:2c91c9eccf3a 15 lcd = new LCD(pinouts.lcd.rs, pinouts.lcd.e, pinouts.lcd.p4, pinouts.lcd.p5, pinouts.lcd.p6, pinouts.lcd.p7, LCD::LCD20x4);
sillevl 4:2c91c9eccf3a 16 //create leds
sillevl 4:2c91c9eccf3a 17 //create button
sillevl 4:2c91c9eccf3a 18 //create key
sillevl 4:2c91c9eccf3a 19 //create keyboard
sillevl 4:2c91c9eccf3a 20 init();
sillevl 4:2c91c9eccf3a 21 //run();
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 0:4a0929f1b4fd 31
sillevl 4:2c91c9eccf3a 32 void Airsofttimer::init(){
sillevl 4:2c91c9eccf3a 33 // initial beep on startup
sillevl 4:2c91c9eccf3a 34 // clear screen
sillevl 4:2c91c9eccf3a 35 // show PIC logo
sillevl 4:2c91c9eccf3a 36 for(int line = 0; line < 4; line++){
sillevl 4:2c91c9eccf3a 37 //lcd->setCursor(0,line);
sillevl 4:2c91c9eccf3a 38 //lcd->print(LOGO[line]);
sillevl 4:2c91c9eccf3a 39 }
sillevl 4:2c91c9eccf3a 40 // wait 5 sec
sillevl 4:2c91c9eccf3a 41 // clear LCD
sillevl 4:2c91c9eccf3a 42
sillevl 4:2c91c9eccf3a 43 }