by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
main.cpp@0:507436d37d5e, 2012-10-15 (annotated)
- Committer:
- robt
- Date:
- Mon Oct 15 21:23:48 2012 +0000
- Revision:
- 0:507436d37d5e
by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
robt | 0:507436d37d5e | 1 | /* Program Example 6.5: main.cpp file for modular 7-seg keyboard controller |
robt | 0:507436d37d5e | 2 | |
robt | 0:507436d37d5e | 3 | This example program includes example code PE6.06, PE6.07, PE6.08, PE6.09 |
robt | 0:507436d37d5e | 4 | */ |
robt | 0:507436d37d5e | 5 | #include "mbed.h" |
robt | 0:507436d37d5e | 6 | #include "HostIO.h" |
robt | 0:507436d37d5e | 7 | #include "SegDisplay.h" |
robt | 0:507436d37d5e | 8 | char data1, data2; // variable declarations |
robt | 0:507436d37d5e | 9 | |
robt | 0:507436d37d5e | 10 | int main() { // main program |
robt | 0:507436d37d5e | 11 | SegInit(); // call init function |
robt | 0:507436d37d5e | 12 | HostInit(); // call init function |
robt | 0:507436d37d5e | 13 | while (1) { // infinite loop |
robt | 0:507436d37d5e | 14 | data2 = GetKeyInput(); // call to get 1st key press |
robt | 0:507436d37d5e | 15 | Seg2 = SegConvert(data2); // call to convert and output |
robt | 0:507436d37d5e | 16 | data1 = GetKeyInput(); // call to get 2nd key press |
robt | 0:507436d37d5e | 17 | Seg1 = SegConvert(data1); // call to convert and output |
robt | 0:507436d37d5e | 18 | pc.printf(" "); // display spaces on host |
robt | 0:507436d37d5e | 19 | } |
robt | 0:507436d37d5e | 20 | } |
robt | 0:507436d37d5e | 21 |