Greetings, I'm trying to display characters on a screen using a keyboard, the libraries I'm using are the Esp32 S3 VGA by Bitluni, the GFXWrapper library integrated with the library, and the EspUsbHost for the keyboard,
But when I print more than 5/6 characters on the screen it just crashes, and the screen goes "no signal".
I have the Esp32 S3 WROOM 1.
The RGB of the VGA are connected to the GPIO 1, 2 and 42, and the H and V sync are connected to GPIO 41 and 40.
The USB keyboard is connected to the USB+ and USB- pins of the boards (GPIO 20 and 19),
The ESP ha 16Mb OPI PSRAM.
Here's the code:
#include "ESP32S3VGA.h"
#include <GfxWrapper.h>
#include <Fonts/Picopixel.h>
#include "EspUsbHost.h"
// r,r,r,r,r, g,g, g, g, g, g, b, b, b, b, b, h,v
const PinConfig pins(-1,-1,-1,-1,1, -1,-1,-1,-1,-1,2, -1,-1,-1,-1,42, 41,40);
//VGA Device
VGA vga;
Mode mode = Mode::MODE_320x240x60;
GfxWrapper<VGA> gfx(vga, mode.hRes, mode.vRes);
class MyEspUsbHost : public EspUsbHost {
void onKeyboardKey(uint8_t ascii, uint8_t keycode, uint8_t modifier) {
if (' ' <= ascii && ascii <= '~') {
gfx.print((char)ascii);
} else if (ascii == '\r') {
gfx.println();
}
};
};
MyEspUsbHost usbHost;
//initial setup
void setup()
{
Serial.begin(115200);
vga.bufferCount = 2;
if(!vga.init(pins, mode, 16)) while(1) delay(1);
usbHost.begin();
usbHost.setHIDLocal(HID_LOCAL_Japan_Katakana);
vga.start();
gfx.setCursor(0, 10);
vga.clear(vga.rgb(0, 0, 0));
gfx.setFont(&Picopixel);
}
//the loop is done every frame
void loop()
{
usbHost.task();
vga.show();
}
Could someone help me?
Thanks.