Multitasking - Multisession CP/M 3 compatible system. Supports directories and FAT32 file system with SD Cards.
#include "src/supervisor.h"
#include "src/programs.h"
#define FORMAT_ON_FAIL true
#define SPIFFS_MOUNT_PATH "/flash"
#define SDCARD_MOUNT_PATH "/SD"
#define MAXFILES 6
Supervisor supervisor(&DisplayController);
char const * basepath = nullptr;
String driveA_path;
String driveB_path;
void setup()
{
disableCore0WDT();
disableCore1WDT();
PS2Controller.
begin(PS2Preset::KeyboardPort0_MousePort1);
DisplayController.
begin();
term->
begin(&DisplayController);
term->connectLocally();
term->clear();
term->write("Initializing...\r");
term->flush();
if (FileBrowser::mountSDCard(FORMAT_ON_FAIL, SDCARD_MOUNT_PATH, MAXFILES))
basepath = SDCARD_MOUNT_PATH;
else if (FileBrowser::mountSPIFFS(FORMAT_ON_FAIL, SPIFFS_MOUNT_PATH, MAXFILES))
basepath = SPIFFS_MOUNT_PATH;
driveA_path = String(basepath) + String("/driveA");
driveB_path = String(basepath) + String("/driveB");
FileBrowser fb;
fb.setDirectory(basepath);
if (!fb.exists("driveA", false)) {
fb.makeDirectory("driveA");
for (int i = 0; i < sizeof(programs) / sizeof(Program); ++i) {
term->printf("Creating %s\\%s\r\n", programs[i].path, programs[i].filename);
term->flush();
fb.setDirectory(driveA_path.c_str());
if (!fb.exists(programs[i].path, false))
fb.makeDirectory(programs[i].path);
fb.changeDirectory(programs[i].path);
FILE * f = fb.openFile(programs[i].filename, "wb");
if (f) {
fwrite(programs[i].
data, 1, programs[i].size, f);
fclose(f);
} else {
term->write(" FAILED!\r\n");
}
}
}
fb.setDirectory(basepath);
if (!fb.exists("driveB", false))
fb.makeDirectory("driveB");
delete term;
supervisor.onNewSession = [&](HAL * hal) {
hal->mountDrive(0, driveA_path.c_str());
hal->mountDrive(1, driveB_path.c_str());
hal->setSerial(0, &Serial);
};
if (keyDown) {
}
}
};
}
void loop()
{
supervisor.activateSession(0);
vTaskDelete(NULL);
}
static int queueSize
Size of display controller primitives queue.
static int scancodeToVirtualKeyTaskStackSize
Stack size of the task that converts scancodes to Virtual Keys Keyboard.
Delegate< VirtualKey *, bool > onVirtualKey
Delegate called whenever a new virtual key is decoded from scancodes.
static void quickCheckHardware()
Disable re-try when a mouse is not found.
static Keyboard * keyboard()
Returns the instance of Keyboard object automatically created by PS2Controller.
static void begin(gpio_num_t port0_clkGPIO, gpio_num_t port0_datGPIO, gpio_num_t port1_clkGPIO=GPIO_UNUSED, gpio_num_t port1_datGPIO=GPIO_UNUSED)
Initializes PS2 device controller.
The PS2 device controller class.
static int keyboardReaderTaskStackSize
Stack size of the task that reads keys from keyboard and send ANSI/VT codes to output stream in Termi...
static int inputQueueSize
Number of characters the terminal can "write" without pause (increase if you have loss of characters ...
static int inputConsumerTaskStackSize
Stack size of the task that processes Terminal input stream.
bool begin(BaseDisplayController *displayController, int maxColumns=-1, int maxRows=-1, Keyboard *keyboard=nullptr)
Initializes the terminal.
An ANSI-VT100 compatible display terminal.
void begin(gpio_num_t redGPIO, gpio_num_t greenGPIO, gpio_num_t blueGPIO, gpio_num_t HSyncGPIO, gpio_num_t VSyncGPIO)
This is the 8 colors (5 GPIOs) initializer.
void setResolution(char const *modeline=nullptr, int viewPortWidth=-1, int viewPortHeight=-1, bool doubleBuffered=false)
Sets fixed resolution.
Represents the VGA text-only controller.
This file is the all in one include file. Application can just include this file to use FabGL library...
VirtualKey
Represents each possible real or derived (SHIFT + real) key.