FPGAs aren’t programmable.
They’re designed with a HDL (Hardware Description Language) and then manufactured.
They do one job and nothing else.
If you had one of @uXe’s VGA 1306 boards,
you could use it to connect your clone to a television without having to send the screen buffer over serial.
Essentially it’s a circuit that pretends to be an SSD1306 screen, but outputs VGA signals.
It is probably possible, but screen mirroring over serial might not be the best way to do it.
I think a better way to do it might be to send rendering commands over serial and let the chip running TVOut do its own rendering.
E.g.
// Arduboy program:
enum class Command : uint8_t
{
DrawPixel = 0x01,
DrawLine = 0x02,
DrawCircle = 0x03,
FillCircle = 0x13,
DrawRect = 0x04,
FillRect = 0x14,
};
class ArduboyTVOut
{
private:
Arduboy2 arduboy;
public:
Arduboy2 & getArduboy(void) { return this->arduboy; }
const Arduboy2 & getArduboy(void) const { return this->arduboy; }
void begin(void)
{
Serial1.begin(9600);
}
void drawPixel(int16_t x, int16_t y, uint8_t colour = WHITE)
{
Serial1.print(static_cast<uint8_t>(Command::DrawPixel));
Serial1.print(x);
Serial1.print(y);
Serial1.print(colour);
arduboy.drawPixel(x, y, colour);
}
};
// TVOut program:
enum class Command : uint8_t
{
DrawPixel = 0x01,
DrawLine = 0x02,
DrawCircle = 0x03,
FillCircle = 0x13,
DrawRect = 0x04,
FillRect = 0x14,
};
class ArduboyTVOut
{
private:
TVout tv;
public:
char beginPAL(void) { return this->tv.begin(PAL); }
char beginNTSC(void) { return this->tv.begin(NTSC); }
void drawPixel(int16_t x, int16_t y, uint8_t colour = WHITE)
{
tv.set_pixel(x, y, colour);
}
};
ArduboyTVOut arduboy;
void setup(void)
{
arduboy.beginPal();
// Await connection
if(!Serial1);
}
void loop(void)
{
if(Serial1.available() > 0)
{
int data = Serial1.read();
Command command = static_cast<Command>(data);
switch(command)
{
case Command::DrawPixel:
int x = Serial1.read();
int y = Serial1.read();
int colour = Serial1.read();
arduboy.drawPixel(x, y, colour);
break;
}
}
}
Unfortunately sprite rendering would be a bit difficult,
but for most of the simpler commands it should result in less data being sent over serial, and the data would be sent in small chunks instead of all at once.
Yes, help requests get more attention if they are in a separate thread.
People tend not to notice them as much if they are at the end of a different thread.