User manual

GHI Electronics,LLC Embedded Master User Manual
Hardware and Software Library
11.14.5 USB Keyboard
Keyboards are directly supported. They are found by checking the connection status of
system devices.
Keyboard LEDs are currently not supported.
Key Enumeration
Holds definitions for all keys on a standard US-English keyboard.
For example:
Key.A // Refers to 'A'. Also 'a' is mapped to the same key
Key.F1 // Refers to F1 key
Key.D1 // Refers to the '1' key. Note this is also the '!'
Key.Keypad_D1 // Refers to the '1' key on the keypad. Note this is also the 'End' key.
These definitions are useful for checking the pressed/released Keys. Events are also
available that converts these definitions to an appropriate ASCII equivalent.
Current Key State
The current state of any key can be obtained at anytime. For example,
// Is LeftShift pressed?
Keyboard.GetKeyState(Key.LeftShift);
Events
The user can subscribe to different events when the keys are pressed/released using:
Keyboard.KeyUp // Key released
Keyboard.KeyDown // Key pressed
Two more events are available and are fired when the key can be mapped to an
appropriate ASCII representation.
Keyboard.CharDown // Key pressed
Keyboard.CharUp // Key released
When an event occurs:
Keyboard.Key // Refers to the Key associated with the event.
Keyboard.KeyAscii // Refers to the ASCII representation of the pressed key, when
approperiate. Otherwise, this value is zero.
Example
Initialization of a keyboard:
Rev. 2.06 TFT Page 84 of 102 www.ghielectronics.com