User manual
GHI Electronics,LLC Embedded Master User Manual
Hardware and Software Library
// *keyboard* is connected and *device* refers to the system device, keyboard.
Keyboard keyboard = new Keyboard(device);
// Event when the keyboard is disconnected
keyboard.Disconnected += KeyboardDisconnected;
// Event when a key is pressed
keyboard.KeyDown += KeyDown;
// Event when a key is pressed and can be mapped to an ASCII character
keyboard.CharDown += CharDown;
Handling Events:
public static void KeyDown(Keyboard sender, KeyboardEventArgs e)
{
// Is F1 presesed
if (keyboard.Key == Key.F1)
{
}
}
public static void CharDown(Keyboard sender, KeyboardEventArgs e)
{
// The ASCII key is stored in keyboard.KeyAscii
}
Reference
GHIElectronics.System.SystemDevices.Keyboard
GHIElectronics.System.SystemDevices.Key
GHIElectronics.System.SystemDevices.KeyState
GHIElectronics.System.SystemDevices.KeyboardEventHandler
GHIElectronics.System.SystemDevices.KeyboardEventArgs
11.14.6 USB Joystick
Joysticks are also supported; Buttons, two sets of axes and Hat Switch. A joystick is found
by checking the connection status of system devices.
Position
Each Joystick will hold the current position. First, the user will set the range (min, max) of a
joystick cursor. For example, for an LCD 128 by 64, the following might be used:
// X range = [0, 128] Y range = [0, 64]
Joystick.SetCursorBounds(0, 128, 0, 64);
The current cursor position, can be obtained using: Joystick.Cursor
Rev. 2.06 TFT Page 85 of 102 www.ghielectronics.com