41 lines
1022 B
C++
41 lines
1022 B
C++
|
#pragma once
|
||
|
|
||
|
|
||
|
#ifndef NO_ARDUINO
|
||
|
#include <Arduino.h>
|
||
|
using string_type = String;
|
||
|
#else
|
||
|
#include <cstdint>
|
||
|
using string_type = std::string;
|
||
|
#endif
|
||
|
|
||
|
|
||
|
using buffer_t = uint16_t;
|
||
|
using address_t = uint32_t;
|
||
|
|
||
|
const buffer_t MAX_BUFFER_SIZE = 0x8000;
|
||
|
|
||
|
enum ControlBytes : uint8_t {
|
||
|
WRITE = 1,
|
||
|
READ = 2,
|
||
|
SET_ADDRESS = 3,
|
||
|
PRINT = 4,
|
||
|
READY = 5,
|
||
|
MEM_256KB = 11,
|
||
|
MEM_2M = 12,
|
||
|
MAX_ENUM,
|
||
|
};
|
||
|
string_type ControlBytesString(ControlBytes ctrl) {
|
||
|
switch (ctrl) {
|
||
|
case ControlBytes::WRITE: { return "WRITE"; break; }
|
||
|
case ControlBytes::READ: { return "READ"; break; }
|
||
|
case ControlBytes::SET_ADDRESS: { return "SET_ADDRESS"; break; }
|
||
|
case ControlBytes::PRINT: { return "PRINT"; break; }
|
||
|
case ControlBytes::READY: { return "READY"; break; }
|
||
|
case ControlBytes::MEM_256KB: { return "MEM_256KB"; break; }
|
||
|
case ControlBytes::MEM_2M: { return "MEM_2M"; break; }
|
||
|
case ControlBytes::MAX_ENUM: {return "MAX_ENUM"; break; }
|
||
|
default: {return "UNKNOWN"; }
|
||
|
}
|
||
|
}
|