AirsoftTimer software based on mbed
Dependencies: mbed TextLCD keypad
Diff: board/Board.cpp
- Revision:
- 17:19dbb1dbb640
- Parent:
- 16:e8e96bf22df1
- Child:
- 18:abcebc4d0da0
--- a/board/Board.cpp Sat May 23 18:36:54 2015 +0000 +++ b/board/Board.cpp Sat May 23 20:17:54 2015 +0000 @@ -7,14 +7,32 @@ key = new Key(pinouts.key); keyboard = new Keyboard(pinouts.keyboard); buzzer = new Buzzer(pinouts.buzzer); + + keyboard->attach(this, &Board::keyboardButton); + //printf("keyboard attached\r\n"); + keyboard->start(); // energize the keypad via c0-c3 + //printf("keyboard started\r\n"); +} + +uint32_t Board::keyboardButton(uint32_t index){ + //printf("button pressed \r\n"); + //printf("button index: %d\r\n", index); + //printf("button car: %c\r\n", Keyboard::KEYTABLE[index]); + buttonEvent(Keyboard::KEYTABLE[index]); + leds->on(Leds::LEFT); + return 0; } void Board::attach(ButtonListener *bl) { + //printf("ButtonListener attached\r\n"); listeners.push_back(bl); + //printf("done\r\n"); } void Board::buttonEvent(char c) { + //printf("ButtonListener executing\r\n"); for (int i = 0; i < listeners.size(); i++) listeners[i]->buttonEvent(c); + //printf("done\r\n"); } \ No newline at end of file