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.
HostIO.cpp@1:d11c2cd28a8b, 2022-11-05 (annotated)
- Committer:
- dpavetic
- Date:
- Sat Nov 05 07:40:11 2022 +0000
- Revision:
- 1:d11c2cd28a8b
- Parent:
- 0:76a5bc96dddd
fix
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| dpavetic | 0:76a5bc96dddd | 1 | // HostIO.cpp code for Exercise 7-7 |
| dpavetic | 0:76a5bc96dddd | 2 | #include "HostIO.h" |
| dpavetic | 1:d11c2cd28a8b | 3 | #include "SegDisplay.h" // allow access to functions and objects in SegDisplay.cpp |
| dpavetic | 0:76a5bc96dddd | 4 | Serial pc(USBTX, USBRX); // communication to host PC |
| dpavetic | 0:76a5bc96dddd | 5 | void HostInit(void) |
| dpavetic | 0:76a5bc96dddd | 6 | { |
| dpavetic | 0:76a5bc96dddd | 7 | pc.printf("\n\rType two digit numbers to be displayed on the 7-seg display\n\r"); |
| dpavetic | 0:76a5bc96dddd | 8 | } |
| dpavetic | 0:76a5bc96dddd | 9 | |
| dpavetic | 0:76a5bc96dddd | 10 | char GetKeyInput(void) |
| dpavetic | 0:76a5bc96dddd | 11 | { |
| dpavetic | 0:76a5bc96dddd | 12 | char c = pc.getc(); // get keyboard data (note numerical ascii range 0x30-x39) |
| dpavetic | 0:76a5bc96dddd | 13 | pc.printf("%c",c); // print ascii value to host PC terminal |
| dpavetic | 0:76a5bc96dddd | 14 | return (c&0x0F); // return value as non-ascii (bitmask c with value 0x0F) |
| dpavetic | 0:76a5bc96dddd | 15 | } |