FabGL
ESP32 VGA Controller and Graphics Library

◆ begin()

void fabgl::KeyboardClass::begin ( gpio_num_t  clkGPIO,
gpio_num_t  dataGPIO,
bool  generateVirtualKeys = true,
bool  createVKQueue = true 
)

Initialize KeyboardClass specifying CLOCK and DATA GPIOs.

A reset command (KeyboardClass.reset() method) is automatically sent to the keyboard. This method also initializes the PS2ControllerClass, calling its begin() method.

Parameters
clkGPIOThe GPIO number of Clock line
dataGPIOThe GPIO number of Data line
generateVirtualKeysIf true creates a task which consumes scancodes and produces virtual keys, so you can call KeyboardClass.isVKDown().
createVKQueueIf true creates a task which consunes scancodes and produces virtual keys and put them in a queue, so you can call KeyboardClass.isVKDown(), KeyboardClass.scancodeAvailable() and KeyboardClass.getNextScancode().

Example:

// Setup pins GPIO33 for CLK and GPIO32 for DATA
Keyboard.begin(GPIO_NUM_33, GPIO_NUM_32);  // clk, dat