// EEPROMProgrammerConsole.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#pragma comment(lib, "Setupapi.lib")
#include "SerialClass.h"
#define KEY_ENTER 10
#define KEY_UP 72
#define KEY_DOWN 80
#define KEY_LEFT 75
#define KEY_RIGHT 77
#define READ 0
#define VERIFY 1
#define DUMP 2
#define WRITE 3
#define ERASE 4
#define SDP 5
#define EXIT 6
#define AT28C64B 0
#define AT28C256 1
std::vector GetAvailableCOMPorts();
std::vector GetDeviceNames();
unsigned int size = 0;
static unsigned char* data = new unsigned char[32768];
static void clear_screen() {
system("cls");
/*
COORD topLeft = { 0, 0 };
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO screen;
DWORD written;
GetConsoleScreenBufferInfo(console, &screen);
FillConsoleOutputCharacterA(
console, ' ', screen.dwSize.X * screen.dwSize.Y, topLeft, &written
);
FillConsoleOutputAttribute(
console, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE,
screen.dwSize.X * screen.dwSize.Y, topLeft, &written
);
SetConsoleCursorPosition(console, topLeft);
*/
}
static void wait_for_key_press() {
HANDLE hstdin;
DWORD mode;
hstdin = GetStdHandle(STD_INPUT_HANDLE);
GetConsoleMode(hstdin, &mode);
SetConsoleMode(hstdin, ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
int ch = 10;
while (ch == 10) ch = std::cin.get();
clear_screen();
SetConsoleMode(hstdin, mode);
}
namespace mainmenu {
static void read_into_buffer(Serial* SP) {
int arr[1] = { 0x01 };
DWORD bytesSend;
if (!WriteFile(SP->hSerial, arr, 1, &bytesSend, 0)) {
std::cerr