Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: HostIO.cpp
- Revision:
- 0:76a5bc96dddd
- Child:
- 1:d11c2cd28a8b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HostIO.cpp Sat Nov 05 07:35:08 2022 +0000
@@ -0,0 +1,16 @@
+// HostIO.cpp code for Exercise 7-7
+#include "HostIO.h"
+#include "SegDisplay.h" // allow access to functions and objects in
+SegDisplay.cpp
+Serial pc(USBTX, USBRX); // communication to host PC
+void HostInit(void)
+{
+ pc.printf("\n\rType two digit numbers to be displayed on the 7-seg display\n\r");
+}
+
+char GetKeyInput(void)
+{
+ char c = pc.getc(); // get keyboard data (note numerical ascii range 0x30-x39)
+ pc.printf("%c",c); // print ascii value to host PC terminal
+ return (c&0x0F); // return value as non-ascii (bitmask c with value 0x0F)
+}
\ No newline at end of file