FabGL
ESP32 Display Controller and Graphics Library

◆ begin() [1/2]

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

Initializes Keyboard specifying CLOCK and DATA GPIOs.

A reset command (Keyboard.reset() method) is automatically sent to the keyboard.
This method also initializes the PS2Controller to use port 0 only.

Because PS/2 ports are handled by the ULP processor, just few GPIO ports are actually usable. They are: GPIO_NUM_2, GPIO_NUM_4, GPIO_NUM_12 (with some limitations), GPIO_NUM_13, GPIO_NUM_14, GPIO_NUM_15, GPIO_NUM_25, GPIO_NUM_26, GPIO_NUM_27, GPIO_NUM_32 and GPIO_NUM_33.

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

Example:

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

Definition at line 641 of file keyboard.cpp.