[examples] Add PinScan example
This commit is contained in:
37
examples/PinScan/src/ui.cpp
Normal file
37
examples/PinScan/src/ui.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/* Copyright (c) Kuba Szczodrzyński 2022-07-31. */
|
||||
|
||||
#include "main.h"
|
||||
|
||||
bool ansi = true;
|
||||
bool ansiSkipErase = false;
|
||||
|
||||
void printAnsi(const char *str) {
|
||||
if (ansi)
|
||||
stream->print(str);
|
||||
}
|
||||
|
||||
void printAnsiErase() {
|
||||
if (!ansiSkipErase)
|
||||
printAnsi(ANSI_ERASE ANSI_HOME);
|
||||
ansiSkipErase = false;
|
||||
}
|
||||
|
||||
void line() {
|
||||
stream->print("--------");
|
||||
if (output == -1) {
|
||||
stream->print("TELNET");
|
||||
} else {
|
||||
stream->print(" UART");
|
||||
stream->print(output);
|
||||
stream->write(' ');
|
||||
}
|
||||
stream->print("--------");
|
||||
stream->println();
|
||||
}
|
||||
|
||||
int inputPin() {
|
||||
stream->print("Enter pin number: ");
|
||||
int pin = stream->parseInt();
|
||||
stream->println();
|
||||
return pin;
|
||||
}
|
||||
Reference in New Issue
Block a user