Rob Toulson / Mbed 2 deprecated PE_06-05_ModularCodeExample

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers HostIO.cpp Source File

HostIO.cpp

00001 /* Program Example 6.8: HostIO.cpp code for modular 7-seg keyboard controller 
00002                                                                             */
00003 #include "HostIO.h"
00004 
00005 Serial pc(USBTX, USBRX);       // communication to host PC
00006 
00007 void HostInit(void) {
00008   pc.printf("\n\rType two digit numbers to be \n\r");
00009 }
00010 
00011 char GetKeyInput(void) {
00012   char c = pc.getc();    // get keyboard ascii data
00013   pc.printf("%c",c);     // print ascii value to host PC terminal
00014   return (c&0x0F);       // return value as non-ascii 
00015 }