by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"

Dependencies:   mbed

main.cpp

Committer:
robt
Date:
2012-10-15
Revision:
0:507436d37d5e

File content as of revision 0:507436d37d5e:

/* Program Example 6.5: main.cpp file for modular 7-seg keyboard controller

This example program includes example code PE6.06, PE6.07, PE6.08, PE6.09
                                                                           */
#include "mbed.h"
#include "HostIO.h"
#include "SegDisplay.h"
char data1, data2;                    // variable declarations

int main() {                          // main program
  SegInit();                          // call init function 
  HostInit();                         // call init function
  while (1) {                         // infinite loop
    data2 = GetKeyInput();            // call to get 1st key press
    Seg2  = SegConvert(data2);        // call to convert and output
    data1 = GetKeyInput();            // call to get 2nd key press
    Seg1  = SegConvert(data1);        // call to convert and output
    pc.printf("  ");                  // display spaces on host
  }
}