Library implementing menu system, with RPG interface, navigator system
Dependencies: Menu RPG TextLCD mbed
main.cpp@0:10b365b7873b, 2013-02-28 (annotated)
- Committer:
- pyeh9
- Date:
- Thu Feb 28 22:19:56 2013 +0000
- Revision:
- 0:10b365b7873b
- Child:
- 2:202735df93cd
First commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pyeh9 | 0:10b365b7873b | 1 | #include "mbed.h" |
pyeh9 | 0:10b365b7873b | 2 | #include "TextLCD.h" |
pyeh9 | 0:10b365b7873b | 3 | #include "SDFileSystem.h" |
pyeh9 | 0:10b365b7873b | 4 | #include "RPG.h" |
pyeh9 | 0:10b365b7873b | 5 | #include <vector> |
pyeh9 | 0:10b365b7873b | 6 | #include <string> |
pyeh9 | 0:10b365b7873b | 7 | #include "Selection.h" |
pyeh9 | 0:10b365b7873b | 8 | #include "Menu.h" |
pyeh9 | 0:10b365b7873b | 9 | #include "Navigator.h" |
pyeh9 | 0:10b365b7873b | 10 | |
pyeh9 | 0:10b365b7873b | 11 | DigitalOut led1(LED1), led2(LED2), led3(LED3), led4(LED4); |
pyeh9 | 0:10b365b7873b | 12 | TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7 |
pyeh9 | 0:10b365b7873b | 13 | RPG rpg(p21,p22,p23); |
pyeh9 | 0:10b365b7873b | 14 | SDFileSystem sd(p5, p6, p7, p8, "sd"); |
pyeh9 | 0:10b365b7873b | 15 | |
pyeh9 | 0:10b365b7873b | 16 | using namespace std; |
pyeh9 | 0:10b365b7873b | 17 | |
pyeh9 | 0:10b365b7873b | 18 | int direction = 0; |
pyeh9 | 0:10b365b7873b | 19 | int cursor = 0; |
pyeh9 | 0:10b365b7873b | 20 | |
pyeh9 | 0:10b365b7873b | 21 | int main() { |
pyeh9 | 0:10b365b7873b | 22 | Menu menu1; |
pyeh9 | 0:10b365b7873b | 23 | menu1.add(Selection(NULL, 0, "Toggle LED1")); |
pyeh9 | 0:10b365b7873b | 24 | menu1.add(Selection(NULL, 1, "Toggle LED2")); |
pyeh9 | 0:10b365b7873b | 25 | menu1.add(Selection(NULL, 2, "Toggle LED3")); |
pyeh9 | 0:10b365b7873b | 26 | menu1.add(Selection(NULL, 3, "Toggle LED4")); |
pyeh9 | 0:10b365b7873b | 27 | |
pyeh9 | 0:10b365b7873b | 28 | Navigator navigator(menu1, rpg, &lcd); |
pyeh9 | 0:10b365b7873b | 29 | navigator.printMenu(); |
pyeh9 | 0:10b365b7873b | 30 | while(1){ |
pyeh9 | 0:10b365b7873b | 31 | navigator.poll(); |
pyeh9 | 0:10b365b7873b | 32 | } |
pyeh9 | 0:10b365b7873b | 33 | } |