AirsoftTimer software based on mbed

Dependencies:   mbed TextLCD keypad

Committer:
sillevl
Date:
Sat May 23 22:42:51 2015 +0000
Revision:
19:2eba101d9c2c
Parent:
18:abcebc4d0da0
Child:
20:b89791ecceec
game selector working (solved strange behaviour with buttonEvent and lcd commands)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sillevl 5:be598835bab0 1 #include "Board.h"
sillevl 5:be598835bab0 2
sillevl 5:be598835bab0 3 Board::Board(Pinouts pinouts){
sillevl 5:be598835bab0 4 lcd = new LCD(pinouts.lcd.rs, pinouts.lcd.e, pinouts.lcd.p4, pinouts.lcd.p5, pinouts.lcd.p6, pinouts.lcd.p7, LCD::LCD20x4);
sillevl 5:be598835bab0 5 leds = new Leds(pinouts.leds.left, pinouts.leds.right);
sillevl 5:be598835bab0 6 button = new Button(pinouts.button);
sillevl 5:be598835bab0 7 key = new Key(pinouts.key);
sillevl 5:be598835bab0 8 keyboard = new Keyboard(pinouts.keyboard);
sillevl 5:be598835bab0 9 buzzer = new Buzzer(pinouts.buzzer);
sillevl 17:19dbb1dbb640 10
sillevl 17:19dbb1dbb640 11 keyboard->attach(this, &Board::keyboardButton);
sillevl 17:19dbb1dbb640 12 //printf("keyboard attached\r\n");
sillevl 17:19dbb1dbb640 13 keyboard->start(); // energize the keypad via c0-c3
sillevl 17:19dbb1dbb640 14 //printf("keyboard started\r\n");
sillevl 17:19dbb1dbb640 15 }
sillevl 17:19dbb1dbb640 16
sillevl 17:19dbb1dbb640 17 uint32_t Board::keyboardButton(uint32_t index){
sillevl 19:2eba101d9c2c 18 //printf("button pressed \r\n");
sillevl 17:19dbb1dbb640 19 //printf("button index: %d\r\n", index);
sillevl 17:19dbb1dbb640 20 //printf("button car: %c\r\n", Keyboard::KEYTABLE[index]);
sillevl 19:2eba101d9c2c 21 _callback.call(Keyboard::KEYTABLE[index]);
sillevl 18:abcebc4d0da0 22 //buttonEvent(Keyboard::KEYTABLE[index]);
sillevl 17:19dbb1dbb640 23 return 0;
sillevl 16:e8e96bf22df1 24 }
sillevl 16:e8e96bf22df1 25
sillevl 18:abcebc4d0da0 26 /*void Board::attach(ButtonListener *bl)
sillevl 16:e8e96bf22df1 27 {
sillevl 17:19dbb1dbb640 28 //printf("ButtonListener attached\r\n");
sillevl 16:e8e96bf22df1 29 listeners.push_back(bl);
sillevl 17:19dbb1dbb640 30 //printf("done\r\n");
sillevl 18:abcebc4d0da0 31 }*/
sillevl 18:abcebc4d0da0 32 /*void Board::buttonEvent(char c)
sillevl 16:e8e96bf22df1 33 {
sillevl 17:19dbb1dbb640 34 //printf("ButtonListener executing\r\n");
sillevl 16:e8e96bf22df1 35 for (int i = 0; i < listeners.size(); i++)
sillevl 16:e8e96bf22df1 36 listeners[i]->buttonEvent(c);
sillevl 17:19dbb1dbb640 37 //printf("done\r\n");
sillevl 18:abcebc4d0da0 38 }*/