23 #ifndef _VGAKEYBOARD_H_INCLUDED 24 #define _VGAKEYBOARD_H_INCLUDED 34 #include "freertos/FreeRTOS.h" 43 #define ASCII_NUL 0x00 // Null 44 #define ASCII_SOH 0x01 // Start of Heading 45 #define ASCII_STX 0x02 // Start of Text 46 #define ASCII_ETX 0x03 // End Of Text 47 #define ASCII_EOT 0x04 // End Of Transmission 48 #define ASCII_ENQ 0x05 // Enquiry 49 #define ASCII_ACK 0x06 // Acknowledge 50 #define ASCII_BELL 0x07 // Bell 51 #define ASCII_BS 0x08 // Backspace 52 #define ASCII_HT 0x09 // Horizontal Tab 53 #define ASCII_LF 0x0A // Line Feed 54 #define ASCII_VT 0x0B // Vertical Tab 55 #define ASCII_FF 0x0C // Form Feed 56 #define ASCII_CR 0x0D // Carriage Return 57 #define ASCII_SO 0x0E // Shift Out 58 #define ASCII_SI 0x0F // Shift In 59 #define ASCII_DLE 0x10 // Data Link Escape 60 #define ASCII_DC1 0x11 // Device Control 1 61 #define ASCII_XON 0x11 // Transmission On 62 #define ASCII_DC2 0x12 // Device Control 2 63 #define ASCII_DC3 0x13 // Device Control 3 64 #define ASCII_XOFF 0x13 // Transmission Off 65 #define ASCII_DC4 0x14 // Device Control 4 66 #define ASCII_NAK 0x15 // Negative Acknowledge 67 #define ASCII_SYN 0x16 // Synchronous Idle 68 #define ASCII_ETB 0x17 // End-of-Transmission-Block 69 #define ASCII_CAN 0x18 // Cancel 70 #define ASCII_EM 0x19 // End of Medium 71 #define ASCII_SUB 0x1A // Substitute 72 #define ASCII_ESC 0x1B // Escape 73 #define ASCII_FS 0x1C // File Separator 74 #define ASCII_GS 0x1D // Group Separator 75 #define ASCII_RS 0x1E // Record Separator 76 #define ASCII_US 0x1F // Unit Separator 77 #define ASCII_SPC 0x20 // Space 78 #define ASCII_DEL 0x7F // Delete 90 MF2KeyboardWithTranslation,
328 class VGAKeyboardClass {
334 void begin(gpio_num_t clkGPIO, gpio_num_t dataGPIO);
339 bool isKeyboardAvailable() {
return m_keyboardAvailable; }
341 void setLayout(KeyboardLayout_t
const * layout);
342 KeyboardLayout_t
const * getLayout() {
return m_layout; }
344 uint8_t scancodeAvailable();
345 int getNextScancode(int32_t timeOutMS = -1);
347 VirtualKey_t getNextVirtualKey(
bool * keyDown = NULL, int32_t timeOutMS = -1);
348 int virtualKeyToASCII(VirtualKey_t virtualKey);
350 bool CTRL() {
return m_CTRL; }
351 bool ALT() {
return m_ALT; }
352 bool SHIFT() {
return m_SHIFT; }
353 bool CAPSLOCK() {
return m_CAPSLOCK; }
354 bool NUMLOCK() {
return m_NUMLOCK; }
355 bool SCROLLLOCK() {
return m_SCROLLLOCK; }
357 bool send_cmdLEDs(
bool numlock,
bool capsLock,
bool scrollLock);
359 bool send_cmdGetScancodeSet(uint8_t * result);
360 bool send_cmdSetScancodeSet(uint8_t scancodeSet);
361 bool send_cmdIdentify(PS2Device_t * result);
362 bool send_cmdDisableScanning();
363 bool send_cmdEnableScanning();
364 bool send_cmdTypematicDateAndDelay(uint16_t repeatRateMS, uint16_t repeatDelayMS);
365 bool send_cmdSetDefaultParams();
366 bool send_cmdReset();
368 #if VGAKB_HASVIRTUALKEYTOSTRING 369 static char const * virtualKeyToString(VirtualKey_t virtualKey);
374 bool rawSend(uint8_t value);
375 bool send(uint8_t cmd, uint8_t expectedReply);
376 VirtualKey_t scancodeToVK(uint8_t scancode,
bool isExtended, KeyboardLayout_t
const * layout = NULL);
377 VirtualKey_t VKtoAlternateVK(VirtualKey_t in_vk, KeyboardLayout_t
const * layout = NULL);
380 static void IRAM_ATTR keyboardClockInterrupt();
382 static void IRAM_ATTR activateErrorState();
383 void resumeFromErrorState();
385 bool m_keyboardAvailable;
387 volatile gpio_num_t m_dataGPIO;
388 volatile gpio_num_t m_clkGPIO;
389 volatile QueueHandle_t m_ScanCodeQueue;
390 volatile uint8_t m_sendingDataValue;
391 volatile TaskHandle_t m_TXWaitTask;
392 volatile bool m_RXError;
394 KeyboardLayout_t
const * m_layout;
415 extern ESP32VGA::VGAKeyboardClass VGAKeyboard;
VirtualKey_t virtualKey
Definition: VGAKeyboard.h:290
VirtualKeyDef_t exScancodeToVK[32]
Definition: VGAKeyboard.h:315
VirtualKey_t virtualKey
Definition: VGAKeyboard.h:306
KeyboardLayout_t const * inherited
Definition: VGAKeyboard.h:313
Associates scancode to virtualkey.
Definition: VGAKeyboard.h:288
uint8_t scancode
Definition: VGAKeyboard.h:289
This file contains ESP32VGA library configuration settings, like number of supported colors...
Definition: VGACanvas.cpp:29
All in one structure to fully represent a keyboard layout.
Definition: VGAKeyboard.h:311
uint8_t alt
Definition: VGAKeyboard.h:301
PS2Device_t
Represents the type of device attached to PS/2 port.
Definition: VGAKeyboard.h:85
uint8_t ctrl
Definition: VGAKeyboard.h:300
VirtualKey_t reqVirtualKey
Definition: VGAKeyboard.h:298
AltVirtualKeyDef_t alternateVK[64]
Definition: VGAKeyboard.h:316
uint8_t numlock
Definition: VGAKeyboard.h:304
const char * name
Definition: VGAKeyboard.h:312
VirtualKey_t
Represents each possible real or derived (SHIFT + real) key.
Definition: VGAKeyboard.h:98
uint8_t shift
Definition: VGAKeyboard.h:302
VirtualKeyDef_t scancodeToVK[92]
Definition: VGAKeyboard.h:314
uint8_t capslock
Definition: VGAKeyboard.h:303
Associates a virtualkey and various shift states (ctrl, alt, etc..) to another virtualkey.
Definition: VGAKeyboard.h:297