chore: conio --> curses; getch --> getchar

* since we're not working on windows
* clear is also defined in curses so renamed our clear
This commit is contained in:
surtur 2020-12-11 20:10:53 +01:00
parent 1a1193a10d
commit a59d8db636
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
3 changed files with 8 additions and 4 deletions

@ -5,6 +5,7 @@
#include "simul_kl25z.h" #include "simul_kl25z.h"
#include <stdint.h> #include <stdint.h>
#include <cstdio>
void AdcValueWrite(unsigned int data); void AdcValueWrite(unsigned int data);

@ -13,7 +13,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <conio.h> #include <curses.h>
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// Delay with time in milliseconds // Delay with time in milliseconds
@ -30,7 +30,7 @@ void delay(void)
} }
// clear screen // clear screen
void clear(){ void myclear(){
#if defined(__linux__) || defined(__unix__) || defined(__APPLE__) #if defined(__linux__) || defined(__unix__) || defined(__APPLE__)
system("clear"); system("clear");
#endif #endif
@ -83,7 +83,7 @@ void task1(std::string msg)
{ {
(void)msg; (void)msg;
while(1) { while(1) {
char c = getch(); char c = getchar();
gMutexSwitches.lock(); gMutexSwitches.lock();
switch(c) { switch(c) {
case '1': case '1':
@ -107,7 +107,7 @@ void task1(std::string msg)
// Thread to process screen refresh.... // Thread to process screen refresh....
void taskScreen() { void taskScreen() {
while(1) { while(1) {
clear(); myclear();
printf("KL25Z Simulation, version %d.%d\n\n", VERSION_MAJOR, VERSION_MINOR); printf("KL25Z Simulation, version %d.%d\n\n", VERSION_MAJOR, VERSION_MINOR);
gScreenMutex.lock(); gScreenMutex.lock();

@ -12,6 +12,9 @@
*/ */
#ifndef SIMUL_KL25Z_H #ifndef SIMUL_KL25Z_H
#define SIMUL_KL25Z_H #define SIMUL_KL25Z_H
#include <cstdint>
// Note: Include simulator headers at the end of this file // Note: Include simulator headers at the end of this file
// because they need definitions provided here... // because they need definitions provided here...