AirsoftTimer software based on mbed
Dependencies: mbed TextLCD keypad
board/Board.cpp@16:e8e96bf22df1, 2015-05-23 (annotated)
- Committer:
- sillevl
- Date:
- Sat May 23 18:36:54 2015 +0000
- Revision:
- 16:e8e96bf22df1
- Parent:
- 5:be598835bab0
- Child:
- 17:19dbb1dbb640
added observer for button events;
Who changed what in which revision?
User | Revision | Line number | New 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 | 16:e8e96bf22df1 | 10 | } |
sillevl | 16:e8e96bf22df1 | 11 | |
sillevl | 16:e8e96bf22df1 | 12 | void Board::attach(ButtonListener *bl) |
sillevl | 16:e8e96bf22df1 | 13 | { |
sillevl | 16:e8e96bf22df1 | 14 | listeners.push_back(bl); |
sillevl | 16:e8e96bf22df1 | 15 | } |
sillevl | 16:e8e96bf22df1 | 16 | void Board::buttonEvent(char c) |
sillevl | 16:e8e96bf22df1 | 17 | { |
sillevl | 16:e8e96bf22df1 | 18 | for (int i = 0; i < listeners.size(); i++) |
sillevl | 16:e8e96bf22df1 | 19 | listeners[i]->buttonEvent(c); |
sillevl | 5:be598835bab0 | 20 | } |