38#include "freertos/FreeRTOS.h"
106 void begin(gpio_num_t clkGPIO, gpio_num_t dataGPIO,
bool generateVirtualKeys =
true,
bool createVKQueue =
true);
127 void begin(
bool generateVirtualKeys,
bool createVKQueue,
int PS2Port);
288 void setCodePage(CodePage
const * codepage) { m_codepage = codepage; }
311 int getNextScancode(
int timeOutMS = -1,
bool requestResendOnTimeOut =
false);
324 bool setLEDs(
bool numLock,
bool capsLock,
bool scrollLock);
335 void getLEDs(
bool * numLock,
bool * capsLock,
bool * scrollLock);
347 bool setTypematicRateAndDelay(
int repeatRateMS,
int repeatDelayMS) {
return send_cmdTypematicRateAndDelay(repeatRateMS, repeatDelayMS); }
371 static uint8_t convScancodeSet2To1(uint8_t code);
373#if FABGLIB_HAS_VirtualKeyO_STRING
374 static char const * virtualKeyToString(
VirtualKey virtualKey);
414 static void SCodeToVKConverterTask(
void * pvParameters);
417 bool m_keyboardAvailable;
419 TaskHandle_t m_SCodeToVKConverterTask;
420 QueueHandle_t m_virtualKeyQueue;
422 uint8_t m_VKMap[(int)(VK_LAST + 7) / 8];
427 uint8_t m_scancodeSet;
447 bool m_scrollLockLED;
449 CodePage
const * m_codepage;
VirtualKey getNextVirtualKey(bool *keyDown=nullptr, int timeOutMS=-1)
Gets a virtual key from the queue.
int virtualKeyAvailable()
Gets the number of virtual keys available in the queue.
static int scancodeToVirtualKeyTaskStackSize
Stack size of the task that converts scancodes to Virtual Keys Keyboard.
void enableVirtualKeys(bool generateVirtualKeys, bool createVKQueue)
Dynamically enables or disables Virtual Keys generation.
Delegate< VirtualKey *, bool > onVirtualKey
Delegate called whenever a new virtual key is decoded from scancodes.
void injectVirtualKey(VirtualKey virtualKey, bool keyDown, bool insert=false)
Adds or inserts a virtual key into the virtual keys queue.
void begin(gpio_num_t clkGPIO, gpio_num_t dataGPIO, bool generateVirtualKeys=true, bool createVKQueue=true)
Initializes Keyboard specifying CLOCK and DATA GPIOs.
bool reset()
Sends a Reset command to the keyboard.
int scancodeAvailable()
Gets the number of scancodes available in the queue.
bool setScancodeSet(int value)
Sets the scancode set.
void setUIApp(uiApp *app)
Sets current UI app.
bool setLEDs(bool numLock, bool capsLock, bool scrollLock)
Sets keyboard LEDs status.
int virtualKeyToASCII(VirtualKey virtualKey)
Converts virtual key to ASCII.
int scancodeSet()
Gets current scancode set.
void getLEDs(bool *numLock, bool *capsLock, bool *scrollLock)
Gets keyboard LEDs status.
void setCodePage(CodePage const *codepage)
Sets font codepage for virtual key to ASCII conversion.
void setLayout(KeyboardLayout const *layout)
Sets keyboard layout.
bool isVKDown(VirtualKey virtualKey)
Gets the virtual keys status.
int getNextScancode(int timeOutMS=-1, bool requestResendOnTimeOut=false)
Gets a scancode from the queue.
KeyboardLayout const * getLayout()
Gets current keyboard layout.
bool isKeyboardAvailable()
Checks if keyboard has been detected and correctly initialized.
void emptyVirtualKeyQueue()
Empties the virtual keys queue.
bool setTypematicRateAndDelay(int repeatRateMS, int repeatDelayMS)
Sets typematic rate and delay.
The PS2 Keyboard controller class.
Base class for PS2 devices (like mouse or keyboard).
Represents the whole application base class.
This file contains codepages declarations.
This file contains FabGL library configuration settings, like number of supported colors,...
This file contains all classes related to FabGL Graphical User Interface.
VirtualKey
Represents each possible real or derived (SHIFT + real) key.
This file contains keyboard layouts.
This file contains fabgl::PS2Device definition.
All in one structure to fully represent a keyboard layout.
A struct which contains a virtual key, key state and associated scan code.