Difference between revisions of "Unit HIDKEYBOARD"

From Ultibo.org
Jump to: navigation, search
Line 40: Line 40:
 
----
 
----
  
''To be documented''
+
 
 +
'''HID keyboard keys'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDKeyboardKeys = ^THIDKeyboardKeys;</code>
 +
 
 +
<code>THIDKeyboardKeys = array[0..HID_KEYBOARD_MAX_KEYS - 1] of Byte;</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| &nbsp;
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''HID keyboard device'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDKeyboardDevice = ^THIDKeyboardDevice;</code>
 +
 
 +
<code>THIDKeyboardDevice = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Keyboard Properties''
 +
|-
 +
| <code>Keyboard:TKeyboardDevice;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''HID Properties''
 +
|-
 +
| <code>Collection:PHIDCollection;</code>
 +
| The HID collection this keyboard is bound to
 +
|-
 +
| <code>Definitions:PHIDDefinition;</code>
 +
| The input report definitions that can be accepted as keyboard reports
 +
|-
 +
| <code>LEDDefinition:PHIDDefinition;</code>
 +
| The report definition that corresponds to the LED output
 +
|-
 +
| <code>LastCode:Word;</code>
 +
| The scan code of the last key pressed
 +
|-
 +
| <code>LastCount:LongWord;</code>
 +
| The repeat count of the last key pressed
 +
|-
 +
| <code>LastKeys:THIDKeyboardKeys;</code>
 +
| The keys from the last keyboard report received
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===

Revision as of 23:57, 27 October 2022

Return to Unit Reference


Description


Ultibo HID Keyboard Consumer unit

This is a consumer for any generic HID keyboard device, it accepts HID application collections in the generic desktop page (HID_PAGE_GENERIC_DESKTOP) with the usage set to keyboard (HID_DESKTOP_KEYBOARD).

The consumer will bind to any keyboard collection that includes at a minimum an input report containing a field that provides keypress data from the keyboard / keypad page (HID_PAGE_KEYBOARD_KEYPAD) and a field providing modifier keys from the same page.

The consumer will also look for an output report containing a field from the LED page (HID_PAGE_LED) and will use this to set the keyboard LEDs if found.

Up to 16 keypresses per report can be accepted (see HID_KEYBOARD_MAX_KEYS) but most keyboards will commonly report up to 6 which is the size defined in the USB HID usage tables for boot mode keyboard reports.

Constants



HID keyboard specific constants HID_KEYBOARD_*
HID_KEYBOARD_CONSUMER_NAME = 'HID Keyboard Consumer'; Name of HID Keyboard consumer
HID_KEYBOARD_DESCRIPTION = 'HID Keyboard'; Description of HID Keyboard device
HID_KEYBOARD_MAX_KEYS = 16; Maximum number of keys allowed in any report


Type definitions



HID keyboard keys

PHIDKeyboardKeys = ^THIDKeyboardKeys;

THIDKeyboardKeys = array[0..HID_KEYBOARD_MAX_KEYS - 1] of Byte;

   

HID keyboard device

PHIDKeyboardDevice = ^THIDKeyboardDevice;

THIDKeyboardDevice = record

Keyboard Properties
Keyboard:TKeyboardDevice;  
HID Properties
Collection:PHIDCollection; The HID collection this keyboard is bound to
Definitions:PHIDDefinition; The input report definitions that can be accepted as keyboard reports
LEDDefinition:PHIDDefinition; The report definition that corresponds to the LED output
LastCode:Word; The scan code of the last key pressed
LastCount:LongWord; The repeat count of the last key pressed
LastKeys:THIDKeyboardKeys; The keys from the last keyboard report received


Public variables


None defined

Function declarations


To be documented


Return to Unit Reference