Example of the Menu Library
Dependencies: Menu RGBLed mbed
Example of the Menu Library (http://mbed.org/users/rominos2/code/Menu/)
Use RGBLed Library (http://mbed.org/users/rominos2/code/RGBLed/)
main.cpp@0:4aa25181e995, 2014-09-04 (annotated)
- Committer:
- rominos2
- Date:
- Thu Sep 04 12:29:12 2014 +0000
- Revision:
- 0:4aa25181e995
Initial Release.; Example for Menu Library (http://mbed.org/users/rominos2/code/Menu/); Using RGBLed Library (http://mbed.org/users/rominos2/code/RGBLed/)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rominos2 | 0:4aa25181e995 | 1 | /* |
rominos2 | 0:4aa25181e995 | 2 | Copyright (c) 2014 Romain Berrada |
rominos2 | 0:4aa25181e995 | 3 | |
rominos2 | 0:4aa25181e995 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
rominos2 | 0:4aa25181e995 | 5 | and associated documentation files (the "Software"), to deal in the Software without restriction, |
rominos2 | 0:4aa25181e995 | 6 | including without limitation the rights to use, copy, modify, merge, publish, distribute, |
rominos2 | 0:4aa25181e995 | 7 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
rominos2 | 0:4aa25181e995 | 8 | furnished to do so, subject to the following conditions: |
rominos2 | 0:4aa25181e995 | 9 | |
rominos2 | 0:4aa25181e995 | 10 | The above copyright notice and this permission notice shall be included in all copies or |
rominos2 | 0:4aa25181e995 | 11 | substantial portions of the Software. |
rominos2 | 0:4aa25181e995 | 12 | |
rominos2 | 0:4aa25181e995 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
rominos2 | 0:4aa25181e995 | 14 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
rominos2 | 0:4aa25181e995 | 15 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
rominos2 | 0:4aa25181e995 | 16 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
rominos2 | 0:4aa25181e995 | 17 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
rominos2 | 0:4aa25181e995 | 18 | */ |
rominos2 | 0:4aa25181e995 | 19 | |
rominos2 | 0:4aa25181e995 | 20 | #include "mbed.h" |
rominos2 | 0:4aa25181e995 | 21 | #include "RGBLed.h" |
rominos2 | 0:4aa25181e995 | 22 | #include "MenuExample.h" |
rominos2 | 0:4aa25181e995 | 23 | |
rominos2 | 0:4aa25181e995 | 24 | Serial pc(USBTX, USBRX); |
rominos2 | 0:4aa25181e995 | 25 | int main1(); |
rominos2 | 0:4aa25181e995 | 26 | int main2(); |
rominos2 | 0:4aa25181e995 | 27 | |
rominos2 | 0:4aa25181e995 | 28 | int main() { |
rominos2 | 0:4aa25181e995 | 29 | MenuExample boot = MenuExample(); |
rominos2 | 0:4aa25181e995 | 30 | |
rominos2 | 0:4aa25181e995 | 31 | boot.addProgram(&RGBLed::CYAN, main1); |
rominos2 | 0:4aa25181e995 | 32 | boot.addProgram(&RGBLed::MAGENTA, main2); |
rominos2 | 0:4aa25181e995 | 33 | |
rominos2 | 0:4aa25181e995 | 34 | while (true) { |
rominos2 | 0:4aa25181e995 | 35 | boot.launch(); |
rominos2 | 0:4aa25181e995 | 36 | } |
rominos2 | 0:4aa25181e995 | 37 | } |
rominos2 | 0:4aa25181e995 | 38 | |
rominos2 | 0:4aa25181e995 | 39 | int main1() { |
rominos2 | 0:4aa25181e995 | 40 | pc.printf("Program 1\n"); |
rominos2 | 0:4aa25181e995 | 41 | return 1; |
rominos2 | 0:4aa25181e995 | 42 | } |
rominos2 | 0:4aa25181e995 | 43 | int main2() { |
rominos2 | 0:4aa25181e995 | 44 | pc.printf("Program 2\n"); |
rominos2 | 0:4aa25181e995 | 45 | return 2; |
rominos2 | 0:4aa25181e995 | 46 | } |