Keyboard Class
Namespace: GHIElectronics.TinyCLR.Devices.UsbHost · Assembly: GHIElectronics.TinyCLR.Devices.UsbHost
Allows a usb device to be used as a keyboard.
public class Keyboard : BaseDevice
Constructors
Keyboard(uint id, byte interfaceIndex)
public Keyboard(uint id, byte interfaceIndex) : base(id, interfaceIndex, DeviceType.Keyboard)
Creates a new keyboard.
| Parameter | Type | Description |
|---|---|---|
id | uint | The device id. |
interfaceIndex | byte | The device interface index. |
Methods
IsKeyPressed(Key key)
public KeyState IsKeyPressed(Key key)
Gets the current state of a key.
| Parameter | Type | Description |
|---|---|---|
key | Key | The key to query. |
Returns KeyState — The state of the key.
Dispose(bool disposing)
protected override void Dispose(bool disposing)
Disposes the keyboard.
| Parameter | Type | Description |
|---|---|---|
disposing | bool | Whether or not this is called from Dispose. |
CheckEvents(object sender)
protected override void CheckEvents(object sender)
Repeatedly called with a period defined by WorkerInterval. Used to poll the device for data and raise any desired events.
| Parameter | Type | Description |
|---|---|---|
sender | object | Always null. |
Events
KeyUp
public event KeyboardEventHandler KeyUp
Fired when a key is released.
KeyDown
public event KeyboardEventHandler KeyDown
Fired when a key is pressed.
CharUp
public event KeyboardEventHandler CharUp
Fired when a key is released and it can be converted to ASCII.
CharDown
public event KeyboardEventHandler CharDown
Fired when a key is pressed and it can be converted to ASCII.