by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
Diff: HostIO.cpp
- Revision:
- 0:507436d37d5e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HostIO.cpp Mon Oct 15 21:23:48 2012 +0000 @@ -0,0 +1,15 @@ +/* Program Example 6.8: HostIO.cpp code for modular 7-seg keyboard controller + */ +#include "HostIO.h" + +Serial pc(USBTX, USBRX); // communication to host PC + +void HostInit(void) { + pc.printf("\n\rType two digit numbers to be \n\r"); +} + +char GetKeyInput(void) { + char c = pc.getc(); // get keyboard ascii data + pc.printf("%c",c); // print ascii value to host PC terminal + return (c&0x0F); // return value as non-ascii +}