https://ultibo.org/mediawiki_ultibo_org/index.php?title=Special:NewPages&feed=atom&hideredirs=1&limit=50&offset=&namespace=0&username=&tagfilter=
Ultibo.org - New pages [en]
2024-03-29T06:10:40Z
From Ultibo.org
MediaWiki 1.26.1
https://ultibo.org/wiki/Unit_USBSTORAGE
Unit USBSTORAGE
2024-03-29T03:33:25Z
<p>Ultibo: Created page with "Return to Unit Reference === Description === ---- '''Ultibo USB Mass Storage Driver unit''' '''USB Mass Storage Devices''' The USB Mass Storage Class C..."</p>
<hr />
<div>Return to [[Unit_Reference|Unit Reference]]<br />
<br />
<br />
=== Description ===<br />
----<br />
<br />
'''Ultibo USB Mass Storage Driver unit'''<br />
<br />
'''USB Mass Storage Devices'''<br />
<br />
The USB Mass Storage Class Control/Bulk/Interrupt (CBI) Transport specification is approved for use only with full-speed floppy disk drives. CBI shall not be used in high-speed capable devices, or in devices other than floppy disk drives. CBI shall not be used in devices that implement LSDFS. Usage of CBI for any new design is discouraged.<br />
<br />
Therefore the majority of USB Mass Storage devices use the Bulk only interface.<br />
<br />
USB mass storage class devices normally use the SCSI command set and therefore the USB storage driver consumes the SCSI unit for the protocol and command definitions. USB mass storage devices are registered directly as Storage devices not as SCSI devices.<br />
<br />
=== Constants ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''USB storage''' <code> USB_STORAGE_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>USBSTORAGE_STORAGE_DESCRIPTION = 'USB Storage Device';</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>USBSTORAGE_DRIVER_NAME = 'USB Mass Storage Driver';</code><br />
| Name of USB storage driver<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''CB/CBI (Control/Bulk/Interrupt) Requests''<br />
|-<br />
| <code>USB_STORAGE_REQUEST_CBI_ADSC = 0;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''BBB (Bulk Only) Requests''<br />
|-<br />
| <code>USB_STORAGE_REQUEST_BBB_RESET = $FF;</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_STORAGE_REQUEST_BBB_GET_MAX_LUN = $FE;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''Command Block Wrapper''<br />
|-<br />
| <code>USB_STORAGE_CBW_SIGNATUR = $43425355;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp; <br />
|-<br />
| <code>USB_STORAGE_CBW_FLAGS_OUT = $00;</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_STORAGE_CBW_FLAGS_IN = $80;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>USB_STORAGE_CBW_CB_LENGTH = 16;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp; <br />
|-<br />
| <code>USB_STORAGE_CBW_SIZE = 31;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''Command Status Wrapper''<br />
|-<br />
| <code>USB_STORAGE_CSW_SIGNATURE = $53425355;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>USB_STORAGE_CSW_STATUS_GOOD = $00;</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_STORAGE_CSW_STATUS_FAILED = $01;</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_STORAGE_CSW_STATUS_PHASE = $02;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>USB_STORAGE_CSW_SIZE = 13;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''Command Data''<br />
|-<br />
| <code>USB_STORAGE_COMMAND_MAX_SIZE = 16;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp; <br />
|-<br />
|colspan="2"|''Command Retry Counts''<br />
|-<br />
| <code>USB_STORAGE_READ_RETRIES = 2;</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_STORAGE_WRITE_RETRIES = 2;</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_STORAGE_STATUS_RETRIES = 2;</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_STORAGE_INQUIRY_RETRIES = 5;</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_STORAGE_READ_CAPACITY_RETRIES = 3;</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_STORAGE_TEST_UNIT_READY_RETRIES = 5;</code><br />
| 10; TestingRPi<br />
|-<br />
|colspan="2"|&nbsp; <br />
|-<br />
|colspan="2"|''Peripheral Device Types''<br />
|-<br />
|colspan="2"|''These are a subset of the SCSI Peripheral Device Types''<br />
|-<br />
| <code>USB_STORAGE_DEVICE_TYPE_DISK = $00;</code><br />
| SBC Direct-access device (e.g., UHD Floppy disk)<br />
|-<br />
| <code>USB_STORAGE_DEVICE_TYPE_CDROM = $05;</code><br />
| MMC-5 CD-ROM device<br />
|-<br />
| <code>USB_STORAGE_DEVICE_TYPE_OPTICAL = $07;</code><br />
| Optical memory device (e.g., Non-CD optical disks)<br />
|-<br />
| <code>USB_STORAGE_DEVICE_TYPE_RBC = $0E;</code><br />
| RBC Direct-access device (e.g., UHD Floppy disk)<br />
|-<br />
| <code>USB_STORAGE_DEVICE_TYPE_UNKNOWN = $1F;</code><br />
| Unknown or no device type<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Type definitions ===<br />
----<br />
<br />
<br />
'''USB command block'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PUSBCommandBlock = ^TUSBCommandBlock;</code><br />
<br />
<code>TUSBCommandBlock = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|Note: SBC Command Block (Derived from TSCSICommandBlock) <br />
|-<br />
|colspan="2"|''SCSI Properties''<br />
|-<br />
| <code>Command:array[0..USB_STORAGE_COMMAND_MAX_SIZE - 1] of Byte;</code><br />
| Command<br />
|-<br />
| <code>SenseData:array[0..63] of Byte;</code><br />
| Request Sense<br />
|-<br />
| <code>Status:Byte;</code><br />
| SCSI Status<br />
|-<br />
| <code>TargetID:Byte;</code><br />
| Target Id<br />
|-<br />
| <code>TargetLUN:Byte;</code><br />
| Target LUN<br />
|-<br />
| <code>CommandLength:Byte;</code><br />
| Command Length<br />
|-<br />
| <code>DataLength:LongWord;</code><br />
| Data Length<br />
|-<br />
| <code>Data:Pointer;</code><br />
| Pointer to Data<br />
|-<br />
| <code>MessageOut:array[0..11] of Byte;</code><br />
| Message out buffer<br />
|-<br />
| <code>MessageIn:array[0..11] of Byte;</code><br />
| Message in buffer<br />
|-<br />
| <code>SenseCommandLength:Byte;</code><br />
| Sense Command Length<br />
|-<br />
| <code>SenseDataLength:LongWord;</code><br />
| Sense Data Length<br />
|-<br />
| <code>SenseCommand:array[0..5] of Byte;</code><br />
| Sense Command<br />
|-<br />
| <code>ControllerStatus:LongWord;</code><br />
| Controller Status<br />
|-<br />
| <code>TransferredBytes:LongWord;</code><br />
| Transferred Bytes<br />
|-<br />
|colspan="2"|''USB Properties''<br />
|-<br />
| <code>Direction:Byte;</code><br />
| USB Direction (eg USB_DIRECTION_OUT or USB_DIRECTION_IN)<br />
|-<br />
|}<br />
</div></div> <br />
<br />
'''USB storage device'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PUSBStorageDevice = ^TUSBStorageDevice;</code><br />
<br />
<code>TUSBStorageDevice = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|''Storage Properties''<br />
|-<br />
| <code>Storage:TStorageDevice;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|''USB Properties''<br />
|-<br />
| <code>Subclass:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>Protocol:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>MaxLUN:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>Sequence:LongWord;</code><br />
| For dCBWTag property<br />
|-<br />
| <code>Primary:PUSBStorageDevice;</code><br />
| Primary storage device (for multi LUN devices)<br />
|-<br />
| <code>StorageInterface:PUSBInterface;</code><br />
| USB Mass Storage device Interface<br />
|-<br />
| <code>ReadWait:TSemaphoreHandle;</code><br />
| Read completed semaphore<br />
|-<br />
| <code>WriteWait:TSemaphoreHandle;</code><br />
| Write completed semaphore<br />
|-<br />
| <code>InterruptWait:TSemaphoreHandle;</code><br />
| Interrupt completed semaphore<br />
|-<br />
| <code>ReadRequest:PUSBRequest;</code><br />
| Bulk IN Request<br />
|-<br />
| <code>WriteRequest:PUSBRequest;</code><br />
| Bulk OUT Request<br />
|-<br />
| <code>InterruptRequest:PUSBRequest;</code><br />
| Interrupt IN Request<br />
|-<br />
| <code>ReadEndpoint:PUSBEndpointDescriptor;</code><br />
| Bulk IN Endpoint<br />
|-<br />
| <code>WriteEndpoint:PUSBEndpointDescriptor;</code><br />
| Bulk OUT Endpoint<br />
|-<br />
| <code>InterruptEndpoint:PUSBEndpointDescriptor;</code><br />
| Interrupt IN Endpoint<br />
|-<br />
| <code>PendingCount:LongWord;</code><br />
| Number of USB requests pending for this storage<br />
|-<br />
| <code>WaiterThread:TThreadId;</code><br />
| Thread waiting for pending requests to complete (for storage eject)<br />
|-<br />
|colspan="2"|''SCSI Properties''<br />
|-<br />
| <code>CommandBlock:TUSBCommandBlock;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|''ATAPI Properties''<br />
|-<br />
| &nbsp;<br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|colspan="2"|''RBC Properties''<br />
|-<br />
| &nbsp;<br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''USB command block wrapper'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PUSBCommandBlockWrapper = ^TUSBCommandBlockWrapper;</code><br />
<br />
<code>TUSBCommandBlockWrapper = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>dCBWSignature:LongWord;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>dCBWTag:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>dCBWDataTransferLength:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>bCBWFlags:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>bCBWLUN:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>bCBWCBLength:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>CBWCB:array[0..USB_STORAGE_CBW_CB_LENGTH - 1] of Byte;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div> <br />
<br />
'''USB command status wrapper'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PUSBCommandStatusWrapper = ^TUSBCommandStatusWrapper;</code><br />
<br />
<code>TUSBCommandStatusWrapper = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>dCSWSignature:LongWord;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>dCSWTag:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>dCSWDataResidue:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>bCSWStatus:Byte;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div> <br />
<br /><br />
<br />
=== Function declarations ===<br />
----<br />
<br />
<br />
'''Initialization functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure USBStorageInit;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''USB storage functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceRead(Storage:PStorageDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| According to 3.4 of USB Mass Storage Bulk Only 1.0, requests must be queued one at a time to a device.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceWrite(Storage:PStorageDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| According to 3.4 of USB Mass Storage Bulk Only 1.0, requests must be queued one at a time to a device.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceControl(Storage:PStorageDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| According to 3.4 of USB Mass Storage Bulk Only 1.0, requests must be queued one at a time to a device.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Bind the Storage driver to a USB device if it is suitable</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The USB device to attempt to bind to<br />
|-<br />
! Interrface<br />
| The USB interface to attempt to bind to (or nil for whole device)<br />
|-<br />
! Return<br />
| USB_STATUS_SUCCESS if completed, USB_STATUS_DEVICE_UNSUPPORTED if unsupported or another error code on failure.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unbind the Storage driver from a USB device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The USB device to unbind from<br />
|-<br />
! Interrface<br />
| The USB interface to unbind from (or nil for whole device)<br />
|-<br />
! Return<br />
| USB_STATUS_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure USBStorageReadComplete(Request:PUSBRequest);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when a USB request from a USB storage bulk IN endpoint completes</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Request<br />
| The USB request which has completed<br />
|-<br />
! Note<br />
| The thread that submitted the read request will hold the storage lock<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure USBStorageWriteComplete(Request:PUSBRequest);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when a USB request from a USB storage bulk OUT endpoint completes</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Request<br />
| The USB request which has completed<br />
|-<br />
! Note<br />
| The thread that submitted the write request will hold the storage lock<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure USBStorageInterruptComplete(Request:PUSBRequest);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when a USB request from a USB storage IN interrupt endpoint completes</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Request<br />
| The USB request which has completed<br />
|-<br />
! Note<br />
| The thread that submitted the interrupt request will hold the storage lock<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''USB storage helper functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageCheckDevice(Device:PUSBDevice):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the supplied USB device is suitable for detection as a Mass Storage Device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The USB device to check<br />
|-<br />
! Return<br />
| True if the device is suitable or False if it is not<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageCheckSubclass(Subclass:Byte):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageCheckProtocol(Protocol:Byte):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageBlockSizeToBlockShift(BlockSize:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStoragePatchDevice(Device:PUSBDevice; var Subclass,Protocol:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' A function to adjust the subclass and protocol parameters of known defective devices</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageFixupDevice(Device:PUSBDevice; var Vendor,Product:String):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' A function to adjust the vendor and product parameters of known defective devices</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceLock(Device:PUSBDevice; Storage:PUSBStorageDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Issue a Prevent Media Removal request to a storage device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceUnlock(Device:PUSBDevice; Storage:PUSBStorageDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Issue a Allow Media Removal request to a storage device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceLoad(Device:PUSBDevice; Storage:PUSBStorageDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Issue a Start Stop request to a storage device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceEject(Device:PUSBDevice; Storage:PUSBStorageDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Issue a Start Stop request to a storage device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''USB storage helper functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceReset(Device:PUSBDevice; Storage:PUSBStorageDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Issue a Storage Reset request to a storage device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Reset recovery (5.3.4 in USB Mass Storage Bulk Only 1.0)<br />
For Reset Recovery the host shall issue in the following order: a) a Bulk-Only Mass Storage Reset, b) a Clear Feature HALT to the Bulk-In endpoint, c) a Clear Feature HALT to the Bulk-Out endpoint. This is done in 3 steps. If the reset doesn't succeed, the device should be port reset.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceGetInfo(Device:PUSBDevice; Storage:PUSBStorageDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Obtain basic information about a storage device (Type, Size, State, Product etc)</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceGetStatus(Device:PUSBDevice; Storage:PUSBStorageDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Supported by Subclass SCSI/UFI/SFF8070</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceGetMaxLUN(Device:PUSBDevice; Storage:PUSBStorageDevice; var MaxLUN:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Issue a Get Max LUN request to a storage device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceClearStall(Device:PUSBDevice; Storage:PUSBStorageDevice; Endpoint:PUSBEndpointDescriptor):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Issue a USB Clear Feature (HALT) to the supplied endpoint on a storage device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceInquiry(Device:PUSBDevice; Storage:PUSBStorageDevice; var DeviceType,DeviceFlags:LongWord; var Vendor,Product,Revision:PChar):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Issue a SCSI Inquiry command to a LUN on a storage device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Supported by Subclass SCSI/UFI/SFF8070<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceRequestSense(Device:PUSBDevice; Storage:PUSBStorageDevice; var SenseKey,ASC,ASCQ:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Issue a SCSI Request Sense command to a LUN on a storage device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Supported by Subclass SCSI/UFI/SFF8070<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceReadCapacity(Device:PUSBDevice; Storage:PUSBStorageDevice; var BlockSize,BlockShift:LongWord; var BlockCount:Int64):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Issue a SCSI Read Capacity command to a LUN on a storage device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Supported by Subclass SCSI/UFI/SFF8070<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceTestUnitReady(Device:PUSBDevice; Storage:PUSBStorageDevice; var DeviceFlags:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Issue a SCSI Test Unit Ready command to a LUN on a storage device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Supported by Subclass SCSI/UFI/SFF8070<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceRead10(Device:PUSBDevice; Storage:PUSBStorageDevice; Start:LongWord; Count:Word;Buffer:Pointer):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Issue a SCSI Read10 command to a LUN on a storage device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Supported by Subclass SCSI/UFI/SFF8070<br />
Caller must hold the storage lock<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceWrite10(Device:PUSBDevice; Storage:PUSBStorageDevice; Start:LongWord;Count:Word; Buffer:Pointer):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Issue a SCSI Write10 command to a LUN on a storage device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Supported by Subclass SCSI/UFI/SFF8070<br />
Caller must hold the storage lock<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceRead16(Device:PUSBDevice; Storage:PUSBStorageDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Issue a SCSI Read16 command to a LUN on a storage device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Supported by Subclass SCSI only (Only on devices > 2TB)<br />
Caller must hold the storage lock<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceWrite16(Device:PUSBDevice; Storage:PUSBStorageDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Issue a SCSI Write16 command to a LUN on a storage device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Supported by Subclass SCSI only (Only on devices > 2TB)<br />
Caller must hold the storage lock<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBStorageDeviceTransport(Device:PUSBDevice; Storage:PUSBStorageDevice; Command:PUSBCommandBlock):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Perform the appropriate transport sequence for the device based on subclass and protocol</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Handles Command / Data / Status phases plus endpoint stall, reset and retry as per the specification. Supported by Subclass SCSI/UFI/SFF8070<br />
Caller must hold the storage lock<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
Return to [[Unit_Reference|Unit Reference]]</div>
Ultibo
https://ultibo.org/wiki/Unit_IPSTFT19
Unit IPSTFT19
2023-11-10T04:53:18Z
<p>Ultibo: </p>
<hr />
<div>Return to [[Unit_Reference|Unit Reference]]<br />
<br />
<br />
=== Description ===<br />
----<br />
<br />
'''Adafruit 1.9" 320x170 Color IPS TFT Display LCD Driver unit'''<br />
<br />
Adafruit 1.9" 320x170 Color IPS TFT display has 320x170 16-bit full-color pixels and is an IPS display, so the color looks great up to 80 degrees off-axis in any direction.<br />
<br />
The TFT driver (Sitronix ST7789) is very similar to the popular ST7735.<br />
<br />
Details:<br />
<br />
ST7789<br />
<br />
Width: 170<br />
Height: 320<br />
<br />
SPI Mode: 0<br />
SPI Frequency: 42000000<br />
SPI Chip Select: SPI_CS_0<br />
<br />
DC GPIO: GPIO_PIN_25 (Pull: GPIO_PULL_NONE)<br />
RST GPIO: GPIO_PIN_27 (Pull: GPIO_PULL_NONE)<br />
<br />
Backlight GPIO: GPIO_PIN_18 (GPIO / PWM)<br />
<br />
=== Constants ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''IPSTFT19 specific constants''' <code> IPSTFT19_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>IPSTFT19_FRAMEBUFFER_DESCRIPTION = 'Adafruit 1.9" IPS TFT';</code><br />
| Description of IPSTFT19 device<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>IPSTFT19_SIGNATURE = $AF000019;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>IPSTFT19_SCREEN_WIDTH = 170;</code><br />
| &nbsp;<br />
|-<br />
| <code>IPSTFT19_SCREEN_HEIGHT = 320;</code><br />
| &nbsp;<br />
|-<br />
| <code>IPSTFT19_COLSTART = 35;</code><br />
| &nbsp;<br />
|-<br />
| <code>IPSTFT19_DEFAULT_ROTATION = FRAMEBUFFER_ROTATION_90;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''IPSTFT19 GPIO''' <code> IPSTFT19_LCD_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>IPSTFT19_LCD_DC = GPIO_PIN_25;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>IPSTFT19_LCD_RST = GPIO_PIN_27;</code><br />
| &nbsp;<br />
|-<br />
| <code>IPSTFT19_LCD_BL = GPIO_PIN_18;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Type definitions ===<br />
----<br />
<br />
<br />
'''IPSTFT19 specific types'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PIPSTFT19LCD = ^TIPSTFT19LCD;</code><br />
<br />
<code>TIPSTFT19LCD = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>Signature:LongWord;</code><br />
| Signature for entry validation<br />
|-<br />
| <code>Rotation:LongWord;</code><br />
| Framebuffer rotation (eg FRAMEBUFFER_ROTATION_180)<br />
|-<br />
| <code>SPI:PSPIDevice;</code><br />
| SPI device for this display<br />
|-<br />
| <code>GPIO:PGPIODevice;</code><br />
| GPIO device for this display<br />
|-<br />
| <code>Framebuffer:PFramebufferDevice;</code><br />
| Framebuffer (ST7789) device for this display<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Public variables ===<br />
----<br />
<br />
<br />
'''IPSTFT19 specific variables'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>IPSTFT19_SPI_DEVICE:String = 'SPI0';</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>IPSTFT19_LCD_CHIPSELECT:Word = SPI_CS_0;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>IPSTFT19_BL_PWM_ENABLE:LongBool = True;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br /><br />
<br />
=== Function declarations ===<br />
----<br />
<br />
<br />
'''Initialization functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure IPSTFT19Init;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the IPSTFT19 unit and parameters</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Called only during system startup<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function IPSTFT19Start(Rotation:LongWord; const Device:String; DisplaySelect:word):THandle;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Start the IPSTFT19 driver and Framebuffer device associated with the display</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Rotation<br />
| The rotation of the display (eg FRAMEBUFFER_ROTATION_180)<br />
|-<br />
! Device<br />
| The SPI device that the ST7789 device is connected to<br />
|-<br />
! DisplaySelect<br />
| The SPI chip select of the ST7789 LCD controller<br />
|-<br />
! Return<br />
| The handle of the IPSTFT19 on success or INVALID_HANDLE_VALUE on failure<br />
|-<br />
! Note<br />
| This function will be called during startup if the parameter IPSTFT19_AUTOSTART is True. Can be called multiple times to support more than one IPSTFT LCD display.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function IPSTFT19Stop(Handle:THandle):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Stop the IPSTFT19 driver and Framebuffer device associated with the display</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Handle<br />
| The handle of the IPSTFT19 or INVALID_HANDLE_VALUE for the default display<br />
|-<br />
! Return<br />
| True if completed or False on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
Return to [[Unit_Reference|Unit Reference]]</div>
Ultibo
https://ultibo.org/wiki/Unit_ST77XX
Unit ST77XX
2023-11-10T04:52:58Z
<p>Ultibo: </p>
<hr />
<div>Return to [[Unit_Reference|Unit Reference]]<br />
<br />
<br />
=== Description ===<br />
----<br />
<br />
'''Sitronix ST77XX TFT LCD Driver unit'''<br />
<br />
The ST77XX is a family of single-chip controllers/drivers for color, graphic type TFT-LCD display.<br />
<br />
Instantiate the ST77XX driver by calling ST77XXFramebufferCreate() with the required parameters:<br />
<br />
SPI: The SPI device that this ST77XX is connected to<br />
<br />
ChipSelect: The SPI chip select to use when communicating with this device<br />
<br />
Name: The text description of this device which will show in the device list (Optional)<br />
<br />
Rotation: The rotation value for the framebuffer device (eg FRAMEBUFFER_ROTATION_180)<br />
<br />
Width: The width of the framebuffer in pixels<br />
<br />
Height: The height of the framebuffer in pixels<br />
<br />
ColStart:<br />
<br />
RST: GPIO pin information for the Reset pin (Optional)<br />
<br />
DC: GPIO pin information for the Data/Command pin<br />
<br />
BL: GPIO pin information for the Backlight pin (Optional)<br />
<br />
=== Constants ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''ST77XX specific constants''' <code> ST77XX_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>ST77XX_FRAMEBUFFER_DESCRIPTION = 'ST77XX TFT LCD DRIVER';</code><br />
| Description of ST77XX device<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''ST77XX SPI''' <code> ST77XX_SPI_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>ST77XX_SPI_RATE = 32000000;</code><br />
| Default SPI clock rate<br />
|-<br />
| <code>ST_CMD_DELAY = $80;</code><br />
| Special signifier for command lists<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''ST77XX control command''' <code> ST77XX_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>ST77XX_NOP = $00;</code><br />
| 8.2.1. NOP: No Operation<br />
|-<br />
| <code>ST77XX_SWRESET = $01;</code><br />
| 8.2.2. SWRESET: Software Reset<br />
|-<br />
| <code>ST77XX_RDDID = $04;</code><br />
| new_cmd<br />
|-<br />
| <code>ST77XX_RDDST = $09;</code><br />
| new_cmd<br />
|-<br />
|colspan="2"|&nbsp; <br />
|-<br />
| <code>ST77XX_SLPIN = $10;</code><br />
| new_cmd<br />
|-<br />
| <code>ST77XX_SLPOUT = $11;</code><br />
| 8.2.12. SLPOUT: Sleep Out (This command turns off sleep mode)<br />
|-<br />
| <code>ST77XX_PTLON = $12;</code><br />
| new_cmd<br />
|-<br />
| <code>ST77XX_NORON = $13;</code><br />
| new_cmd<br />
|-<br />
|colspan="2"|&nbsp; <br />
|-<br />
| <code>ST77XX_INVOFF = $20;</code><br />
| new_cmd<br />
|-<br />
| <code>ST77XX_INVON = $21;</code><br />
| new_cmd<br />
|-<br />
| <code>ST77XX_GAMSET = $26;</code><br />
| 8.2.17. GAMSET: Gamma Set (This command is used to select the desired Gamma curve for the current display)<br />
|-<br />
| <code>ST77XX_DISPOFF = $28;</code><br />
| 8.2.18. DISPOFF: Display OFF (This command is used to enter into DISPLAY OFF mode. In this mode, the output from Frame Memory is disabled and blank page inserted)<br />
|-<br />
| <code>ST77XX_DISPON = $29;</code><br />
| 8.2.19. DISPON: Display ON (This command is used to recover from DISPLAY OFF mode. Output from the Frame Memory is enabled)<br />
|-<br />
| <code>ST77XX_CASET = $2A;</code><br />
| 8.2.20. CASET: Column Address Set (This command is used to define area of frame memory where MCU can access)<br />
|-<br />
| <code>ST77XX_RASET = $2B;</code><br />
| 8.2.21. PASET: Page Address Set (This command is used to define area of frame memory where MCU can access)<br />
|-<br />
| <code>ST77XX_RAMWR = $2C;</code><br />
| 8.2.22. Memory Write (This command is used to transfer data from MCU to frame memory)<br />
|-<br />
| <code>ST77XX_RGBSET = $2D;</code><br />
| Color setting for 4096, 64K and 262K colors<br />
|-<br />
| <code>ST77XX_RAMRD = $2E;</code><br />
| new_cmd<br />
|-<br />
|colspan="2"|&nbsp; <br />
|-<br />
| <code>ST77XX_RDDPM = $0A;</code><br />
| Read display power mode<br />
|-<br />
| <code>ST77XX_RDD_MADCTL = $0B;</code><br />
| Read display MADCTL<br />
|-<br />
| <code>ST77XX_RDD_COLMOD = $0C;</code><br />
| Read display pixel format<br />
|-<br />
| <code>ST77XX_RDDIM = $0D;</code><br />
| Read display image mode<br />
|-<br />
| <code>ST77XX_RDDSM = $0E;</code><br />
| Read display signal mode<br />
|-<br />
| <code>ST77XX_RDDSR = $0F;</code><br />
| Read display self-diagnostic result (ST7789V)<br />
|-<br />
|colspan="2"|&nbsp; <br />
|-<br />
| <code>ST77XX_PTLAR = $30;</code><br />
| new_cmd<br />
|-<br />
| <code>ST77XX_VSCRDEF = $33;</code><br />
| Vertical scrolling definition (ST7789V)<br />
|-<br />
| <code>ST77XX_TEOFF = $34;</code><br />
| Tearing effect line off<br />
|-<br />
| <code>ST77XX_TEON = $35;</code><br />
| Tearing effect line on<br />
|-<br />
| <code>ST77XX_MADCTL = $36;</code><br />
| 8.2.29. MADCTL: Memory Access Control (This command defines read/write scanning direction of frame memory)<br />
|-<br />
| <code>ST77XX_IDMOFF = $38;</code><br />
| Idle mode off<br />
|-<br />
| <code>ST77XX_IDMON = $39;</code><br />
| Idle mode on<br />
|-<br />
| <code>ST77XX_RAMWRC = $3C;</code><br />
| Memory write continue (ST7789V)<br />
|-<br />
| <code>ST77XX_RAMRDC = $3E;</code><br />
| Memory read continue (ST7789V)<br />
|-<br />
| <code>ST77XX_COLMOD = $3A;</code><br />
| 8.2.33. COLMOD: Pixel Format Set (This command sets the pixel format for the RGB image data used by the interface)<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''ST77XX memory access control''' <code> ST77XX_*CTL_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|''See ST77XX datasheet 8.2.29. Memory Access Control''<br />
|-<br />
| <code>ST77XX_MADCTL_MY = $80;</code><br />
| Row Address Order<br />
|-<br />
| <code>ST77XX_MADCTL_MX = $40;</code><br />
| Column Address Order<br />
|-<br />
| <code>ST77XX_MADCTL_MV = $20;</code><br />
| Row / Column Exchange<br />
|-<br />
| <code>ST77XX_MADCTL_ML = $10;</code><br />
| Row / Column Exchange<br />
|-<br />
| <code>ST77XX_MADCTL_MH = $04;</code><br />
| Horizontal Refresh Order<br />
|-<br />
| <code>ST77XX_MADCTL_RGB = $00;</code><br />
| Colour selector switch control (0=RGB colour filter panel, 1=BGR colour filter panel)<br />
|-<br />
| <code>ST77XX_MADCTL_BGR = $08;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp; <br />
|-<br />
| <code>ST77XX_RAMCTRL = $B0;</code><br />
| RAM control<br />
|-<br />
| <code>ST77XX_RGBCTRL = $B1;</code><br />
| RGB control<br />
|-<br />
| <code>ST77XX_PORCTRL = $B2;</code><br />
| Porch control<br />
|-<br />
| <code>ST77XX_FRCTR1 = $B3;</code><br />
| 8.3.2. FRCTR1: Frame Rate Control (In Normal Mode/Full Colors)<br />
|-<br />
| <code>ST77XX_PARCTRL = $B5;</code><br />
| Partial mode control<br />
|-<br />
| <code>ST77XX_GCTRL = $B7;</code><br />
| Gate control<br />
|-<br />
| <code>ST77XX_GTADJ = $B8;</code><br />
| Gate on timing adjustment<br />
|-<br />
| <code>ST77XX_DGMEN = $BA;</code><br />
| Digital gamma enable<br />
|-<br />
| <code>ST77XX_VCOMS = $BB;</code><br />
| VCOMS setting<br />
|-<br />
| <code>ST77XX_DISCTRL = $B6;</code><br />
| 8.3.7. DISCTRL: Display Function Control<br />
|-<br />
|colspan="2"|&nbsp; <br />
|-<br />
| <code>ST77XX_LCMCTRL = $C0;</code><br />
| LCM control<br />
|-<br />
| <code>ST77XX_IDSET = $C1;</code><br />
| ID setting<br />
|-<br />
| <code>ST77XX_VDVVRHEN = $C2;</code><br />
| VDV and VRH command enable<br />
|-<br />
| <code>ST77XX_VRHS = $C3;</code><br />
| VRH set<br />
|-<br />
| <code>ST77XX_VDVSET = $C4;</code><br />
| VDV setting<br />
|-<br />
| <code>ST77XX_VCMOFSET = $C5;</code><br />
| VCOMS offset set<br />
|-<br />
| <code>ST77XX_FRCTR2 = $C6;</code><br />
| FR Control 2<br />
|-<br />
| <code>ST77XX_CABCCTRL = $C7;</code><br />
| CABC control<br />
|-<br />
| <code>ST77XX_REGSEL1 = $C8;</code><br />
| Register value section 1<br />
|-<br />
| <code>ST77XX_REGSEL2 = $CA;</code><br />
| Register value section 2<br />
|-<br />
| <code>ST77XX_PWMFRSEL = $CC;</code><br />
| PWM frequency selection<br />
|-<br />
|colspan="2"|&nbsp; <br />
|-<br />
| <code>ST77XX_PWCTRL1 = $D0;</code><br />
| 8.3.16. PWCTRL1: Power Control 1<br />
|-<br />
| <code>ST77XX_VAPVANEN = $D2;</code><br />
| Enable VAP/VAN signal output<br />
|-<br />
| <code>ST77XX_CMD2EN = $DF;</code><br />
| Command 2 enable<br />
|-<br />
|colspan="2"|&nbsp; <br />
|-<br />
| <code>ST77XX_VMCTRL1 = $C5;</code><br />
| 8.3.21. VMCTRL1: VCOM Control 1<br />
|-<br />
| <code>ST77XX_VMCTRL2 = $C7;</code><br />
| 8.3.22. VMCTRL2: VCOM Control 2<br />
|-<br />
|colspan="2"|&nbsp; <br />
|-<br />
| <code>ST77XX_PGAMCTRL = $E0;</code><br />
| Positive voltage gamma control<br />
|-<br />
| <code>ST77XX_NGAMCTRL = $E1;</code><br />
| Negative voltage gamma control<br />
|-<br />
| <code>ST77XX_DGMLUTR = $E2;</code><br />
| Digital gamma look-up table for red<br />
|-<br />
| <code>ST77XX_DGMLUTB = $E3;</code><br />
| Digital gamma look-up table for blue<br />
|-<br />
| <code>ST77XX_GATECTRL = $E4;</code><br />
| Gate control<br />
|-<br />
| <code>ST77XX_SPI2EN = $E7;</code><br />
| SPI2 enable<br />
|-<br />
| <code>ST77XX_PWCTRL2 = $E8;</code><br />
| Power control 2<br />
|-<br />
| <code>ST77XX_EQCTRL = $E9;</code><br />
| Equalize time control<br />
|-<br />
| <code>ST77XX_PROMCTRL = $EC;</code><br />
| Program control<br />
|-<br />
|colspan="2"|&nbsp; <br />
|-<br />
| <code>ST77XX_PROMEN = $FA;</code><br />
| Program mode enable<br />
|-<br />
| <code>ST77XX_NVMSET = $FC;</code><br />
| NVM setting<br />
|-<br />
| <code>ST77XX_PROMACT = $FE;</code><br />
| Program action<br />
|-<br />
|colspan="2"|&nbsp; <br />
|-<br />
| <code>ST77XX_COLOR_MODE_16bit =$55;</code><br />
| &nbsp;<br />
|-<br />
| <code>ST77XX_COLOR_MODE_18bit =$66;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Type definitions ===<br />
----<br />
<br />
<br />
'''ST77XX specific types'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PST77XXFramebuffer = ^TST77XXFramebuffer;</code><br />
<br />
<code>TST77XXFramebuffer = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|''TFT Properties''<br />
|-<br />
| <code>TFT:TTFTFramebuffer;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Public variables ===<br />
----<br />
<br />
''None defined''<br />
<br />
=== Function declarations ===<br />
----<br />
<br />
<br />
'''ST77XX functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function ST77XXFramebufferCreate(SPI:PSPIDevice; ChipSelect:Word; const Name:String; Rotation,Width,Height,ColStart:LongWord; RST,DC,BL:PGPIOInfo):PFramebufferDevice;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create, register and allocate a new ST77XX Framebuffer device which can be accessed using the framebuffer API</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! SPI<br />
| The SPI device that this ST77XX is connected to<br />
|-<br />
! ChipSelect<br />
| The SPI chip select to use when communicating with this device<br />
|-<br />
! Name<br />
| The text description of this device which will show in the device list (Optional)<br />
|-<br />
! Rotation<br />
| The rotation value for the framebuffer device (eg FRAMEBUFFER_ROTATION_180)<br />
|-<br />
! Width<br />
| The width of the framebuffer in pixels<br />
|-<br />
! Height<br />
| The height of the framebuffer in pixels<br />
|-<br />
! RST<br />
| GPIO pin information for the Reset pin (Optional)<br />
|-<br />
! DC<br />
| GPIO pin information for the Data/Command pin<br />
|-<br />
! BL<br />
| GPIO pin information for the Backlight pin (Optional)<br />
|-<br />
! Return<br />
| Pointer to the new Framebuffer device or nil if the framebuffer device could not be created<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function ST77XXFramebufferDestroy(Framebuffer:PFramebufferDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Release, deregister and destroy an ST77XX Framebuffer device created by this driver</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Framebuffer<br />
| The Framebuffer device to destroy<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''ST77XX framebuffer functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function ST77XXFramebufferBlank(Framebuffer:PFramebufferDevice; Blank:Boolean):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of FramebufferDeviceBlank API for ST77XX</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Not intended to be called directly by applications, use FramebufferDeviceBlank instead<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function ST77XXFramebufferSetBacklight(Framebuffer:PFramebufferDevice; Brightness:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of FramebufferDeviceSetBacklight API for ST77XX</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Not intended to be called directly by applications, use FramebufferDeviceSetBacklight instead<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''ST77XX TFTFramebuffer functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function ST77XXTFTFramebufferInitialize(Framebuffer:PTFTFramebuffer; Defaults:PFramebufferProperties):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of TFTFramebufferInitialize API for ST77XX</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Not intended to be called directly by applications<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function ST77XXTFTFramebufferDeinitialize(Framebuffer:PTFTFramebuffer):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of TFTFramebufferDeinitialize API for ST77XX</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Not intended to be called directly by applications<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function ST77XXTFTFramebufferGetDefaults(Framebuffer:PTFTFramebuffer; Properties,Defaults:PFramebufferProperties):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of TFTFramebufferGetDefaults API for ST77XX</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Not intended to be called directly by applications<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function ST77XXTFTFramebufferSetWriteAddress(Framebuffer:PTFTFramebuffer; X1,Y1,X2,Y2:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of TFTFramebufferSetWriteAddress API for ST77XX</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Not intended to be called directly by applications<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function ST77XXTFTFramebufferWriteMemory(Framebuffer:PTFTFramebuffer; Address:PtrUInt; Size:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of TFTFramebufferWriteMemory API for ST77XX</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Not intended to be called directly by applications<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''ST77XX helper functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function ST77XXWriteCommand(Framebuffer:PTFTFramebuffer; Value:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write a single command value to the ST77XX</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function ST77XXWriteCommandEx(Framebuffer:PTFTFramebuffer; const Values:array of Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write multiple command values to the ST77XX</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function ST77XXWriteData(Framebuffer:PTFTFramebuffer; Value:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write a single data value to the ST77XX</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function ST77XXWriteDataEx(Framebuffer:PTFTFramebuffer; const Values:array of Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write multiple data values to the ST77XX</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
Return to [[Unit_Reference|Unit Reference]]</div>
Ultibo
https://ultibo.org/wiki/Unit_Joystick
Unit Joystick
2022-11-17T03:40:13Z
<p>Ultibo: </p>
<hr />
<div>Return to [[Unit_Reference|Unit Reference]]<br />
<br />
<br />
=== Description ===<br />
----<br />
<br />
'''Ultibo Joystick and Gamepad Interface unit'''<br />
<br />
Gamepads are almost universally used to control game consoles and other gaming platforms as they provide an easy way to interact with many different types of movement in gaming scenarios.<br />
<br />
They range from simple devices with a 4 way rocker switch (often known as the D-pad) and a small number of push buttons to elaborate units with multi-axis controls and buttons that cover a whole range of uses.<br />
<br />
Joysticks are used for more than just gaming, many modern industrial machines use a joystick as the primary control interface. Even common machines like ride on lawn mowers and earth moving equipment often feature a joystick type of control mechanism.<br />
<br />
Devices such as flight simulator yokes will often also appear as a joystick to the system as the available ranges of movement and the reported axes are the same.<br />
<br />
=== Constants ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''Joystick specific constants''' <code> JOYSTICK_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>JOYSTICK_NAME_PREFIX = 'Joystick';</code><br />
| Name prefix for Joystick Devices<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''Joystick device types''' <code> JOYSTICK_TYPE_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>JOYSTICK_TYPE_NONE = 0;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>JOYSTICK_TYPE_JOYSTICK = 1;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_TYPE_GAMEPAD = 2;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>JOYSTICK_TYPE_MAX = 2;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|''Joystick Type Names''<br />
|-<br />
|colspan="2"|<code>JOYSTICK_TYPE_NAMES:array[JOYSTICK_TYPE_NONE..JOYSTICK_TYPE_MAX] of String = ('JOYSTICK_TYPE_NONE', 'JOYSTICK_TYPE_JOYSTICK', 'JOYSTICK_TYPE_GAMEPAD');</code><br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''Joystick device states''' <code> JOYSTICK_STATE_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>JOYSTICK_STATE_DISABLED = 0;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>JOYSTICK_STATE_ENABLED = 1;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>JOYSTICK_STATE_MAX = 1;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|''Joystick State Names''<br />
|-<br />
|colspan="2"|<code>JOYSTICK_TYPE_NAMES:array[JOYSTICK_TYPE_NONE..JOYSTICK_TYPE_MAX] of String = ('JOYSTICK_TYPE_NONE', 'JOYSTICK_TYPE_JOYSTICK', 'JOYSTICK_TYPE_GAMEPAD');</code><br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''Joystick device flags''' <code> JOYSTICK_FLAG_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>JOYSTICK_FLAG_NONE = $00000000;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_FLAG_NON_BLOCK = $00000001;</code><br />
| If set device reads are non blocking (Also supported in Flags parameter of JoystickDeviceRead)<br />
|-<br />
| <code>JOYSTICK_FLAG_PEEK_BUFFER = $00000002;</code><br />
| Peek at the buffer to see if any data is available, don't remove it (Used only in Flags parameter of JoystickDeviceRead)<br />
|-<br />
| <code>JOYSTICK_FLAG_LED = $00000004;</code><br />
| If set the device contains one or more LEDs<br />
|-<br />
| <code>JOYSTICK_FLAG_RGBLED = $00000008;</code><br />
| If set the device contains one or more RGB LEDs<br />
|-<br />
| <code>JOYSTICK_FLAG_RUMBLE = $00000010;</code><br />
| If set the device has rumble or force feedback<br />
|-<br />
| <code>JOYSTICK_FLAG_GYROSCOPE = $00000020;</code><br />
| If set the device contains a gyroscope<br />
|-<br />
| <code>JOYSTICK_FLAG_TOUCHPAD = $00000040;</code><br />
| If set the device contains a touchpad<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''Flags supported by JOYSTICK_CONTROL_GET/SET/CLEAR_FLAG''<br />
|-<br />
|colspan="2"|<code>JOYSTICK_FLAG_MASK = JOYSTICK_FLAG_NON_BLOCK or JOYSTICK_FLAG_LED or JOYSTICK_FLAG_RGBLED or JOYSTICK_FLAG_RUMBLE or JOYSTICK_FLAG_GYROSCOPE or JOYSTICK_FLAG_TOUCHPAD;</code><br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''Joystick device control codes''' <code> JOYSTICK_CONTROL_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>JOYSTICK_CONTROL_GET_FLAG = 1;</code><br />
| Get Flag<br />
|-<br />
| <code>JOYSTICK_CONTROL_SET_FLAG = 2;</code><br />
| Set Flag<br />
|-<br />
| <code>JOYSTICK_CONTROL_CLEAR_FLAG = 3;</code><br />
| Clear Flag<br />
|-<br />
| <code>JOYSTICK_CONTROL_FLUSH_BUFFER = 4;</code><br />
| Flush Buffer<br />
|-<br />
| <code>JOYSTICK_CONTROL_GET_HAT = 5;</code><br />
| Get the name (identifier) associated with a Hat<br />
|-<br />
| <code>JOYSTICK_CONTROL_SET_HAT = 6;</code><br />
| Set the name (identifier) associated with a Hat<br />
|-<br />
| <code>JOYSTICK_CONTROL_GET_AXIS = 7;</code><br />
| Get the name (identifier) associated with an Axis<br />
|-<br />
| <code>JOYSTICK_CONTROL_SET_AXIS = 8;</code><br />
| Set the name (identifier) associated with an Axis<br />
|-<br />
| <code>JOYSTICK_CONTROL_GET_BUTTON = 9;</code><br />
| Get the name (identifier) associated with a Button<br />
|-<br />
| <code>JOYSTICK_CONTROL_SET_BUTTON = 10;</code><br />
| Set the name (identifier) associated with a Button<br />
|-<br />
| <code>JOYSTICK_CONTROL_GET_CALLBACK = 11;</code><br />
| Get the registered callback function for joystick events<br />
|-<br />
| <code>JOYSTICK_CONTROL_SET_CALLBACK = 12;</code><br />
| Set the registered callback function for joystick events<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''Joystick buffer size''' <code> JOYSTICK_BUFFER_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>JOYSTICK_BUFFER_SIZE = 2048;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''Joystick axis, hat and button maximum''' <code> JOYSTICK_MAX_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>JOYSTICK_MAX_AXIS = 16;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>JOYSTICK_MAX_HAT = 4;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_MAX_BUTTON = 32;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''Joystick default minimum and maximum''' <code> JOYSTICK_DEFAULT_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>JOYSTICK_DEFAULT_MINIMUM = 0;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>JOYSTICK_DEFAULT_MAXIMUM = 255;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''Joystick and Gamepad axis names''' <code> JOYSTICK_AXIS_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|''Includes Buttons, Sliders, Wheels etc that report an analog value)''<br />
|-<br />
| <code>JOYSTICK_AXIS_NONE = 0;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_1 = 1;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_2 = 2;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_3 = 3;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_4 = 4;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_5 = 5;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_6 = 6;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_7 = 7;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_8 = 8;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_9 = 9;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_10 = 10;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_11 = 11;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_12 = 12;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_13 = 13;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_14 = 14;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_15 = 15;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_16 = 16;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_X = 17;</code><br />
| X<br />
|-<br />
| <code>JOYSTICK_AXIS_Y = 18;</code><br />
| Y<br />
|-<br />
| <code>JOYSTICK_AXIS_Z = 19;</code><br />
| Z<br />
|-<br />
| <code>JOYSTICK_ROTATION_X = 20;</code><br />
| Rotation X<br />
|-<br />
| <code>JOYSTICK_ROTATION_Y = 21;</code><br />
| Rotation Y<br />
|-<br />
| <code>JOYSTICK_ROTATION_Z = 22;</code><br />
| Rotation Z<br />
|-<br />
| <code>JOYSTICK_SLIDER = 23;</code><br />
| Slider<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>GAMEPAD_AXIS_LEFT_X = 24;</code><br />
| Left X<br />
|-<br />
| <code>GAMEPAD_AXIS_LEFT_Y = 25;</code><br />
| Left Y<br />
|-<br />
| <code>GAMEPAD_AXIS_X = GAMEPAD_AXIS_LEFT_X;</code><br />
| &nbsp;<br />
|-<br />
| <code>GAMEPAD_AXIS_Y = GAMEPAD_AXIS_LEFT_Y;</code><br />
| &nbsp;<br />
|-<br />
| <code>GAMEPAD_AXIS_RIGHT_X = 26;</code><br />
| Right X<br />
|-<br />
| <code>GAMEPAD_AXIS_RIGHT_Y = 27;</code><br />
| Right Y<br />
|-<br />
| <code>GAMEPAD_CONTROL_LT = 28;</code><br />
| Left Trigger analog button<br />
|-<br />
| <code>GAMEPAD_CONTROL_L2 = GAMEPAD_CONTROL_LT;</code><br />
| &nbsp;<br />
|-<br />
| <code>GAMEPAD_CONTROL_RT = 29;</code><br />
| Right Trigger analog button<br />
|-<br />
| <code>GAMEPAD_CONTROL_R2 = GAMEPAD_CONTROL_RT;</code><br />
| &nbsp;<br />
|-<br />
| <code>GAMEPAD_CONTROL_UP = 30;</code><br />
| Up analog button<br />
|-<br />
| <code>GAMEPAD_CONTROL_RIGHT = 31;</code><br />
| Right analog button<br />
|-<br />
| <code>GAMEPAD_CONTROL_DOWN = 32;</code><br />
| Down analog button<br />
|-<br />
| <code>GAMEPAD_CONTROL_LEFT = 33;</code><br />
| Left analog button<br />
|-<br />
| <code>GAMEPAD_CONTROL_L1 = 34;</code><br />
| L1 analog button<br />
|-<br />
| <code>GAMEPAD_CONTROL_R1 = 35;</code><br />
| R1 analog button<br />
|-<br />
| <code>GAMEPAD_CONTROL_TRIANGLE = 36;</code><br />
| Triangle analog button<br />
|-<br />
| <code>GAMEPAD_CONTROL_CIRCLE = 37;</code><br />
| Circle analog button<br />
|-<br />
| <code>GAMEPAD_CONTROL_CROSS = 38;</code><br />
| Cross analog button<br />
|-<br />
| <code>GAMEPAD_CONTROL_SQUARE = 39;</code><br />
| Square analog button<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>JOYSTICK_AXIS_MAX = 39;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''Joystick and Gamepad Axis Names''<br />
|-<br />
| <code>JOYSTICK_AXIS_NAMES:array[JOYSTICK_AXIS_NONE..JOYSTICK_AXIS_MAX] of String = (</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_NONE',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_1',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_2',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_3',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_4',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_5',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_6',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_7',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_8',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_9',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_10',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_11',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_12',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_13',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_14',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_15',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_16',</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_X',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_Y',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_AXIS_Z',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_ROTATION_X',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_ROTATION_Y',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_ROTATION_Z',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_SLIDER',</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>'GAMEPAD_AXIS_LEFT_X',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_AXIS_LEFT_Y',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_AXIS_RIGHT_X',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_AXIS_RIGHT_Y',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_CONTROL_LT',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_CONTROL_RT',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_CONTROL_UP',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_CONTROL_RIGHT',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_CONTROL_DOWN',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_CONTROL_LEFT',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_CONTROL_L1',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_CONTROL_R1',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_CONTROL_TRIANGLE',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_CONTROL_CIRCLE',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_CONTROL_CROSS',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_CONTROL_SQUARE');</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''Joystick and Gamepad hat names''' <code> JOYSTICK_HAT* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>JOYSTICK_HAT_NONE = 0;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_HAT_1 = 1;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_HAT_2 = 2;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_HAT_3 = 3;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_HAT_4 = 4;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>JOYSTICK_HAT_POV = 5;</code><br />
| Point of View (POV)<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>JOYSTICK_HAT_MAX = 5;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''Joystick and Gamepad Hat Names''<br />
|- <br />
| <code>JOYSTICK_HAT_NAMES:array[JOYSTICK_HAT_NONE..JOYSTICK_HAT_MAX] of String = (</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_HAT_NONE',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_HAT_1',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_HAT_2',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_HAT_3',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_HAT_4',</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>'JOYSTICK_HAT_POV');</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''Joystick and Gamepad button names''' <code> JOYSTICK_BUTTON_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>JOYSTICK_BUTTON_NONE = 0;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_1 = 1;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_2 = 2;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_3 = 3;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_4 = 4;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_5 = 5;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_6 = 6;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_7 = 7;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_8 = 8;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_9 = 9;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_10 = 10;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_11 = 11;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_12 = 12;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_13 = 13;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_14 = 14;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_15 = 15;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_16 = 16;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_17 = 17;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_18 = 18;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_19 = 19;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_20 = 20;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_21 = 21;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_22 = 22;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_23 = 23;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_24 = 24;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_25 = 25;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_26 = 26;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_27 = 27;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_28 = 28;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_29 = 29;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_30 = 30;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_31 = 31;</code><br />
| &nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_32 = 32;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>GAMEPAD_BUTTON_HOME = 33;</code><br />
| Home or special function button<br />
|-<br />
| <code>GAMEPAD_BUTTON_PS = GAMEPAD_BUTTON_HOME;</code><br />
| Playstation button<br />
|-<br />
| <code>GAMEPAD_BUTTON_XBOX = GAMEPAD_BUTTON_HOME;</code><br />
| XBox button<br />
|-<br />
| <code>GAMEPAD_BUTTON_GUIDE = GAMEPAD_BUTTON_HOME;</code><br />
| Guide button<br />
|-<br />
| <code>GAMEPAD_BUTTON_LT = 34;</code><br />
| Left Trigger button<br />
|-<br />
| <code>GAMEPAD_BUTTON_L2 = GAMEPAD_BUTTON_LT;</code><br />
| &nbsp;<br />
|-<br />
| <code>GAMEPAD_BUTTON_LZ = GAMEPAD_BUTTON_LT;</code><br />
| &nbsp;<br />
|-<br />
| <code>GAMEPAD_BUTTON_RT = 35;</code><br />
| Right Trigger button<br />
|-<br />
| <code>GAMEPAD_BUTTON_R2 = GAMEPAD_BUTTON_RT;</code><br />
| &nbsp;<br />
|-<br />
| <code>GAMEPAD_BUTTON_RZ = GAMEPAD_BUTTON_RT;</code><br />
| &nbsp;<br />
|-<br />
| <code>GAMEPAD_BUTTON_LB = 36;</code><br />
| Left Bumper button<br />
|-<br />
| <code>GAMEPAD_BUTTON_L1 = GAMEPAD_BUTTON_LB;</code><br />
| &nbsp;<br />
|-<br />
| <code>GAMEPAD_BUTTON_L = GAMEPAD_BUTTON_LB;</code><br />
| &nbsp;<br />
|-<br />
| <code>GAMEPAD_BUTTON_RB = 37;</code><br />
| Right Bumper button<br />
|-<br />
| <code>GAMEPAD_BUTTON_R1 = GAMEPAD_BUTTON_RB;</code><br />
| &nbsp;<br />
|-<br />
| <code>GAMEPAD_BUTTON_R = GAMEPAD_BUTTON_RB;</code><br />
| &nbsp;<br />
|-<br />
| <code>GAMEPAD_BUTTON_Y = 38;</code><br />
| Y button<br />
|-<br />
| <code>GAMEPAD_BUTTON_TRIANGLE = GAMEPAD_BUTTON_Y;</code><br />
| Triangle button<br />
|-<br />
| <code>GAMEPAD_BUTTON_B = 39;</code><br />
| B button<br />
|-<br />
| <code>GAMEPAD_BUTTON_CIRCLE = GAMEPAD_BUTTON_B;</code><br />
| Circle button<br />
|-<br />
| <code>GAMEPAD_BUTTON_A = 40;</code><br />
| A button<br />
|-<br />
| <code>GAMEPAD_BUTTON_CROSS = GAMEPAD_BUTTON_A;</code><br />
| Cross button<br />
|-<br />
| <code>GAMEPAD_BUTTON_X = 41;</code><br />
| X button<br />
|-<br />
| <code>GAMEPAD_BUTTON_SQUARE = GAMEPAD_BUTTON_X;</code><br />
| Square button<br />
|-<br />
| <code>GAMEPAD_BUTTON_SELECT = 42;</code><br />
| Select button<br />
|-<br />
| <code>GAMEPAD_BUTTON_BACK = GAMEPAD_BUTTON_SELECT;</code><br />
| Back button<br />
|-<br />
| <code>GAMEPAD_BUTTON_SHARE = GAMEPAD_BUTTON_SELECT;</code><br />
| Share button<br />
|-<br />
| <code>GAMEPAD_BUTTON_CAPTURE = GAMEPAD_BUTTON_SELECT;</code><br />
| Capture button<br />
|-<br />
| <code>GAMEPAD_BUTTON_L3 = 43;</code><br />
| Left Stick or Left Axis button<br />
|-<br />
| <code>GAMEPAD_BUTTON_SL = GAMEPAD_BUTTON_L3;</code><br />
| &nbsp;<br />
|-<br />
| <code>GAMEPAD_BUTTON_R3 = 44;</code><br />
| Right Stick or Right Axis button<br />
|-<br />
| <code>GAMEPAD_BUTTON_SR = GAMEPAD_BUTTON_R3;</code><br />
| &nbsp;<br />
|-<br />
| <code>GAMEPAD_BUTTON_START = 45;</code><br />
| Start button<br />
|-<br />
| <code>GAMEPAD_BUTTON_OPTIONS = GAMEPAD_BUTTON_START;</code><br />
| &nbsp;<br />
|-<br />
| <code>GAMEPAD_BUTTON_UP = 46;</code><br />
| Up button<br />
|-<br />
| <code>GAMEPAD_BUTTON_RIGHT = 47;</code><br />
| Right button<br />
|-<br />
| <code>GAMEPAD_BUTTON_DOWN = 48;</code><br />
| Down button<br />
|-<br />
| <code>GAMEPAD_BUTTON_LEFT = 49;</code><br />
| Left button<br />
|-<br />
| <code>GAMEPAD_BUTTON_PLUS = 50;</code><br />
| Plus button<br />
|-<br />
| <code>GAMEPAD_BUTTON_MINUS = 51;</code><br />
| Minus button<br />
|-<br />
| <code>GAMEPAD_BUTTON_TOUCHPAD = 52;</code><br />
| Touchpad button<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>JOYSTICK_BUTTON_MAX = 52;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''Joystick and Gamepad Button Names''<br />
|- <br />
| <code>JOYSTICK_BUTTON_NAMES:array[JOYSTICK_BUTTON_NONE..JOYSTICK_BUTTON_MAX] of String = (</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_NONE',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_1',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_2',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_3',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_4',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_5',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_6',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_7',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_8',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_9',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_10',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_11',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_12',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_13',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_14',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_15',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_16',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_17',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_18',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_19',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_20',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_21',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_22',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_23',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_24',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_25',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_26',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_27',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_28',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_29',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_30',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_31',</code><br />
| &nbsp;<br />
|-<br />
| <code>'JOYSTICK_BUTTON_32',</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_HOME',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_LT',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_RT',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_LB',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_RB',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_Y',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_B',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_A',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_X',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_SELECT',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_L3',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_R3',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_START',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_UP',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_RIGHT',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_DOWN',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_LEFT',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_PLUS',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_MINUS',</code><br />
| &nbsp;<br />
|-<br />
| <code>'GAMEPAD_BUTTON_TOUCHPAD');</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''Joystick logging''' <code> JOYSTICK_LOG_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>JOYSTICK_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG;</code><br />
| Joystick debugging messages<br />
|-<br />
| <code>JOYSTICK_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code><br />
| Joystick informational messages, such as a device being attached or detached.<br />
|-<br />
| <code>JOYSTICK_LOG_LEVEL_WARN = LOG_LEVEL_WARN;</code><br />
| Joystick warning messages<br />
|-<br />
| <code>JOYSTICK_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code><br />
| Joystick error messages<br />
|-<br />
| <code>JOYSTICK_LOG_LEVEL_NONE = LOG_LEVEL_NONE;</code><br />
| No Joystick messages<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Type definitions ===<br />
----<br />
<br />
<br />
'''Joystick data'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PJoystickData = ^TJoystickData;</code><br />
<br />
<code>TJoystickData = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>AxisCount:LongInt;</code><br />
| The number of Axes reported by this device<br />
|-<br />
| <code>Axes:array[0..JOYSTICK_MAX_AXIS - 1] of SmallInt;</code><br />
| The currently reported value of each Axis<br />
|-<br />
| <code>HatCount:LongInt;</code><br />
| The number of Hats reported by this device<br />
|-<br />
| <code>Hats:array[0..JOYSTICK_MAX_HAT - 1] of SmallInt;</code><br />
| The currently reported value of each Hat<br />
|-<br />
| <code>ButtonCount:LongInt;</code><br />
| The number of Buttons reported by this device<br />
|-<br />
| <code>Buttons:LongWord;</code><br />
| The currently reported state of each Button<br />
|-<br />
| <code>Parameter:Pointer;</code><br />
| The parameter for the event callback (If applicable)<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''Joystick buffer'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PJoystickBuffer = ^TJoystickBuffer;</code><br />
<br />
<code>TJoystickBuffer = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>Wait:TSemaphoreHandle;</code><br />
| Buffer ready semaphore<br />
|-<br />
| <code>Start:LongWord;</code><br />
| Index of first buffer ready<br />
|-<br />
| <code>Count:LongWord;</code><br />
| Number of entries ready in buffer<br />
|-<br />
| <code>Buffer:array[0..(JOYSTICK_BUFFER_SIZE - 1)] of TJoystickData;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''Joystick extent'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PJoystickExtent = ^TJoystickExtent;</code><br />
<br />
<code>TJoystickExtent = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>Minimum:LongInt;</code><br />
| The minimum value for this extent<br />
|-<br />
| <code>Maximum:LongInt;</code><br />
| The maximum value for this extent<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''Joystick axis'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PJoystickAxis = ^TJoystickAxis;</code><br />
<br />
<code>TJoystickAxis = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>Name:LongWord;</code><br />
| The associated name (identifier) for this Axis<br />
|-<br />
| <code>Logical:TJoystickExtent;</code><br />
| The minimum and maximum logical values for this Axis<br />
|-<br />
| <code>Physical:TJoystickExtent;</code><br />
| The minimum and maximum physical values for this Axis<br />
|-<br />
| <code>Multiplier:Double;</code><br />
| The conversion multiplier for this Axis from logical to physical units<br />
|-<br />
| <code>Resolution:Double;</code><br />
| The unit resolution for this Axis in counts per physical unit<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''Joystick hat'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PJoystickHat = ^TJoystickHat;</code><br />
<br />
<code>TJoystickHat = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>Name:LongWord;</code><br />
| The associated name (identifier) for this Hat<br />
|-<br />
| <code>Logical:TJoystickExtent;</code><br />
| The minimum and maximum logical values for this Hat<br />
|-<br />
| <code>Physical:TJoystickExtent;</code><br />
| The minimum and maximum physical values for this Hat<br />
|-<br />
| <code>Multiplier:Double;</code><br />
| The conversion multiplier for this Hat from logical to physical units<br />
|-<br />
| <code>Resolution:Double;</code><br />
| The unit resolution for this Hat in counts per physical unit<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''Joystick properties'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PJoystickProperties = ^TJoystickProperties;</code><br />
<br />
<code>TJoystickProperties = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>Flags:LongWord;</code><br />
| Device flags (eg JOYSTICK_FLAG_LED)<br />
|-<br />
| <code>AxisCount:LongWord;</code><br />
| The number of Axes reported by this device<br />
|-<br />
| <code>Axes:array[0..JOYSTICK_MAX_AXIS - 1] of TJoystickAxis;</code><br />
| The current properties of each Axis<br />
|-<br />
| <code>HatCount:LongWord;</code><br />
| The number of Hats reported by this device<br />
|-<br />
| <code>Hats:array[0..JOYSTICK_MAX_HAT - 1] of TJoystickHat;</code><br />
| The current properties of each Hat<br />
|-<br />
| <code>ButtonCount:LongWord;</code><br />
| The number of Buttons reported by this device<br />
|-<br />
| <code>Buttons:array[0..JOYSTICK_MAX_BUTTON - 1] of LongWord;</code><br />
| The current name (identifier) of each Button<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''Joystick event callback'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>TJoystickEvent = function(Joystick:PJoystickDevice; Data:PJoystickData):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''Joystick enumeration callback'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>TJoystickEnumerate = function(Joystick:PJoystickDevice; Data:Pointer):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''Joystick notification callback''' <br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>TJoystickNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''Joystick device start'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>TJoystickDeviceStart = function(Joystick:PJoystickDevice):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''Joystick device stop''' <br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>TJoystickDeviceStop = function(Joystick:PJoystickDevice):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''Joystick device peek'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>TJoystickDevicePeek = function(Joystick:PJoystickDevice):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''Joystick device read'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>TJoystickDeviceRead = function(Joystick:PJoystickDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''Joystick device write''' <br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>TJoystickDeviceWrite = function(Joystick:PJoystickDevice; Buffer:Pointer; Size,Count:LongWord):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''Joystick device flush''' <br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>TJoystickDeviceFlush = function(Joystick:PJoystickDevice):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''Joystick device update''' <br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>TJoystickDeviceUpdate = function(Joystick:PJoystickDevice):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''Joystick device control''' <br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>TJoystickDeviceControl = function(Joystick:PJoystickDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''Joystick device get properties'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>TJoystickDeviceGetProperties = function(Joystick:PJoystickDevice; Properties:PJoystickProperties):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''Joystick device'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PJoystickDevice = ^TJoystickDevice;</code><br />
<br />
<code>TJoystickDevice = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|''Device Properties''<br />
|-<br />
| <code>Device:TDevice;</code><br />
| The Device entry for this Joystick device<br />
|-<br />
|colspan="2"|''Joystick Properties''<br />
|-<br />
| <code>JoystickId:LongWord;</code><br />
| Unique Id of this Joystick device in the Joystick device table<br />
|-<br />
| <code>JoystickState:LongWord;</code><br />
| Joystick device state (eg JOYSTICK_STATE_ENABLED)<br />
|-<br />
| <code>DeviceStart:TJoystickDeviceStart;</code><br />
| A Device specific DeviceStart method implementing the standard Joystick device interface (Mandatory)<br />
|-<br />
| <code>DeviceStop:TJoystickDeviceStop;</code><br />
| A Device specific DeviceStop method implementing the standard Joystick device interface (Mandatory)<br />
|-<br />
| <code>DevicePeek:TJoystickDevicePeek;</code><br />
| A Device specific DevicePeek method implementing a standard Joystick device interface (Or nil if the default method is suitable)<br />
|-<br />
| <code>DeviceRead:TJoystickDeviceRead;</code><br />
| A Device specific DeviceRead method implementing a standard Joystick device interface (Or nil if the default method is suitable)<br />
|-<br />
| <code>DeviceWrite:TJoystickDeviceWrite;</code><br />
| A Device specific DeviceWrite method implementing a standard Joystick device interface (Or nil if the default method is suitable)<br />
|-<br />
| <code>DeviceFlush:TJoystickDeviceFlush;</code><br />
| A Device specific DeviceFlush method implementing a standard Joystick device interface (Or nil if the default method is suitable)<br />
|-<br />
| <code>DeviceUpdate:TJoystickDeviceUpdate;</code><br />
| A Device specific DeviceUpdate method implementing a standard Joystick device interface (Or nil if the default method is suitable)<br />
|-<br />
| <code>DeviceControl:TJoystickDeviceControl;</code><br />
| A Device specific DeviceControl method implementing a standard Joystick device interface (Or nil if the default method is suitable)<br />
|-<br />
| <code>DeviceGetProperties:TJoystickDeviceGetProperties;</code><br />
| A Device specific DeviceGetProperties method implementing a standard Joystick device interface (Or nil if the default method is suitable)<br />
|-<br />
|colspan="2"|''Driver Properties''<br />
|-<br />
| <code>Lock:TMutexHandle;</code><br />
| Device lock<br />
|-<br />
| <code>Event:TJoystickEvent;</code><br />
| Event callback function (If assigned)<br />
|-<br />
| <code>Parameter:Pointer;</code><br />
| Parameter for the event callback (or nil)<br />
|-<br />
| <code>Buffer:TJoystickBuffer;</code><br />
| Joystick input buffer<br />
|-<br />
| <code>Properties:TJoystickProperties;</code><br />
| Device properties<br />
|-<br />
|colspan="2"|''Statistics Properties''<br />
|-<br />
| <code>ReceiveCount:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>ReceiveErrors:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>BufferOverruns:LongWord;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|''Internal Properties''<br />
|-<br />
| <code>Prev:PJoystickDevice;</code><br />
| Previous entry in Joystick device table<br />
|-<br />
| <code>Next:PJoystickDevice;</code><br />
| Next entry in Joystick device table<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Public variables ===<br />
----<br />
<br />
<br />
'''Joystick logging'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>JOYSTICK_DEFAULT_LOG_LEVEL:LongWord = JOYSTICK_LOG_LEVEL_DEBUG;</code><br />
| style="width: 40%;"|Minimum level for Joystick messages. Only messages with level greater than or equal to this will be printed.<br />
|-<br />
|}<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>JOYSTICK_LOG_ENABLED:Boolean;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br /><br />
<br />
=== Function declarations ===<br />
----<br />
<br />
<br />
'''Initialization functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure JoystickInit;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the Joystick unit and Joystick device table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Called only during system startup<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''Joystick functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceStart(Joystick:PJoystickDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Start the specified Joystick device ready for receiving events</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to start<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceStop(Joystick:PJoystickDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Stop the specified Joystick device and terminate receiving events</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to stop<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDevicePeek(Joystick:PJoystickDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Peek at the buffer of the specified joystick device to see if any data packets are ready</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to peek at<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if packets are ready, ERROR_NO_MORE_ITEMS if not or another error code on failure.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceRead(Joystick:PJoystickDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read joystick data packets from the buffer of the specified joystick device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to read from<br />
|-<br />
! Buffer<br />
| Pointer to a buffer to copy the joystick data packets to<br />
|-<br />
! Size<br />
| The size of the buffer in bytes (Must be at least TJoystickData or greater)<br />
|-<br />
! Flags<br />
| The flags for the behaviour of the read (eg JOYSTICK_FLAG_NON_BLOCK)<br />
|-<br />
! Count<br />
| The number of joystick data packets copied to the buffer<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceWrite(Joystick:PJoystickDevice; Buffer:Pointer; Size,Count:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write joystick data packets to the buffer of the specified joystick device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to write to<br />
|-<br />
! Buffer<br />
| Pointer to a buffer to copy the joystick data packets from<br />
|-<br />
! Size<br />
| The size of the buffer in bytes (Must be at least TJoystickData or greater)<br />
|-<br />
! Count<br />
| The number of joystick data packets to copy from the buffer<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceFlush(Joystick:PJoystickDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Flush the contents of the buffer of the specified joystick device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to flush<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceUpdate(Joystick:PJoystickDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Request the specified Joystick device to update the current configuration</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to update<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
! Note<br />
| Items updated can include rotation, maximum X and Y and flags (If supported)<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceControl(Joystick:PJoystickDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Perform a control request on the specified Joystick device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to control<br />
|-<br />
! Request<br />
| The request code for the operation (eg JOYSTICK_CONTROL_GET_FLAG)<br />
|-<br />
! Argument1<br />
| The first argument for the operation (Dependent on request code)<br />
|-<br />
! Argument2<br />
| The second argument for the operation (Dependent on request code)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceGetProperties(Joystick:PJoystickDevice; Properties:PJoystickProperties):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the properties for the specified Joystick device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to get properties from<br />
|-<br />
! Properties<br />
| Pointer to a TJoystickProperties structure to fill in<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceSetState(Joystick:PJoystickDevice; State:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the state of the specified joystick and send a notification</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The joystick to set the state for<br />
|-<br />
! State<br />
| The new state to set and notify<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceCreate:PJoystickDevice;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new Joystick device entry</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Return<br />
| Pointer to new Joystick device entry or nil if Joystick device could not be created<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceCreateEx(Size:LongWord):PJoystickDevice;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new Joystick device entry</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Size<br />
| Size in bytes to allocate for new Joystick device (Including the Joystick device entry)<br />
|-<br />
! Return<br />
| Pointer to new Joystick device entry or nil if Joystick device could not be created<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceDestroy(Joystick:PJoystickDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Destroy an existing Joystick device entry</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to destroy<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceRegister(Joystick:PJoystickDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a new Joystick device in the Joystick device table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to register<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceDeregister(Joystick:PJoystickDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Deregister a Joystick device from the Joystick device table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to deregister<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceFind(JoystickId:LongWord):PJoystickDevice;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a Joystick device by ID in the Joystick device table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! JoystickId<br />
| The ID number of the Joystick device to find<br />
|-<br />
! Return<br />
| Pointer to Joystick device entry or nil if not found<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceFindByName(const Name:String):PJoystickDevice; inline;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a Joystick device by name in the device table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Name<br />
| The name of the Joystick device to find (eg Joystick0)<br />
|-<br />
! Return<br />
| Pointer to Joystick device entry or nil if not found<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceFindByDescription(const Description:String):PJoystickDevice; inline;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a Joystick device by description in the device table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Description<br />
| The description of the Joystick to find (eg USB Gamepad)<br />
|-<br />
! Return<br />
| Pointer to Joystick device entry or nil if not found<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceEnumerate(Callback:TJoystickEnumerate; Data:Pointer):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Enumerate all Joystick devices in the Joystick device table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Callback<br />
| The callback function to call for each Joystick device in the table<br />
|-<br />
! Data<br />
| A private data pointer to pass to callback for each Joystick device in the table<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceNotification(Joystick:PJoystickDevice; Callback:TJoystickNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a notification for Joystick device changes</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to notify changes for (Optional, pass nil for all Joystick devices)<br />
|-<br />
! Callback<br />
| The function to call when a notification event occurs<br />
|-<br />
! Data<br />
| A private data pointer to pass to callback when a notification event occurs<br />
|-<br />
! Notification<br />
| The events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER)<br />
|-<br />
! Flags<br />
| The flags to control the notification (eg NOTIFIER_FLAG_WORKER)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''Joystick helper functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickGetCount:LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current Joystick device count</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Return<br />
| The number of Joystick devices<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceGetDefault:PJoystickDevice;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current default Joystick device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Return<br />
| Pointer to default Joystick device entry<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceSetDefault(Joystick:PJoystickDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the current default Joystick device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to set as default<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceCheck(Joystick:PJoystickDevice):PJoystickDevice;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the supplied Joystick device is in the Joystick device table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to check<br />
|-<br />
! Return<br />
| Pointer to Joystick device entry or nil if not found<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceAxisToString(Name:LongWord):String;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing a Joystick or Gamepad Axis (eg JOYSTICK_AXIS_X)</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceHatToString(Name:LongWord):String;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing a Joystick or Gamepad Hat (eg JOYSTICK_HAT_POV)</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceButtonToString(Name:LongWord):String;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing a Joystick or Gamepad Button (eg GAMEPAD_BUTTON_UP)</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceTypeToString(JoystickType:LongWord):String;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the Joystick device type (eg JOYSTICK_TYPE_JOYSTICK)</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceStateToString(JoystickState:LongWord):String;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the Joystick device state (eg JOYSTICK_STATE_ENABLED)</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceStateToNotification(State:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Convert a Joystick state value into the notification code for device notifications</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceGetAxis(Joystick:PJoystickDevice; Index:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the name (identifier) of an Axis on the specified Joystick</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to get the name from<br />
|-<br />
! Index<br />
| The index of the Axis in the Joystick properties (First Axis is 0)<br />
|-<br />
! Return<br />
| The current name of the Axis (eg GAMEPAD_AXIS_LEFT_X)<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceSetAxis(Joystick:PJoystickDevice; Index,Name:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the name (identifier) of an Axis on the specified Joystick</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to set the name for<br />
|-<br />
! Index<br />
| The index of the Axis in the Joystick properties (First Axis is 0)<br />
|-<br />
! Name<br />
| The name (identifier) to set for the Axis (eg JOYSTICK_AXIS_X)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceGetHat(Joystick:PJoystickDevice; Index:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the name (identifier) of a Hat on the specified Joystick</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to get the name from<br />
|-<br />
! Index<br />
| The index of the Hat in the Joystick properties (First Hat is 0)<br />
|-<br />
! Return<br />
| The current name of the Hat (eg GAMEPAD_HAT_POV)<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceSetHat(Joystick:PJoystickDevice; Index,Name:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the name (identifier) of a Hat on the specified Joystick</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to set the name for<br />
|-<br />
! Index<br />
| The index of the Hat in the Joystick properties (First Hat is 0)<br />
|-<br />
! Name<br />
| The name (identifier) to set for the Hat (eg JOYSTICK_HAT_POV)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceGetButton(Joystick:PJoystickDevice; Index:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the name (identifier) of a Button on the specified Joystick</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to get the name from<br />
|-<br />
! Index<br />
| The index of the Button in the Joystick properties (First Button is 0)<br />
|-<br />
! Return<br />
| The current name of the Button (eg GAMEPAD_BUTTON_B)<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceSetButton(Joystick:PJoystickDevice; Index,Name:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the name (identifier) of a Button on the specified Joystick</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to set the name for<br />
|-<br />
! Index<br />
| The index of the Button in the Joystick properties (First Button is 0)<br />
|-<br />
! Name<br />
| The name (identifier) to set for the Button (eg GAMEPAD_BUTTON_LT)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickDeviceSetCallback(Joystick:PJoystickDevice; Event:TJoystickEvent; Parameter:Pointer):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the event callback function for the specified Joystick</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The Joystick device to set the event callback for<br />
|-<br />
! Event<br />
| The event callback function to be called when Joystick data is received<br />
|-<br />
! Parameter<br />
| A pointer to private data to be passed to the callback with each event<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function JoystickInsertData(Joystick:PJoystickDevice; Data:PJoystickData; Signal:Boolean):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Insert a TJoystickData entry into the joystick device buffer</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Joystick<br />
| The joystick device to insert data for<br />
|-<br />
! Data<br />
| The TJoystickData entry to insert<br />
|-<br />
! Signal<br />
| If True then signal that new data is available in the buffer<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
! Note<br />
| Caller must hold the joystick device lock<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure JoystickLog(Level:LongWord; Joystick:PJoystickDevice; const AText:String);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure JoystickLogInfo(Joystick:PJoystickDevice; const AText:String); inline;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure JoystickLogWarn(Joystick:PJoystickDevice; const AText:String); inline;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure JoystickLogError(Joystick:PJoystickDevice; const AText:String); inline;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure JoystickLogDebug(Joystick:PJoystickDevice; const AText:String); inline;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
Return to [[Unit_Reference|Unit Reference]]</div>
Ultibo
https://ultibo.org/wiki/Unit_HIDJOYSTICK
Unit HIDJOYSTICK
2022-11-17T03:39:56Z
<p>Ultibo: </p>
<hr />
<div>Return to [[Unit_Reference|Unit Reference]]<br />
<br />
<br />
=== Description ===<br />
----<br />
<br />
'''Ultibo HID Joystick and Gamepad Consumer unit'''<br />
<br />
This is a consumer for any generic HID joystick or gamepad device, it accepts HID application collections in the generic desktop page (HID_PAGE_GENERIC_DESKTOP) with the usage set to joystick (HID_DESKTOP_JOYSTICK) or gamepad (HID_DESKTOP_GAMEPAD).<br />
<br />
The consumer will bind to any joystick or gamepad collection that implements at a minimum the X and Y axis and at least one button.<br />
<br />
This consumer doesn't support certain well known gamepad devices such as the Xbox or PlayStation controllers that have specific control and button mappings and may require special command sequences to enable certain features. The option to create an additional driver that has specific support for some of those devices is being considered.<br />
<br />
=== Constants ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID joystick specific constants''' <code> HID_JOYSTICK_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>HID_JOYSTICK_CONSUMER_NAME = 'HID Joystick and Gamepad Consumer';</code><br />
| Name of HID Joystick consumer<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_JOYSTICK_DESCRIPTION = 'HID Joystick';</code><br />
| Description of HID Joystick device<br />
|-<br />
| <code>HID_GAMEPAD_DESCRIPTION = 'HID Gamepad';</code><br />
| Description of HID Gamepad device<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Type definitions ===<br />
----<br />
<br />
<br />
'''HID joystick device'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDJoystickDevice = ^THIDJoystickDevice;</code><br />
<br />
<code>THIDJoystickDevice = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|''Joystick Properties''<br />
|-<br />
| <code>Joystick:TJoystickDevice;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|''HID Properties''<br />
|-<br />
| <code>Collection:PHIDCollection;</code><br />
| The HID collection this joystick is bound to<br />
|-<br />
| <code>Definitions:PHIDDefinition;</code><br />
| The input report definitions that can be accepted as joystick reports<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Public variables ===<br />
----<br />
<br />
''None defined''<br />
<br />
=== Function declarations ===<br />
----<br />
<br />
<br />
'''Initialization functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure HIDJoystickInit;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the HID Joystick unit and HID Joystick driver</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Called only during system startup<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''HID joystick functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDJoystickStart(Joystick:PJoystickDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of JoystickDeviceStart API for HID Joystick device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Not intended to be called directly by applications, use JoystickDeviceStart instead.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDJoystickStop(Joystick:PJoystickDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of JoystickDeviceStop API for HID Joystick device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Not intended to be called directly by applications, use JoystickDeviceStop instead.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDJoystickUpdate(Joystick:PJoystickDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of JoystickDeviceUpdate API for HID Joystick device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Not intended to be called directly by applications, use JoystickDeviceUpdate instead.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''HID joystick helper functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDJoystickCheckCollection(Collection:PHIDCollection):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if a HID collection is suitable for use as a joystick device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDJoystickCheckDefinition(Definition:PHIDDefinition):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if a HID definition is suitable for use as a joystick input report</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
Return to [[Unit_Reference|Unit Reference]]</div>
Ultibo
https://ultibo.org/wiki/TWebStatusJoystick
TWebStatusJoystick
2022-11-16T05:46:27Z
<p>Ultibo: Created page with "Return to Unit WebStatus __TOC__ === Description === ---- ''To be documented'' === Class definitions === ---- <div class="toccolours mw-collapsible m..."</p>
<hr />
<div>Return to [[Unit_WebStatus|Unit WebStatus]]<br />
<br />
<br />
__TOC__<br />
<br />
=== Description ===<br />
----<br />
<br />
''To be documented''<br />
<br />
=== Class definitions ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<br />
<code>TWebStatusJoystick = class(TWebStatusSub)</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div><br />
|-<br />
| <code>constructor Create(AMain:TWebStatusMain);</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div><br />
|-<br />
| <code>function JoystickFlagsToFlagNames(AFlags:LongWord):TStringList;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div><br />
|-<br />
| <code>function DoGet(AHost:THTTPHost;ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; override;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Function declarations ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">constructor TWebStatusJoystick.Create(AMain:TWebStatusMain);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function TWebStatusJoystick.JoystickFlagsToFlagNames(AFlags:LongWord):TStringList;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function TWebStatusJoystick.DoGet(AHost:THTTPHost;ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; override;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
Return to [[Unit_Reference|Unit Reference]]</div>
Ultibo
https://ultibo.org/wiki/Unit_USBMOUSE
Unit USBMOUSE
2022-11-11T04:24:59Z
<p>Ultibo: </p>
<hr />
<div>Return to [[Unit_Reference|Unit Reference]]<br />
<br />
<br />
=== Description ===<br />
----<br />
<br />
'''Ultibo USB Mouse Driver unit'''<br />
<br />
'''USB Mouse Devices'''<br />
<br />
The USB mouse driver in this unit uses HID Boot Protocol only and has been replaced by the HIDMouse unit which provides complete HID Report Protocol support for USB mice. It is retained here for legacy uses and backwards compatibility only.<br />
<br />
To use this driver in place of the default HID Mouse driver set the following configuration variables in your application during system initialization.<br />
HID_REGISTER_MOUSE := False;<br />
USB_MOUSE_REGISTER_DRIVER := True;<br />
This driver does not recognize devices that do not report themselves as boot mice, does not correctly recognize the wheel on many devices and is known to be incompatible with the touch pad included in some portable wireless keyboards.<br />
<br />
=== Constants ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''USB mouse specific constants''' <code> USBMOUSE_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>USBMOUSE_DRIVER_NAME = 'USB Mouse Driver (HID boot protocol)';</code><br />
| Name of USB mouse driver<br />
|-<br />
| <code>USBMOUSE_MOUSE_DESCRIPTION = 'USB HID Mouse';</code><br />
| Description of USB mouse device<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''USB HID types''' <code> USB_HID_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|''HID Interface Subclass types (See USB HID v1.11 specification)''<br />
|-<br />
| <code>USB_HID_SUBCLASS_NONE = 0;</code><br />
| Section 4.2<br />
|-<br />
| <code>USB_HID_SUBCLASS_BOOT = 1;</code><br />
| Section 4.2<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''HID Interface Protocol types (See USB HID v1.11 specification)''<br />
|-<br />
| <code>USB_HID_BOOT_PROTOCOL_NONE = 0;</code><br />
| Section 4.3<br />
|-<br />
| <code>USB_HID_BOOT_PROTOCOL_KEYBOARD = 1;</code><br />
| Section 4.3<br />
|-<br />
| <code>USB_HID_BOOT_PROTOCOL_MOUSE = 2;</code><br />
| Section 4.3<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''HID Class Descriptor Types (See USB HID v1.11 specification)''<br />
|-<br />
| <code>USB_HID_DESCRIPTOR_TYPE_HID = $21;</code><br />
| Section 7.1<br />
|-<br />
| <code>USB_HID_DESCRIPTOR_TYPE_REPORT = $22;</code><br />
| Section 7.1<br />
|-<br />
| <code>USB_HID_DESCRIPTOR_TYPE_PHYSICAL_DESCRIPTOR = $23;</code><br />
| Section 7.1<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''HID Request types''<br />
|-<br />
| <code>USB_HID_REQUEST_GET_REPORT = $01;</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_REQUEST_GET_IDLE = $02;</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_REQUEST_GET_PROTOCOL = $03;</code><br />
| Section 7.2<br />
|-<br />
| <code>USB_HID_REQUEST_SET_REPORT = $09;</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_REQUEST_SET_IDLE = $0A;</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_REQUEST_SET_PROTOCOL = $0B;</code><br />
| Section 7.2<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''HID Protocol types''<br />
|-<br />
| <code>USB_HID_PROTOCOL_BOOT = 0;</code><br />
| Section 7.2.5<br />
|-<br />
| <code>USB_HID_PROTOCOL_REPORT = 1;</code><br />
| Section 7.2.5<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''HID Report types''<br />
|-<br />
| <code>USB_HID_REPORT_INPUT = 1;</code><br />
| Section 7.2.1<br />
|-<br />
| <code>USB_HID_REPORT_OUTPUT = 2;</code><br />
| Section 7.2.1<br />
|-<br />
| <code>USB_HID_REPORT_FEATURE = 3;</code><br />
| Section 7.2.1<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''HID Report IDs''<br />
|-<br />
| <code>USB_HID_REPORTID_NONE = 0;</code><br />
| Section 7.2.1<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''HID Boot Protocol Button bits''<br />
|-<br />
| <code>USB_HID_BOOT_LEFT_BUTTON = (1 shl 0);</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_RIGHT_BUTTON = (1 shl 1);</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_MIDDLE_BUTTON = (1 shl 2);</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_SIDE_BUTTON = (1 shl 3);</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_EXTRA_BUTTON = (1 shl 4);</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''HID Boot Protocol Report data''<br />
|-<br />
| <code>USB_HID_BOOT_REPORT_SIZE = 3;</code><br />
| Appendix B of HID Device Class Definition 1.11<br />
|-<br />
| <code>USB_HID_BOOT_DATA_SIZE = 8;</code><br />
| Allocate more than the minimum to allow for extra data<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Type definitions ===<br />
----<br />
<br />
<br />
'''USB HID descriptor'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PUSBHIDDescriptor = ^TUSBHIDDescriptor;</code><br />
<br />
<code>TUSBHIDDescriptor = packed record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>bLength:Byte;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>bDescriptorType:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>bcdHID:Word;</code><br />
| &nbsp;<br />
|-<br />
| <code>bCountryCode:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>bNumDescriptors:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>bHIDDescriptorType:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>wHIDDescriptorLength:Word;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|Note: Up to two optional bHIDDescriptorType/wHIDDescriptorLength pairs after the Report descriptor details<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''USB mouse device'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PUSBMouseDevice = ^TUSBMouseDevice;</code><br />
<br />
<code>TUSBMouseDevice = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|''Mouse Properties''<br />
|-<br />
| <code>Mouse:TMouseDevice;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|''USB Properties''<br />
|-<br />
| <code>HIDInterface:PUSBInterface;</code><br />
| USB HID Mouse Interface<br />
|-<br />
| <code>ReportRequest:PUSBRequest;</code><br />
| USB request for mouse report data<br />
|-<br />
| <code>ReportEndpoint:PUSBEndpointDescriptor;</code><br />
| USB Mouse Interrupt IN Endpoint<br />
|-<br />
| <code>HIDDescriptor:PUSBHIDDescriptor;</code><br />
| USB HID Descriptor for mouse<br />
|-<br />
| <code>ReportDescriptor:Pointer;</code><br />
| USB HID Report Descriptor for mouse<br />
|-<br />
| <code>PendingCount:LongWord;</code><br />
| Number of USB requests pending for this mouse<br />
|-<br />
| <code>WaiterThread:TThreadId;</code><br />
| Thread waiting for pending requests to complete (for mouse detachment)<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Public variables ===<br />
----<br />
<br />
''None defined''<br />
<br />
=== Function declarations ===<br />
----<br />
<br />
<br />
<br />
'''Initialization functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure USBMouseInit;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the USB mouse driver</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Called only during system startup<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''USB mouse functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBMouseDriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Bind the Mouse driver to a USB device if it is suitable</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The USB device to attempt to bind to<br />
|-<br />
! Interrface<br />
| The USB interface to attempt to bind to (or nil for whole device)<br />
|-<br />
! Return<br />
| USB_STATUS_SUCCESS if completed, USB_STATUS_DEVICE_UNSUPPORTED if unsupported or another error code on failure.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBMouseDriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unbind the Mouse driver from a USB device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The USB device to unbind from<br />
|-<br />
! Interrface<br />
| The USB interface to unbind from (or nil for whole device)<br />
|-<br />
! Return<br />
| USB_STATUS_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure USBMouseReportWorker(Request:PUSBRequest);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called (by a Worker thread) to process a completed USB request from a USB mouse IN interrupt endpoint</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Request<br />
| The USB request which has completed<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure USBMouseReportComplete(Request:PUSBRequest);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when a USB request from a USB mouse IN interrupt endpoint completes</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Request<br />
| The USB request which has completed<br />
|-<br />
! Note<br />
| Request is passed to worker thread for processing to prevent blocking the USB completion<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''USB mouse helper functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBMouseCheckDevice(Device:PUSBDevice):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the supplied USB device is suitable for detection as a HID Mouse Device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The USB device to check<br />
|-<br />
! Return<br />
| True if the device is suitable or False if it is not<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBMouseDeviceSetProtocol(Mouse:PUSBMouseDevice; Protocol:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the report protocol for a USB mouse device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Mouse<br />
| The USB mouse device to set the report protocol for<br />
|-<br />
! Protocol<br />
| The report protocol to set (eg USB_HID_PROTOCOL_BOOT)<br />
|-<br />
! Return<br />
| USB_STATUS_SUCCESS if completed or another USB error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBMouseDeviceGetHIDDescriptor(Mouse:PUSBMouseDevice; Descriptor:PUSBHIDDescriptor):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the HID Descriptor for a USB mouse device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Mouse<br />
| The USB mouse device to get the descriptor for<br />
|-<br />
! Descriptor<br />
| Pointer to a USB HID Descriptor structure for the returned data<br />
|-<br />
! Return<br />
| USB_STATUS_SUCCESS if completed or another USB error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBMouseDeviceGetReportDescriptor(Mouse:PUSBMouseDevice; Descriptor:Pointer; Size:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the Report Descriptor for a USB mouse device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Mouse<br />
| The USB mouse device to get the descriptor for<br />
|-<br />
! Descriptor<br />
| Pointer to a buffer to return the USB Report Descriptor<br />
|-<br />
! Size<br />
| The size in bytes of the buffer pointed to by Descriptor<br />
|-<br />
! Return<br />
| USB_STATUS_SUCCESS if completed or another USB error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
Return to [[Unit_Reference|Unit Reference]]</div>
Ultibo
https://ultibo.org/wiki/Unit_USBKEYBOARD
Unit USBKEYBOARD
2022-11-11T04:24:48Z
<p>Ultibo: </p>
<hr />
<div>Return to [[Unit_Reference|Unit Reference]]<br />
<br />
<br />
=== Description ===<br />
----<br />
<br />
'''Ultibo USB Keyboard Driver unit'''<br />
<br />
'''USB Keyboard Devices'''<br />
<br />
The USB keyboard driver in this unit uses HID Boot Protocol only and has been replaced by the HIDKeyboard unit which provides complete HID Report Protocol support for USB keyboards. It is retained here for legacy uses and backwards compatibility only.<br />
<br />
To use this driver in place of the default HID Keyboard driver set the following configuration variables in your application during system initialization.<br />
HID_REGISTER_KEYBOARD := False;<br />
USB_KEYBOARD_REGISTER_DRIVER := True;<br />
This driver does not recognize devices that do not report themselves as boot keyboards.<br />
<br />
=== Constants ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''USB keyboard specific constants''' <code> NAME_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>USBKEYBOARD_DRIVER_NAME = 'USB Keyboard Driver (HID boot protocol)';</code><br />
| Name of USB keyboard driver<br />
|-<br />
| <code>USBKEYBOARD_KEYBOARD_DESCRIPTION = 'USB HID Keyboard';</code><br />
| Description of USB keyboard device<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''USB HID interface subclass''' <code> USB_HID_SUBCLASS_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See USB HID v1.11 specification<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>USB_HID_SUBCLASS_NONE = 0;</code><br />
| Section 4.2<br />
|-<br />
| <code>USB_HID_SUBCLASS_BOOT = 1;</code><br />
| Section 4.2<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''USB HID interface protocol''' <code> USB_HID_BOOT_PROTOCOL_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See USB HID v1.11 specification<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_PROTOCOL_NONE = 0;</code><br />
| Section 4.3<br />
|-<br />
| <code>USB_HID_BOOT_PROTOCOL_KEYBOARD = 1;</code><br />
| Section 4.3<br />
|-<br />
| <code>USB_HID_BOOT_PROTOCOL_MOUSE = 2;</code><br />
| Section 4.3<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''USB HID class descriptor''' <code> USB_HID_DESCRIPTOR_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See USB HID v1.11 specification<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>USB_HID_DESCRIPTOR_TYPE_HID = $21;</code><br />
| Section 7.1<br />
|-<br />
| <code>USB_HID_DESCRIPTOR_TYPE_REPORT = $22;</code><br />
| Section 7.1<br />
|-<br />
| <code>USB_HID_DESCRIPTOR_TYPE_PHYSICAL_DESCRIPTOR = $23;</code><br />
| Section 7.1<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''USB HID request''' <code> USB_HID_REQUEST_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See USB HID v1.11 specification<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>USB_HID_REQUEST_GET_REPORT = $01;</code><br />
| Section 7.2<br />
|-<br />
| <code>USB_HID_REQUEST_GET_IDLE = $02;</code><br />
| Section 7.2<br />
|-<br />
| <code>USB_HID_REQUEST_GET_PROTOCOL = $03;</code><br />
| Section 7.2<br />
|-<br />
| <code>USB_HID_REQUEST_SET_REPORT = $09;</code><br />
| Section 7.2<br />
|-<br />
| <code>USB_HID_REQUEST_SET_IDLE = $0A;</code><br />
| Section 7.2<br />
|-<br />
| <code>USB_HID_REQUEST_SET_PROTOCOL = $0B;</code><br />
| Section 7.2<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''USB HID protocol''' <code> USB_HID_PROTOCOL_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See USB HID v1.11 specification<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>USB_HID_PROTOCOL_BOOT = 0;</code><br />
| Section 7.2.5<br />
|-<br />
| <code>USB_HID_PROTOCOL_REPORT = 1;</code><br />
| Section 7.2.5<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''USB HID report''' <code> USB_HID_REPORT_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See USB HID v1.11 specification<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>USB_HID_REPORT_INPUT = 1;</code><br />
| Section 7.2.1<br />
|-<br />
| <code>USB_HID_REPORT_OUTPUT = 2;</code><br />
| Section 7.2.1<br />
|-<br />
| <code>USB_HID_REPORT_FEATURE = 3;</code><br />
| Section 7.2.1<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''USB HID report Ids''' <code> USB_HID_REPORTID_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See USB HID v1.11 specification<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>USB_HID_REPORTID_NONE = 0;</code><br />
| Section 7.2.1<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''USB HID boot protocol''' <code> USB_HID_BOOT_LEFT_*, USB_HID_BOOT_RIGHT_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>USB_HID_BOOT_LEFT_CTRL = (1 shl 0);</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_LEFT_SHIFT = (1 shl 1);</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_LEFT_ALT = (1 shl 2);</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_LEFT_GUI = (1 shl 3);</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_RIGHT_CTRL = (1 shl 4);</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_RIGHT_SHIFT = (1 shl 5);</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_RIGHT_ALT = (1 shl 6);</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_RIGHT_GUI = (1 shl 7);</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''USB HID boot protocol report data''' <code> USB_HID_BOOT_REPORT_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>USB_HID_BOOT_REPORT_SIZE = 8;</code><br />
| Appendix B of HID Device Class Definition 1.11<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''USB HID boot protocol output''' <code> USB_HID_BOOT_*_LED </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>USB_HID_BOOT_NUMLOCK_LED = (1 shl 0);</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_CAPSLOCK_LED = (1 shl 1);</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_SCROLLLOCK_LED = (1 shl 2);</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_COMPOSE_LED = (1 shl 3);</code><br />
| &nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_KANA_LED = (1 shl 4);</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_LEDMASK = USB_HID_BOOT_NUMLOCK_LED or USB_HID_BOOT_CAPSLOCK_LED or USB_HID_BOOT_SCROLLLOCK_LED or USB_HID_BOOT_COMPOSE_LED or USB_HID_BOOT_KANA_LED;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''USB HID boot protocol output data''' <code> USB_HID_BOOT_OUTPUT_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>USB_HID_BOOT_OUTPUT_SIZE = 1;</code><br />
| Appendix B of HID Device Class Definition 1.11<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>USB_HID_BOOT_USAGE_NUMLOCK = SCAN_CODE_NUMLOCK;</code><br />
| 83<br />
|-<br />
| <code>USB_HID_BOOT_USAGE_CAPSLOCK = SCAN_CODE_CAPSLOCK;</code><br />
| 57<br />
|-<br />
| <code>USB_HID_BOOT_USAGE_SCROLLLOCK = SCAN_CODE_SCROLLLOCK;</code><br />
| 71<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Type definitions ===<br />
----<br />
<br />
<br />
'''USB HID descriptor'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PUSBHIDDescriptor = ^TUSBHIDDescriptor;</code><br />
<br />
<code>TUSBHIDDescriptor = packed record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>bLength:Byte;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>bDescriptorType:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>bcdHID:Word;</code><br />
| &nbsp;<br />
|-<br />
| <code>bCountryCode:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>bNumDescriptors:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>bHIDDescriptorType:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>wHIDDescriptorLength:Word;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|Note: Up to two optional bHIDDescriptorType/wHIDDescriptorLength pairs after the Report descriptor details<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''USB boot keyboard report'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PUSBKeyboardReport = ^TUSBKeyboardReport;</code><br />
<br />
<code>TUSBKeyboardReport = array[0..7] of Byte;</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| &nbsp;<br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''USB keyboard device'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PUSBKeyboardDevice = ^TUSBKeyboardDevice;</code><br />
<br />
<code>TUSBKeyboardDevice = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|''Keyboard Properties''<br />
|-<br />
| <code>Keyboard:TKeyboardDevice;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|''USB Properties''<br />
|-<br />
| <code>HIDInterface:PUSBInterface;</code><br />
| USB HID Keyboard Interface<br />
|-<br />
| <code>ReportRequest:PUSBRequest;</code><br />
| USB request for keyboard report data<br />
|-<br />
| <code>ReportEndpoint:PUSBEndpointDescriptor;</code><br />
| USB Keyboard Interrupt IN Endpoint<br />
|-<br />
| <code>HIDDescriptor:PUSBHIDDescriptor;</code><br />
| USB HID Descriptor for keyboard<br />
|-<br />
| <code>ReportDescriptor:Pointer;</code><br />
| USB HID Report Descriptor for keyboard<br />
|-<br />
| <code>LastCode:Word;</code><br />
| The scan code of the last key pressed<br />
|-<br />
| <code>LastCount:LongWord;</code><br />
| The repeat count of the last key pressed<br />
|-<br />
| <code>LastReport:TUSBKeyboardReport;</code><br />
| The last keyboard report received<br />
|-<br />
| <code>PendingCount:LongWord;</code><br />
| Number of USB requests pending for this keyboard<br />
|-<br />
| <code>WaiterThread:TThreadId;</code><br />
| Thread waiting for pending requests to complete (for keyboard detachment)<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Public variables ===<br />
----<br />
<br />
''None defined''<br />
<br />
=== Function declarations ===<br />
----<br />
<br />
<br />
'''Initialization functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure USBKeyboardInit;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the USB keyboard driver</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Called only during system startup<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''USB keyboard functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBKeyboardDeviceRead(Keyboard:PKeyboardDevice; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of KeyboardDeviceRead API for USB Keyboard</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Not intended to be called directly by applications, use KeyboardDeviceRead instead.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBKeyboardDeviceControl(Keyboard:PKeyboardDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of KeyboardDeviceControl API for USB Keyboard</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Not intended to be called directly by applications, use KeyboardDeviceControl instead.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBKeyboardDriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Bind the Keyboard driver to a USB device if it is suitable</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The USB device to attempt to bind to<br />
|-<br />
! Interrface<br />
| The USB interface to attempt to bind to (or nil for whole device)<br />
|-<br />
! Return<br />
| USB_STATUS_SUCCESS if completed, USB_STATUS_DEVICE_UNSUPPORTED if unsupported or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBKeyboardDriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unbind the Keyboard driver from a USB device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The USB device to unbind from<br />
|-<br />
! Interrface<br />
| The USB interface to unbind from (or nil for whole device)<br />
|-<br />
! Return<br />
| USB_STATUS_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure USBKeyboardReportWorker(Request:PUSBRequest);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called (by a Worker thread) to process a completed USB request from a USB keyboard IN interrupt endpoint</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Request<br />
| The USB request which has completed<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure USBKeyboardReportComplete(Request:PUSBRequest);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Called when a USB request from a USB keyboard IN interrupt endpoint completes</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Request<br />
| The USB request which has completed<br />
|-<br />
! Note<br />
| Request is passed to worker thread for processing to prevent blocking the USB completion<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''USB helper functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBKeyboardCheckDevice(Device:PUSBDevice):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the supplied USB device is suitable for detection as a HID Keyboard Device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The USB device to check<br />
|-<br />
! Return<br />
| True if the device is suitable or False if it is not<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBKeyboardCheckPressed(Keyboard:PUSBKeyboardDevice; ScanCode:Byte):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the passed scan code has been pressed (True if not pressed in last report)</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Keyboard<br />
| The USB keyboard device to check for<br />
|-<br />
! ScanCode<br />
| The keyboard scan code to check<br />
|-<br />
! Note<br />
| Caller must hold the keyboard lock<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBKeyboardCheckRepeated(Keyboard:PUSBKeyboardDevice; ScanCode:Byte):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the passed scan code was the last key pressed and if the repeat delay has expired</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Keyboard<br />
| The USB keyboard device to check for<br />
|-<br />
! ScanCode<br />
| The keyboard scan code to check<br />
|-<br />
! Note<br />
| Caller must hold the keyboard lock<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBKeyboardCheckReleased(Keyboard:PUSBKeyboardDevice; Report:PUSBKeyboardReport; ScanCode:Byte):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the passed scan code has been released (True if not pressed in current report)</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Keyboard<br />
| The USB keyboard device to check for<br />
|-<br />
! Report<br />
| The USB keyboard report to compare against (Current)<br />
|-<br />
! ScanCode<br />
| The keyboard scan code to check<br />
|-<br />
! Note<br />
| Caller must hold the keyboard lock<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBKeyboardDeviceSetLEDs(Keyboard:PUSBKeyboardDevice; LEDs:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the state of the LEDs for a USB keyboard device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Keyboard<br />
| The USB keyboard device to set the LEDs for<br />
|-<br />
! LEDs<br />
| The LED state to set (eg KEYBOARD_LED_NUMLOCK)<br />
|-<br />
! Return<br />
| USB_STATUS_SUCCESS if completed or another USB error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBKeyboardDeviceSetIdle(Keyboard:PUSBKeyboardDevice; Duration,ReportId:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the idle duration (Time between reports when no changes) for a USB keyboard device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Keyboard<br />
| The USB keyboard device to set the idle duration for<br />
|-<br />
! Duration<br />
| The idle duration to set (Milliseconds divided by 4)<br />
|-<br />
! ReportId<br />
| The report Id to set the idle duration for (eg USB_HID_REPORTID_NONE)<br />
|-<br />
! Return<br />
| USB_STATUS_SUCCESS if completed or another USB error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBKeyboardDeviceSetProtocol(Keyboard:PUSBKeyboardDevice; Protocol:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the report protocol for a USB keyboard device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Keyboard<br />
| The USB keyboard device to set the report protocol for<br />
|-<br />
! Protocol<br />
| The report protocol to set (eg USB_HID_PROTOCOL_BOOT)<br />
|-<br />
! Return<br />
| USB_STATUS_SUCCESS if completed or another USB error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBKeyboardDeviceGetHIDDescriptor(Keyboard:PUSBKeyboardDevice; Descriptor:PUSBHIDDescriptor):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the HID Descriptor for a USB keyboard device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Keyboard<br />
| The USB keyboard device to get the descriptor for<br />
|-<br />
! Descriptor<br />
| Pointer to a USB HID Descriptor structure for the returned data<br />
|-<br />
! Descriptor<br />
| USB_STATUS_SUCCESS if completed or another USB error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBKeyboardDeviceGetReportDescriptor(Keyboard:PUSBKeyboardDevice; Descriptor:Pointer; Size:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the Report Descriptor for a USB keyboard device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Keyboard<br />
| The USB keyboard device to get the descriptor for<br />
|-<br />
! Descriptor<br />
| Pointer to a buffer to return the USB Report Descriptor<br />
|-<br />
! Size<br />
| The size in bytes of the buffer pointed to by Descriptor<br />
|-<br />
! Return<br />
| USB_STATUS_SUCCESS if completed or another USB error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
Return to [[Unit_Reference|Unit Reference]]</div>
Ultibo
https://ultibo.org/wiki/Unit_HIDTOUCH
Unit HIDTOUCH
2022-11-11T04:24:35Z
<p>Ultibo: </p>
<hr />
<div>Return to [[Unit_Reference|Unit Reference]]<br />
<br />
<br />
=== Description ===<br />
----<br />
<br />
'''Ultibo HID Touch Consumer unit'''<br />
<br />
'''HID Touch'''<br />
<br />
This is a consumer for any generic HID touch screen, it accepts HID application collections in the digitizer device page (HID_PAGE_DIGITIZERS) with the usage set to touch screen (HID_DIGITIZERS_TOUCH_SCREEN).<br />
<br />
The consumer will bind to any touch collection that implements at a minimum the X and Y axis and the tip switch. The event data for in range, confidence, width and height are not currently reported but may be added if required.<br />
<br />
To prevent the HID mouse consumer from binding to touch screen devices that also include a mouse collection, this consumer sets the HID_MOUSE_REJECT_TOUCH variable to True during initialization.<br />
<br />
=== Constants ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID touch specific constants''' <code> HID_TOUCH_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>HID_TOUCH_CONSUMER_NAME = 'HID Touch Consumer';</code><br />
| Name of HID Touch consumer<br />
|-<br />
| <code>HID_TOUCH_DESCRIPTION = 'HID Touch';</code><br />
| Description of HID Touch device<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Type definitions ===<br />
----<br />
<br />
<br />
'''HID touch point'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDTouchPoint = ^THIDTouchPoint;</code><br />
<br />
<code>THIDTouchPoint = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>X:LongWord;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>Y:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>Width:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>Height:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>Pressure:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>TipSwitch:Boolean;</code><br />
| &nbsp;<br />
|-<br />
| <code>InRange:Boolean;</code><br />
| &nbsp;<br />
|-<br />
| <code>Confidence:Boolean;</code><br />
| &nbsp;<br />
|-<br />
| <code>Identifier:LongWord;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID touch points''' <br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDTouchPoints = ^THIDTouchPoints;</code><br />
<br />
<code>THIDTouchPoints = array[0..0] of THIDTouchPoint;</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| &nbsp;<br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID touch device'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDTouchDevice = ^THIDTouchDevice;</code><br />
<br />
<code>THIDTouchDevice = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|''Touch Properties''<br />
|-<br />
| <code>Touch:TTouchDevice;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|''General Properties''<br />
|-<br />
| <code>MaxX:LongWord;</code><br />
| Maximum X value from current configuration<br />
|-<br />
| <code>MaxY:LongWord;</code><br />
| Maximum Y value from current configuration<br />
|-<br />
| <code>MaxZ:LongWord;</code><br />
| Maximum Z value from current configuration<br />
|-<br />
| <code>MaxWidth:LongWord;</code><br />
| Maximum width value from current configuration<br />
|-<br />
| <code>MaxHeight:LongWord;</code><br />
| Maximum height value from current configuration<br />
|-<br />
| <code>MaxPoints:LongWord;</code><br />
| Maximum touch points for this device<br />
|-<br />
| <code>LastCount:LongWord;</code><br />
| Number of touch points for last touch report<br />
|-<br />
| <code>LastPoints:PHIDTouchPoints;</code><br />
| Touch points for last touch report<br />
|-<br />
| <code>TouchPoints:PHIDTouchPoints;</code><br />
| Touch points for current touch report<br />
|-<br />
| <code>FirstIdentifier:LongWord;</code><br />
| Id number of first touch point identifier<br />
|-<br />
|colspan="2"|''HID Properties''<br />
|-<br />
| <code>Timer:TTimerHandle;</code><br />
| Handle for touch release timer<br />
|-<br />
| <code>Collection:PHIDCollection;</code><br />
| The HID collection this touch is bound to<br />
|-<br />
| <code>Definitions:PHIDDefinition;</code><br />
| The input report definitions that can be accepted as touch reports<br />
|-<br />
| <code>FeatureDefinition:PHIDDefinition;</code><br />
| The report definition that corresponds to the maximum contact count feature<br />
|-<br />
|}<br />
</div></div> <br />
<br /><br />
<br />
=== Public variables ===<br />
----<br />
<br />
''None defined''<br />
<br />
=== Function declarations ===<br />
----<br />
<br />
<br />
'''Initialization functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure HIDTouchInit;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the HID Touch unit and HID Touch driver</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Called only during system startup<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''HID touch functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDTouchStart(Touch:PTouchDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of TouchDeviceStart API for HID Touch device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Not intended to be called directly by applications, use TouchDeviceStart instead.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDTouchStop(Touch:PTouchDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of TouchDeviceStop API for HID Touch device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Not intended to be called directly by applications, use TouchDeviceStop instead.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDTouchUpdate(Touch:PTouchDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of TouchDeviceUpdate API for HID Touch device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Not intended to be called directly by applications, use TouchDeviceUpdate instead.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''HID touch helper functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDTouchCheckCollection(Collection:PHIDCollection):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if a HID collection is suitable for use as a touch device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDTouchCheckInputDefinition(Definition:PHIDDefinition):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if a HID definition is suitable for use as a touch input report</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDTouchCheckFeatureDefinition(Definition:PHIDDefinition):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if a HID definition is suitable for use as a touch feature report</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| A touch feature report is commonly used to report the maximum number of contacts<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
Return to [[Unit_Reference|Unit Reference]]</div>
Ultibo
https://ultibo.org/wiki/TShellPing
TShellPing
2022-11-02T05:40:57Z
<p>Ultibo: </p>
<hr />
<div>Return to [[Unit_ShellNetwork|Unit ShellNetwork]]<br />
<br />
<br />
__TOC__<br />
<br />
=== Description ===<br />
----<br />
<br />
''To be documented''<br />
<br />
=== Class definitions ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<br />
<code>TShellPing = class(TShellCommand)</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div><br />
|-<br />
| <code>constructor Create;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div><br />
|-<br />
| <code>function PingErrorToDescription(AErrorCode:LongInt):String;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>procedure PingSuccess(AShell:TShell; ASession:TShellSession; AClient:TPingClient);</code><br />
| &nbsp;<br />
|-<br />
| <code>procedure PingFailure(AShell:TShell; ASession:TShellSession; AClient:TPingClient);</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div><br />
|-<br />
| <code>function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;</code><br />
| &nbsp; <br />
|-<br />
| <code>function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;</code><br />
| &nbsp;<br />
|-<br />
| <code>function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Function declarations ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">constructor TShellPing.Create;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function TShellPing.PingErrorToDescription(AErrorCode:LongInt):String;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure TShellPing.PingSuccess(AShell:TShell; ASession:TShellSession; AClient:TPingClient);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure TShellPing.PingFailure(AShell:TShell; ASession:TShellSession; AClient:TPingClient);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function TShellPing.DoHelp(AShell:TShell; ASession:TShellSession):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function TShellPing.DoInfo(AShell:TShell; ASession:TShellSession):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function TShellPing.DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
Return to [[Unit_Reference|Unit Reference]]</div>
Ultibo
https://ultibo.org/wiki/Unit_ShellNetwork
Unit ShellNetwork
2022-11-02T04:53:56Z
<p>Ultibo: </p>
<hr />
<div>Return to [[Unit_Reference|Unit Reference]]<br />
<br />
<br />
=== Description ===<br />
----<br />
<br />
'''Ultibo Network Shell Extension unit'''<br />
<br />
=== Constants ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''Shell network command constants''' <code> SHELL_NET_COMMAND_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>SHELL_NET_COMMAND_NET = 'NET';</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>SHELL_NET_COMMAND_PING = 'PING';</code><br />
| &nbsp;<br />
|-<br />
| <code>SHELL_NET_COMMAND_IPCONFIG = 'IPCONFIG';</code><br />
| &nbsp;<br />
|-<br />
| <code>SHELL_NET_COMMAND_IFCONFIG = 'IFCONFIG';</code><br />
| &nbsp;<br />
|-<br />
| <code>SHELL_NET_COMMAND_IFUP = 'IFUP';</code><br />
| &nbsp;<br />
|-<br />
| <code>SHELL_NET_COMMAND_IFDOWN = 'IFDOWN';</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''Shell network action constants''' <code> SHELL_NET_ACTION_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>SHELL_NET_ACTION_LIST = 'LIST';</code><br />
| &nbsp;<br />
|-<br />
| <code>SHELL_NET_ACTION_SHOW = 'SHOW';</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>SHELL_NET_ACTION_START= 'START';</code><br />
| Adapter only<br />
|-<br />
| <code>SHELL_NET_ACTION_STOP = 'STOP';</code><br />
| Adapter only<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>SHELL_NET_ACTION_ADD = 'ADD';</code><br />
| ARP/IP/ROUTE only<br />
|-<br />
| <code>SHELL_NET_ACTION_DELETE = 'DELETE';</code><br />
| ARP/IP/ROUTE only<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>SHELL_NET_ACTION_FLUSH = 'FLUSH';</code><br />
| ARP only<br />
|-<br />
| <code>SHELL_NET_ACTION_SEND = 'SEND';</code><br />
| ARP only<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>SHELL_NET_ACTION_RELEASE = 'RELEASE';</code><br />
| IP only<br />
|-<br />
| <code>SHELL_NET_ACTION_RENEW = 'RENEW';</code><br />
| IP only<br />
|-<br />
| <code>SHELL_NET_ACTION_CONFIG = 'CONFIG';</code><br />
| IP only<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''Shell network item constants''' <code> SHELL_NET_ITEM_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>SHELL_NET_ITEM_ALL = 'ALL';</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>SHELL_NET_ITEM_ARP = 'ARP';</code><br />
| &nbsp;<br />
|-<br />
| <code>SHELL_NET_ITEM_IP = 'IP';</code><br />
| &nbsp;<br />
|-<br />
| <code>SHELL_NET_ITEM_ROUTE = 'ROUTE';</code><br />
| &nbsp;<br />
|-<br />
| <code>SHELL_NET_ITEM_ADAPTER = 'ADAPTER';</code><br />
| &nbsp;<br />
|-<br />
| <code>SHELL_NET_ITEM_TRANSPORT = 'TRANSPORT';</code><br />
| &nbsp;<br />
|-<br />
| <code>SHELL_NET_ITEM_PROTOCOL = 'PROTOCOL';</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Type definitions ===<br />
----<br />
<br />
''None defined''<br />
<br />
=== Class definitions ===<br />
----<br />
<br />
<br />
'''Shell Ping classes'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| [[TShellPing|<code>TShellPing = class(TShellCommand)</code>]]<br />
|-<br />
|}<br />
<br /><br />
<br />
=== Public variables ===<br />
----<br />
<br />
''None defined''<br />
<br />
=== Function declarations ===<br />
----<br />
<br />
<br />
'''Initialization functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure ShellNetworkInit;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
Return to [[Unit_Reference|Unit Reference]]</div>
Ultibo
https://ultibo.org/wiki/Unit_USBHID
Unit USBHID
2022-10-14T05:00:55Z
<p>Ultibo: </p>
<hr />
<div>Return to [[Unit_Reference|Unit Reference]]<br />
<br />
<br />
=== Description ===<br />
----<br />
<br />
'''Ultibo USB Human Interface Device (HID) Driver unit'''<br />
<br />
The USB Human Interface Device (HID) class is one of the most widely used classes of USB devices. HID devices can appear as keyboard, mice, touch devices, gamepads, joysticks and many more.<br />
<br />
Importantly HID devices can appear as controls within other devices, for example a USB headset can describe the volume and mute buttons as a HID device and a generic driver can recognize it without the need for a custom driver.<br />
<br />
Unlike other USB devices where either an entire device or an interface on a device is used to provide a specific function, the HID standard allows multiple devices to coexist on the same interface. So a mouse and keyboard could be defined on a single USB interface and the HID implementation is able to route the reports they generate to the correct consumer.<br />
<br />
Some HID devices (such as proprietary game devices) may require more specific handling than can be provided by the generic device infrastructure included in this unit.<br />
<br />
In those cases a standard USB driver can be developed which claims the entire device by vendor and product (as USB offers the complete device to all drivers first). The driver can then configure the device as required and is able to use some of the services of both this unit and the HID unit to parse and examine the HID report descriptors.<br />
<br />
Alternatively a HID consumer can be developed that claims the HID device during the optional HID DeviceBind callback which prevents other consumers from binding to the HID collections it contains. The consumer can then use some or all of the services of this unit and the HID unit to handle the HID report descriptors when dealing with reports received from the device.<br />
<br />
=== Constants ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''USB HID specific constants''' <code> USB_HID_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>USB_HID_DRIVER_NAME = 'USB HID Driver';</code><br />
| Name of USB HID driver<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Type definitions ===<br />
----<br />
<br />
<br />
'''USB HID request'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PUSBHIDRequest = ^TUSBHIDRequest;</code><br />
<br />
<code>TUSBHIDRequest = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>Collection:PHIDCollection;</code><br />
| The collection this request corresponds to<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''USB HID requests'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PUSBHIDRequests = ^TUSBHIDRequests;</code><br />
<br />
<code>TUSBHIDRequests = array[0..0] of PUSBHIDRequest;</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| &nbsp;<br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|}<br />
</div></div> <br />
<br />
'''USB HID device'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PUSBHIDDevice = ^TUSBHIDDevice;</code><br />
<br />
<code>TUSBHIDDevice = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|''HID Properties''<br />
|-<br />
| <code>HID:THIDDevice;</code><br />
| The HID entry for this USB Device<br />
|-<br />
|colspan="2"|''USB Properties''<br />
|-<br />
| <code>USBDevice:PUSBDevice;</code><br />
| The USB device<br />
|-<br />
| <code>USBInterface:PUSBInterface;</code><br />
| The USB interface<br />
|-<br />
| <code>HIDDescriptor:PHIDDescriptor;</code><br />
| The USB HID descriptor from the interface<br />
|-<br />
|colspan="2"|''Driver Properties''<br />
|-<br />
| <code>ReportActive:LongWord;</code><br />
| The number of currently active report requests<br />
|-<br />
| <code>ReportMaxId:LongWord;</code><br />
| The maximum report id number this device supports<br />
|-<br />
| <code>ReportMaxSize:LongWord;</code><br />
| The maximum report size in bytes this device sends<br />
|-<br />
| <code>ReportRequests:PUSBHIDRequests;</code><br />
| Active input report requests from consumers<br />
|-<br />
| <code>ReportEndpoint:PUSBEndpointDescriptor;</code><br />
| The USB endpoint for receiving input reports<br />
|-<br />
| <code>OutputEndpoint:PUSBEndpointDescriptor;</code><br />
| The USB endpoint for receiving ouput reports<br />
|-<br />
| <code>PendingCount:LongWord;</code><br />
| Number of USB requests pending for this HID device<br />
|-<br />
| <code>WaiterThread:TThreadId;</code><br />
| Thread waiting for pending requests to complete (for device detachment)<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Public variables ===<br />
----<br />
<br />
''None defined''<br />
<br />
=== Function declarations ===<br />
----<br />
<br />
<br />
'''Initialization functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure USBHIDInit;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the USB HID unit and USB HID driver</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Called only during system startup<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''USB HID helper functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBHIDCheckDevice(Device:PUSBDevice):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the supplied USB device is suitable for detection as a USB HID Device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The USB device to check<br />
|-<br />
! Return<br />
| True if the device is suitable or False if it is not<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBHIDCheckInterface(Device:PUSBDevice; Interrface:PUSBInterface):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the supplied USB device and interface are a USB HID Device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The USB device to check<br />
|-<br />
! Interrface<br />
| The USB interface to check<br />
|-<br />
! Return<br />
| True if the device and interface are a USB HID or False if not<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBHIDGetHIDDescriptor(Device:PUSBDevice; Interrface:PUSBInterface; Descriptor:PHIDDescriptor):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the HID Descriptor for a USB device and interface</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The USB device to get the descriptor for<br />
|-<br />
! Descriptor<br />
| Pointer to a USB HID Descriptor structure for the returned data<br />
|-<br />
! Return<br />
| USB_STATUS_SUCCESS if completed or another USB error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBHIDStatusToErrorCode(Status:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Convert a USB_STATUS_* code to an ERROR_* code</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function USBHIDErrorCodeToUSBStatus(Error:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Convert an ERROR_* code to a USB_STATUS_* code</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
Return to [[Unit_Reference|Unit Reference]]</div>
Ultibo
https://ultibo.org/wiki/Unit_HID
Unit HID
2022-10-14T05:00:37Z
<p>Ultibo: </p>
<hr />
<div>Return to [[Unit_Reference|Unit Reference]]<br />
<br />
<br />
=== Description ===<br />
----<br />
<br />
'''Ultibo Human Interface Device (HID) Interface unit'''<br />
<br />
The Human Interface Device (HID) class is intended to provide a flexible model that allows a wide range of control types to be expressed using a standard set of tags in a report descriptor that each device provides during initialization.<br />
<br />
HID devices can represent common items such as mice, keyboards, touchscreens, gamepads and joysticks but can also appear as controls within many other types of devices.<br />
<br />
A headset for example will primarily be an audio device but the volume and mute buttons can be defined using the HID standard and easily recognized by software without requiring a custom driver for each and every device.<br />
<br />
The Ultibo HID implementation creates an intermediate device layer that is mostly agnostic to both the bus type being used by an underlying provider (such as USB) and the devices recognized by HID consumers such as mice and keyboards.<br />
<br />
A provider such as USB HID locates devices from the provider specific bus and creates HID devices to represent them along with obtaining report descriptors and other information.<br />
<br />
These HID devices are then passed to registered HID consumers (drivers) to determine if they recognize the collections, reports and usages described by the device. A consumer can accept a device and bind to it during this process and create its own devices to represent the functionality described by the HID device.<br />
<br />
While HID itself is intended to be bus agnostic this implementation is based heavily on the USB HID standards as those are the most widely adopted at this time. It is anticipated that HID adoption will expand over time to include a range other bus types, Bluetooth is already using HID and there are existing implementations of HID over I2C, SPI and PCI.<br />
<br />
Expanding the Ultibo HID support to other bus types simply requires a new HID provider for that bus to be written along with any necessary changes or extensions to the HID layer itself.<br />
<br />
=== Constants ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID specific constants''' <code> HID_NAME_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>HID_NAME_PREFIX = 'HID';</code><br />
| Name prefix for HID Devices<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID device type''' <code> HID_TYPE_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>HID_TYPE_NONE = 0;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>HID_TYPE_USB = 1;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_TYPE_MAX = 1;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''HID device type name''<br />
|-<br />
|colspan="2"|<code>HID_TYPE_NAMES:array[HID_TYPE_NONE..HID_TYPE_MAX] of String = (</code><br />
|-<br />
| <code>'HID_TYPE_NONE',</code><br />
| &nbsp;<br />
|-<br />
| <code>'HID_TYPE_USB');</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID device state''' <code> HID_STATE_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>HID_STATE_DETACHED = 0;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>HID_STATE_DETACHING = 1;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_STATE_ATTACHING = 2;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_STATE_ATTACHED = 3;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_STATE_MAX = 3;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|''HID device state name''<br />
|-<br />
|colspan="2"|<code>HID_STATE_NAMES:array[HID_STATE_DETACHED..HID_STATE_MAX] of String = (</code><br />
|-<br />
| <code>'HID_STATE_DETACHED',</code><br />
| &nbsp;<br />
|-<br />
| <code>'HID_STATE_DETACHING',</code><br />
| &nbsp;<br />
|-<br />
| <code>'HID_STATE_ATTACHING',</code><br />
| &nbsp;<br />
|-<br />
| <code>'HID_STATE_ATTACHED');</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID device flag''' <code> HID_FLAG_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>HID_FLAG_NONE = $00000000;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID interface subclass''' <code> HID_SUBCLASS_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See USB HID v1.11 specification (Section 4.2)<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_SUBCLASS_NONE = 0;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>HID_SUBCLASS_BOOT = 1;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID interface protocol''' <code> HID_BOOT_PROTOCOL_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See USB HID v1.11 specification (Section 4.3)<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_BOOT_PROTOCOL_NONE = 0;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>HID_BOOT_PROTOCOL_KEYBOARD = 1;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_BOOT_PROTOCOL_MOUSE = 2;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID class descriptor''' <code> HID_DESCRIPTOR_TYPE* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See USB HID v1.11 specification (Section 7.1)<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_DESCRIPTOR_TYPE_HID = $21;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>HID_DESCRIPTOR_TYPE_REPORT = $22;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_DESCRIPTOR_TYPE_PHYSICAL_DESCRIPTOR = $23;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID request''' <code> HID_REQUEST_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 7.2<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_REQUEST_GET_REPORT = $01;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>HID_REQUEST_GET_IDLE = $02;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_REQUEST_GET_PROTOCOL = $03;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_REQUEST_SET_REPORT = $09;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_REQUEST_SET_IDLE = $0A;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_REQUEST_SET_PROTOCOL = $0B;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID protocol''' <code> HID_PROTOCOL_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 7.2.5<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_PROTOCOL_BOOT = 0;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>HID_PROTOCOL_REPORT = 1;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID report''' <code> HID_REPORT_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 7.2.1<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_REPORT_INPUT = 1;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>HID_REPORT_OUTPUT = 2;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_REPORT_FEATURE = 3;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID report ID''' <code> HID_REPORTID_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 7.2.1 <br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_REPORTID_NONE = 0;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID item size''' <code> HID_SIZE_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 6.2.2.2 <br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_SIZE_0 = (0 shl 0);</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>HID_SIZE_1 = (1 shl 0);</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_SIZE_2 = (2 shl 0);</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_SIZE_4 = (3 shl 0);</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_SIZE_MASK = $03;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID item type''' <code> HID_TYPE_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 6.2.2.2 <br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_TYPE_MAIN = (0 shl 2);</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>HID_TYPE_GLOBAL = (1 shl 2);</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_TYPE_LOCAL = (2 shl 2);</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_TYPE_RESERVED = (3 shl 2);</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_TYPE_MASK = $0C;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID main item tag''' <code> HID_TAG_MAIN_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 6.2.2.1 and Section 6.2.2.4 <br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_TAG_MAIN_INPUT = $80;</code><br />
| Input<br />
|-<br />
| <code>HID_TAG_MAIN_OUTPUT = $90;</code><br />
| Output<br />
|-<br />
| <code>HID_TAG_MAIN_FEATURE = $B0;</code><br />
| Feature<br />
|-<br />
| <code>HID_TAG_MAIN_COLLECTION = $A0;</code><br />
| Collection<br />
|-<br />
| <code>HID_TAG_MAIN_END_COLLECTION = $C0;</code><br />
| End Collection<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID global item tag''' <code> HID_TAG_GLOBAL_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 6.2.2.7 <br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_TAG_GLOBAL_USAGE_PAGE = $04;</code><br />
| Usage Page<br />
|-<br />
| <code>HID_TAG_GLOBAL_LOGICAL_MINIMUM = $14;</code><br />
| Logical Minimum<br />
|-<br />
| <code>HID_TAG_GLOBAL_LOGICAL_MAXIMUM = $24;</code><br />
| Logical Maximum<br />
|-<br />
| <code>HID_TAG_GLOBAL_PHYSICAL_MINIMUM = $34;</code><br />
| Physical Minimum<br />
|-<br />
| <code>HID_TAG_GLOBAL_PHYSICAL_MAXIMUM = $44;</code><br />
| Physical Maximum<br />
|-<br />
| <code>HID_TAG_GLOBAL_UNIT_EXPONENT = $54;</code><br />
| Unit Exponent<br />
|-<br />
| <code>HID_TAG_GLOBAL_UNIT = $64;</code><br />
| Unit<br />
|-<br />
| <code>HID_TAG_GLOBAL_REPORT_SIZE = $74;</code><br />
| Report Size<br />
|-<br />
| <code>HID_TAG_GLOBAL_REPORT_ID = $84;</code><br />
| Report ID<br />
|-<br />
| <code>HID_TAG_GLOBAL_REPORT_COUNT = $94;</code><br />
| Report Count<br />
|-<br />
| <code>HID_TAG_GLOBAL_PUSH = $A4;</code><br />
| Push<br />
|-<br />
| <code>HID_TAG_GLOBAL_POP = $B4;</code><br />
| Pop<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID local item tag ''' <code> HID_TAG_LOCAL_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 6.2.2.8 <br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_TAG_LOCAL_USAGE = $08;</code><br />
| Usage<br />
|-<br />
| <code>HID_TAG_LOCAL_USAGE_MINIMUM = $18;</code><br />
| Usage Minimum<br />
|-<br />
| <code>HID_TAG_LOCAL_USAGE_MAXIMUM = $28;</code><br />
| Usage Maximum<br />
|-<br />
| <code>HID_TAG_LOCAL_DESIGNATOR_INDEX = $38;</code><br />
| Designator Index<br />
|-<br />
| <code>HID_TAG_LOCAL_DESIGNATOR_MINIMUM = $48;</code><br />
| Designator Minimum<br />
|-<br />
| <code>HID_TAG_LOCAL_DESIGNATOR_MAXIMUM = $58;</code><br />
| Designator Maximum<br />
|-<br />
| <code>HID_TAG_LOCAL_STRING_INDEX = $78;</code><br />
| String Index<br />
|-<br />
| <code>HID_TAG_LOCAL_STRING_MINIMUM = $88;</code><br />
| String Minimum<br />
|-<br />
| <code>HID_TAG_LOCAL_STRING_MAXIMUM = $98;</code><br />
| String Maximum<br />
|-<br />
| <code>HID_TAG_LOCAL_DELIMITER = $A8;</code><br />
| Delimiter<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_TAG_LONG = $FC;</code><br />
| Always HID_SIZE_2 (Followed by 1 byte DataSize / 1 byte LongItemTag / n bytes Data)<br />
|-<br />
| <code>HID_TAG_MASK = $FC;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID main item input, ouput and feature''' <code> HID_MAIN_ITEM_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 6.2.2.5 <br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_MAIN_ITEM_CONSTANT = (1 shl 0);</code><br />
| Data (0) | Constant (1)<br />
|-<br />
| <code>HID_MAIN_ITEM_VARIABLE = (1 shl 1);</code><br />
| Array (0) | Variable (1)<br />
|-<br />
| <code>HID_MAIN_ITEM_RELATIVE = (1 shl 2);</code><br />
| Absolute (0) | Relative (1)<br />
|-<br />
| <code>HID_MAIN_ITEM_WRAP = (1 shl 3);</code><br />
| No Wrap (0) | Wrap (1)<br />
|-<br />
| <code>HID_MAIN_ITEM_NON_LINEAR = (1 shl 4);</code><br />
| Linear (0) | Non Linear (1)<br />
|-<br />
| <code>HID_MAIN_ITEM_NO_PREFERRED = (1 shl 5);</code><br />
| Preferred State (0) | No Preferred (1)<br />
|-<br />
| <code>HID_MAIN_ITEM_NULL_STATE = (1 shl 6);</code><br />
| No Null position (0) | Null state(1)<br />
|-<br />
| <code>HID_MAIN_ITEM_RESERVED1 = (1 shl 7);</code><br />
| Reserved (0)<br />
|-<br />
| <code>HID_MAIN_ITEM_BUFFERED_BYTES = (1 shl 8);</code><br />
| Bit Field (0) | Buffered Bytes (1)<br />
|-<br />
| <code>HID_MAIN_ITEM_RESERVED2 = ($FFFFFE00 shl 9);</code><br />
| Reserved (0)<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID main item collection''' <code> HID_MAIN_COLLECTION_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 6.2.2.6 <br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_MAIN_COLLECTION_PHYSICAL = $00;</code><br />
| Physical (Group of axes)<br />
|-<br />
| <code>HID_MAIN_COLLECTION_APPLICATION = $01;</code><br />
| Application (Mouse, Keyboard)<br />
|-<br />
| <code>HID_MAIN_COLLECTION_LOGICAL = $02;</code><br />
| Logical (Interrelated data)<br />
|-<br />
| <code>HID_MAIN_COLLECTION_REPORT = $03;</code><br />
| Report<br />
|-<br />
| <code>HID_MAIN_COLLECTION_NAMED_ARRAY = $04;</code><br />
| Named Array<br />
|-<br />
| <code>HID_MAIN_COLLECTION_USAGE_SWITCH = $05;</code><br />
| Usage Switch<br />
|-<br />
| <code>HID_MAIN_COLLECTION_USAGE_MODIFIER = $06;</code><br />
| Usage Modifier<br />
|-<br />
|colspan="2"|''0x07 to 0x7F Reserved'' <br />
|-<br />
|colspan="2"|''0x80 to 0xFF Vendor Defined'' <br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID global item unit''' <code> HID_GLOBAL_UNIT_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 6.2.2.7 For more information see https://physics.nist.gov/cuu/Units/units.html <br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SYSTEM_MASK = $F;</code><br />
| System of Measurement<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SYSTEM_SHIFT = 0;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SYSTEM_NONE = 0;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SYSTEM_SI_LINEAR = 1;</code><br />
| SI linear unit<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SYSTEM_SI_ROTATION = 2;</code><br />
| SI rotational units<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SYSTEM_ENGLISH_LINEAR = 3;</code><br />
| English (Imperial) linear units<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SYSTEM_ENGLISH_ROTATION = 4;</code><br />
| English (Imperial) rotational units<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_GLOBAL_UNIT_LENGTH_MASK = $F;</code><br />
| Length (Centimeters in SI, Inches in English)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_LENGTH_SHIFT = 4;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_GLOBAL_UNIT_ROTATION_MASK = $F;</code><br />
| Rotation (Radians in SI, Degrees in English)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_ROTATION_SHIFT = 4;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_GLOBAL_UNIT_MASS_MASK = $F;</code><br />
| Mass (Grams in SI, Slugs in English)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_MASS_SHIFT = 8;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_GLOBAL_UNIT_TIME_MASK = $F;</code><br />
| Time (Seconds)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_TIME_SHIFT = 12;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_GLOBAL_UNIT_TEMPERATURE_MASK = $F;</code><br />
| Temperature (Kelvin in SI, Fahrenheit in English)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_TEMPERATURE_SHIFT = 16;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_GLOBAL_UNIT_CURRENT_MASK = $F;</code><br />
| Current (Amperes)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_CURRENT_SHIFT = 20;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_GLOBAL_UNIT_LIGHT_MASK = $F;</code><br />
| Luminous Intensity (Candelas)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_LIGHT_SHIFT = 24;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|Common HID Global Item Unit Value<br />
|-<br />
|colspan="2"|For a more detailed list see the k.0UNIT definitions in https://github.com/abend0c1/hidrdd/blob/master/rd.rex<br />
|-<br />
|colspan="2"|''SI Base Units''<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SI_ROTATION = $00000012;</code><br />
| Rotation (Radians)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SI_LENGTH = $00000011;</code><br />
| Length (Centimeters)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SI_MASS = $00000101;</code><br />
| Mass (Grams)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SI_TIME = $00001001;</code><br />
| Time (Seconds)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SI_TEMPERATURE = $00010001;</code><br />
| Temperature (Kelvin)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SI_CURRENT = $00100001;</code><br />
| Current (Amperes)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SI_LIGHT = $01000001;</code><br />
| Luminous Intensity (Candelas)<br />
|-<br />
|colspan="2"|''SI Derived Unit''<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SI_AREA = $00000021;</code><br />
| Area (Square Centimeters)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SI_VOLUME = $00000031;</code><br />
| Volume (Cubic Centimeters)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SI_VELOCITY = $0000F011;</code><br />
| Velocity (Centimeters per second)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SI_ACCELERATION = $0000E011;</code><br />
| Acceleration (Centimeters per second squared)<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SI_FREQUENCY = $0000F001;</code><br />
| Frequency (Hertz)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SI_FORCE = $0000E111;</code><br />
| Force (Newtons)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SI_PRESSURE = $0000E1F1;</code><br />
| Pressure (Pascals)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SI_ENERGY = $0000E121;</code><br />
| Energy (Joules)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_SI_POWER = $0000D121;</code><br />
| Power (Watts)<br />
|-<br />
|colspan="2"|''English Base Unit''<br />
|-<br />
| <code>HID_GLOBAL_UNIT_ENGLISH_ROTATION = $00000014;</code><br />
| Rotation (Degrees)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_ENGLISH_LENGTH = $00000013;</code><br />
| Length (Inches)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_ENGLISH_TIME = $00001003;</code><br />
| Time (Seconds)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_ENGLISH_TEMPERATURE = $00010003;</code><br />
| Temperature (Fahrenheit)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_ENGLISH_CURRENT = $00100003;</code><br />
| Current (Amperes)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_ENGLISH_LIGHT = $01000003;</code><br />
| Luminous Intensity (Candelas)<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_GLOBAL_UNIT_ENGLISH_AREA = $00000023;</code><br />
| Area (Square Inches)<br />
|-<br />
| <code>HID_GLOBAL_UNIT_ENGLISH_VOLUME = $00000033;</code><br />
| Volume (Cubic Inches)<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|HID Global Item Unit Exponent Values<br />
|-<br />
|colspan="2"|See Section 6.2.2.7<br />
|-<br />
|colspan="2"|HID_GLOBAL_UNIT_EXPONENTS:array[$0..$F] of LongInt = (<br />
|-<br />
| <code>0,</code><br />
| &nbsp;<br />
|-<br />
| <code>1,</code><br />
| &nbsp;<br />
|-<br />
| <code>2,</code><br />
| &nbsp;<br />
|-<br />
| <code>3,</code><br />
| &nbsp;<br />
|-<br />
| <code>4,</code><br />
| &nbsp;<br />
|-<br />
| <code>5,</code><br />
| &nbsp;<br />
|-<br />
| <code>6,</code><br />
| &nbsp;<br />
|-<br />
| <code>7,</code><br />
| &nbsp;<br />
|-<br />
| <code>-8,</code><br />
| &nbsp;<br />
|-<br />
| <code>-7,</code><br />
| &nbsp;<br />
|-<br />
| <code>-6,</code><br />
| &nbsp;<br />
|-<br />
| <code>-5,</code><br />
| &nbsp;<br />
|-<br />
| <code>-4,</code><br />
| &nbsp;<br />
|-<br />
| <code>-3,</code><br />
| &nbsp;<br />
|-<br />
| <code>-2,</code><br />
| &nbsp;<br />
|-<br />
| <code>-1);</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|colspan="2"|HID_GLOBAL_UNIT_MULTIPLIERS:array[$0..$F] of Double = (<br />
|-<br />
| <code>1,</code><br />
| 10^0<br />
|-<br />
| <code>10,</code><br />
| 10^1<br />
|-<br />
| <code>100,</code><br />
| 10^2<br />
|-<br />
| <code>1000,</code><br />
| 10^3<br />
|-<br />
| <code>10000,</code><br />
| 10^4<br />
|-<br />
| <code>100000,</code><br />
| 10^5<br />
|-<br />
| <code>1000000,</code><br />
| 10^6<br />
|-<br />
| <code>10000000,</code><br />
| 10^7<br />
|-<br />
| <code>0.00000001,</code><br />
| 10^-8<br />
|-<br />
| <code>0.0000001,</code><br />
| 10^-7<br />
|-<br />
| <code>0.000001,</code><br />
| 10^-6<br />
|-<br />
| <code>0.00001,</code><br />
| 10^-5<br />
|-<br />
| <code>0.0001,</code><br />
| 10^-4<br />
|-<br />
| <code>0.001,</code><br />
| 10^-3<br />
|-<br />
| <code>0.01,</code><br />
| 10^-2<br />
|-<br />
| <code>0.1);</code><br />
| 10^-1<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID local item delimiter''' <code> HID_LOCAL_DELIMITER_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 6.2.2.8 <br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_LOCAL_DELIMITER_CLOSE = 0;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>HID_LOCAL_DELIMITER_OPEN = 1;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID physical descriptor bias''' <code> HID_PHYSICAL_BIAS_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 6.2.3 <br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_PHYSICAL_BIAS_NONE = (0 shl 5);</code><br />
| Not applicable<br />
|-<br />
| <code>HID_PHYSICAL_BIAS_RIGHT_HAND = (1 shl 5);</code><br />
| Right hand<br />
|-<br />
| <code>HID_PHYSICAL_BIAS_LEFT_HAND = (2 shl 5);</code><br />
| Left hand<br />
|-<br />
| <code>HID_PHYSICAL_BIAS_BOTH_HANDS = (3 shl 5);</code><br />
| Both hands<br />
|-<br />
| <code>HID_PHYSICAL_BIAS_EITHER_HAND = (4 shl 5);</code><br />
| Either hand<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID physical descriptor designator ''' <code> HID_PHYSICAL_DESIGNATOR_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 6.2.3 <br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_NONE = $00;</code><br />
| None<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_HAND = $01;</code><br />
| Hand<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_EYEBALL = $02;</code><br />
| Eyeball<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_EYEBROW = $03;</code><br />
| Eyebrow<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_EYELID = $04;</code><br />
| Eyelid<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_EAR = $05;</code><br />
| Ear<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_NOSE = $06;</code><br />
| Nose<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_MOUTH = $07;</code><br />
| Mouth<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_UPPER_LIP = $08;</code><br />
| Upper lip<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_LOWER_LIP = $09;</code><br />
| Lower lip<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_JAW = $0A;</code><br />
| Jaw<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_NECK = $0B;</code><br />
| Neck<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_UPPER_ARM = $0C;</code><br />
| Upper arm<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_ELBOW = $0D;</code><br />
| Elbow<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_FOREARM = $0E;</code><br />
| Forearm<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_WRIST = $0F;</code><br />
| Wrist<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_PALM = $10;</code><br />
| Palm<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_THUMB = $11;</code><br />
| Thumb<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_INDEX_FINGER = $12;</code><br />
| Index finger<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_MIDDLE_FINGER = $13;</code><br />
| Middle finger<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_RING_FINGER = $14;</code><br />
| Ring finger<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_LITTLE_FINGER = $15;</code><br />
| Little finger<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_HEAD = $16;</code><br />
| Head<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_SHOULDER = $17;</code><br />
| Shoulder<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_HIP = $18;</code><br />
| Hip<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_WAIST = $19;</code><br />
| Waist<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_THIGH = $1A;</code><br />
| Thigh<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_KNEE = $1B;</code><br />
| Knee<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_CALF = $1C;</code><br />
| Calf<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_ANKLE = $1D;</code><br />
| Ankle<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_FOOT = $1E;</code><br />
| Foot<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_HEEL = $1F;</code><br />
| Heel<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_BALL_OF_FOOT = $20;</code><br />
| Ball of foot<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_BIG_TOE = $21;</code><br />
| Big toe<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_SECOND_TOE = $22;</code><br />
| Second toe<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_THIRD_TOE = $23;</code><br />
| Third toe<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_FOURTH_TOE = $24;</code><br />
| Fourth toe<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_LITTLE_TOE = $25;</code><br />
| Little toe<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_BROW = $26;</code><br />
| Brow<br />
|-<br />
| <code>HID_PHYSICAL_DESIGNATOR_CHEEK = $27;</code><br />
| Cheek<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID physical descriptor qualifier''' <code> HID_PHYSICAL_QUALIFIER_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 6.2.3 <br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_PHYSICAL_QUALIFIER_NONE = (0 shl 5);</code><br />
| Not applicable<br />
|-<br />
| <code>HID_PHYSICAL_QUALIFIER_RIGHT = (1 shl 5);</code><br />
| Right<br />
|-<br />
| <code>HID_PHYSICAL_QUALIFIER_LEFT = (2 shl 5);</code><br />
| Left<br />
|-<br />
| <code>HID_PHYSICAL_QUALIFIER_BOTH = (3 shl 5);</code><br />
| Both<br />
|-<br />
| <code>HID_PHYSICAL_QUALIFIER_EITHER = (4 shl 5);</code><br />
| Either<br />
|-<br />
| <code>HID_PHYSICAL_QUALIFIER_CENTER = (5 shl 5);</code><br />
| Center<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID usage page''' <code> HID_PAGE_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See HID Usage Tables 1.3<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>HID_PAGE_UNDEFINED = $00;</code><br />
| Undefined<br />
|-<br />
| <code>HID_PAGE_GENERIC_DESKTOP = $01;</code><br />
| Generic Desktop Page<br />
|-<br />
| <code>HID_PAGE_SIMULATION_CONTROLS = $02;</code><br />
| Simulation Controls Page<br />
|-<br />
| <code>HID_PAGE_VR_CONTROLS = $03;</code><br />
| VR Controls Page<br />
|-<br />
| <code>HID_PAGE_SPORT_CONTROLS = $04;</code><br />
| Sport Controls Page<br />
|-<br />
| <code>HID_PAGE_GAME_CONTROLS = $05;</code><br />
| Game Controls Page<br />
|-<br />
| <code>HID_PAGE_GENERIC_DEVICE_CONTROLS = $06;</code><br />
| Generic Device Controls Page<br />
|-<br />
| <code>HID_PAGE_KEYBOARD_KEYPAD = $07;</code><br />
| Keyboard/Keypad Page<br />
|-<br />
| <code>HID_PAGE_LED = $08;</code><br />
| LED Page<br />
|-<br />
| <code>HID_PAGE_BUTTON = $09;</code><br />
| Button Page<br />
|-<br />
| <code>HID_PAGE_ORDINAL = $0A;</code><br />
| Ordinal Page<br />
|-<br />
| <code>HID_PAGE_TELEPHONY_DEVICE = $0B;</code><br />
| Telephony Device Page<br />
|-<br />
| <code>HID_PAGE_CONSUMER = $0C;</code><br />
| Consumer Page<br />
|-<br />
| <code>HID_PAGE_DIGITIZERS = $0D;</code><br />
| Digitizers Page<br />
|-<br />
| <code>HID_PAGE_HAPTICS = $0E;</code><br />
| Haptics Page<br />
|-<br />
| <code>HID_PAGE_PHYSICAL_INPUT_DEVICE = $0F;</code><br />
| Physical Input Device Page<br />
|-<br />
| <code>HID_PAGE_UNICODE = $10;</code><br />
| Unicode Page<br />
|-<br />
|colspan="2"|''0x11-0x11 Reserved''<br />
|-<br />
| <code>HID_PAGE_EYE_AND_HEAD_TRACKERS = $12;</code><br />
| Eye and Head Trackers Page<br />
|-<br />
|colspan="2"|''0x13-0x13 Reserved''<br />
|-<br />
| <code>HID_PAGE_AUXILIARY_DISPLAY = $14;</code><br />
| Auxiliary Display Page<br />
|-<br />
|colspan="2"|''0x15-0x1F Reserved''<br />
|-<br />
| <code>HID_PAGE_SENSORS = $20;</code><br />
| Sensors Page<br />
|-<br />
|colspan="2"|''0x21-0x3F Reserved''<br />
|-<br />
| <code>HID_PAGE_MEDICAL_INSTRUMENT = $40;</code><br />
| Medical Instrument Page<br />
|-<br />
| <code>HID_PAGE_BRAILLE_DISPLAY = $41;</code><br />
| Braille Display Page<br />
|-<br />
|colspan="2"|''0x42-0x58 Reserved''<br />
|-<br />
| <code>HID_PAGE_LIGHTING_AND_ILLUMINATION = $59;</code><br />
| Lighting And Illumination Page<br />
|-<br />
|colspan="2"|''0x5A-0x7F Reserved''<br />
|-<br />
| <code>HID_PAGE_MONITOR = $80;</code><br />
| Monitor Page<br />
|-<br />
| <code>HID_PAGE_MONITOR_ENUMERATED = $81;</code><br />
| Monitor Enumerated Page<br />
|-<br />
| <code>HID_PAGE_VESA_VIRTUAL_CONTROLS = $82;</code><br />
| VESA Virtual Controls Page<br />
|-<br />
|colspan="2"|''0x83-0x83 Reserved''<br />
|-<br />
| <code>HID_PAGE_POWER = $84;</code><br />
| Power Page<br />
|-<br />
| <code>HID_PAGE_BATTERY_SYSTEM = $85;</code><br />
| Battery System Page<br />
|-<br />
|colspan="2"|''0x86-0x8B Reserved''<br />
|-<br />
| <code>HID_PAGE_BARCODE_SCANNER = $8C;</code><br />
| Barcode Scanner Page<br />
|-<br />
| <code>HID_PAGE_SCALES = $8D;</code><br />
| Scales Page<br />
|-<br />
| <code>HID_PAGE_MAGNETIC_STRIPE_READER = $8E;</code><br />
| Magnetic Stripe Reader Page<br />
|-<br />
|colspan="2"|''0x8F-0x8F Reserved''<br />
|-<br />
| <code>HID_PAGE_CAMERA_CONTROL = $90;</code><br />
| Camera Control Page<br />
|-<br />
| <code>HID_PAGE_ARCADE = $91;</code><br />
| Arcade Page<br />
|-<br />
| <code>HID_PAGE_GAMING_DEVICE = $92;</code><br />
| Gaming Device Page<br />
|-<br />
|colspan="2"|''0x93-0xF1CF Reserved<br />
|-<br />
| <code>HID_PAGE_FIDO_ALLIANCE = $F1D0;</code><br />
| FIDO Alliance Page<br />
|-<br />
|colspan="2"|''0xF1D1-0xFEFF Reserved''<br />
|-<br />
|colspan="2"|''0xFF00-0xFFFF Vendor-defined''<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID usage table''' <code> HID_DESKTOP_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See HID Usage Tables 1.3) <br />
|-<br />
|colspan="2"|HID Generic Desktop Page (Partial)<br />
|-<br />
| <code>HID_DESKTOP_UNDEFINED = $00;</code><br />
| Undefined<br />
|-<br />
| <code>HID_DESKTOP_POINTER = $01;</code><br />
| Pointer<br />
|-<br />
| <code>HID_DESKTOP_MOUSE = $02;</code><br />
| Mouse<br />
|-<br />
|colspan="2"|''0x03-0x03 Reserved''<br />
|-<br />
| <code>HID_DESKTOP_JOYSTICK = $04;</code><br />
| Joystick<br />
|-<br />
| <code>HID_DESKTOP_GAMEPAD = $05;</code><br />
| Gamepad<br />
|-<br />
| <code>HID_DESKTOP_KEYBOARD = $06;</code><br />
| Keyboard<br />
|-<br />
| <code>HID_DESKTOP_KEYPAD = $07;</code><br />
| Keypad<br />
|-<br />
| <code>HID_DESKTOP_MULTI_AXIS_CONTROLLER = $08;</code><br />
| Multi-axis Controller<br />
|-<br />
| <code>HID_DESKTOP_TABLET_PC_SYSTEM_CONTROLS = $09;</code><br />
| Tablet PC System Controls<br />
|-<br />
| <code>HID_DESKTOP_WATER_COOLING_DEVICE = $0A;</code><br />
| Water Cooling Device<br />
|-<br />
| <code>HID_ID_DESKTOP_COMPUTER_CHASSIS_DEVICE = $0B;</code><br />
| Computer Chassis Device<br />
|-<br />
| <code>HHID_DESKTOP_WIRELESS_RADIO_CONTROLS = $0C;</code><br />
| Wireless Radio Controls<br />
|-<br />
| <code>HID_DESKTOP_PORTABLE_DEVICE_CONTROL = $0D;</code><br />
| Portable Device Control<br />
|-<br />
| <code>HID_DESKTOP_SYSTEM_MULTI_AXIS_CONTROLLER = $0E;</code><br />
| System Multi-Axis Controller<br />
|-<br />
| <code>HID_DESKTOP_SPATIAL_CONTROLLER = $0F;</code><br />
| Spatial Controller<br />
|-<br />
| <code>HID_DESKTOP_ASSISTIVE_CONTROL = $10;</code><br />
| Assistive Control<br />
|-<br />
| <code>HID_DESKTOP_DEVICE_DOCK = $11;</code><br />
| Device Dock<br />
|-<br />
| <code>HID_DESKTOP_DOCKABLE_DEVICE = $12;</code><br />
| Dockable Device<br />
|-<br />
| <code>HID_DESKTOP_CALL_STATE_MANAGEMENT_CONTROL = $13;</code><br />
| Call State Management Control<br />
|-<br />
|colspan="2"|''0x14-0x2F Reserved''<br />
|-<br />
| <code>HID_DESKTOP_X = $30;</code><br />
| X<br />
|-<br />
| <code>HID_DESKTOP_Y = $31;</code><br />
| Y<br />
|-<br />
| <code>HID_DESKTOP_Z = $32;</code><br />
| Z<br />
|-<br />
| <code>HID_DESKTOP_RX = $33;</code><br />
| Rx<br />
|-<br />
| <code>HID_DESKTOP_RY = $34;</code><br />
| Ry<br />
|-<br />
| <code>HID_DESKTOP_RZ = $35;</code><br />
| Rz<br />
|-<br />
| <code>HID_DESKTOP_SLIDER = $36;</code><br />
| Slider<br />
|-<br />
| <code>HID_DESKTOP_DIAL = $37;</code><br />
| Dial<br />
|-<br />
| <code>HID_DESKTOP_WHEEL = $38;</code><br />
| Wheel<br />
|-<br />
| <code>HID_DESKTOP_HAT_SWITCH = $39;</code><br />
| Hat Switch<br />
|-<br />
| <code>HID_DESKTOP_COUNTED_BUFFER = $3A;</code><br />
| Counted Buffer<br />
|-<br />
| <code>HID_DESKTOP_BYTE_COUNT = $3B;</code><br />
| Byte Count<br />
|-<br />
| <code>HID_DESKTOP_MOTION_WAKEUP = $3C;</code><br />
| Motion Wakeup<br />
|-<br />
| <code>HID_DESKTOP_START = $3D;</code><br />
| Start<br />
|-<br />
| <code>HID_DESKTOP_SELECT = $3E;</code><br />
| Select<br />
|-<br />
|colspan="2"|''0x3F-0x3F Reserved<br />
|-<br />
| <code>HID_DESKTOP_VX = $40;</code><br />
| Vx<br />
|-<br />
| <code>HID_DESKTOP_VY = $41;</code><br />
| Vy<br />
|-<br />
| <code>HID_DESKTOP_VZ = $42;</code><br />
| Vz<br />
|-<br />
| <code>HID_DESKTOP_VBRX = $43;</code><br />
| Vbrx<br />
|-<br />
| <code>HID_DESKTOP_VBRY = $44;</code><br />
| Vbry<br />
|-<br />
| <code>HID_DESKTOP_VBRZ = $45;</code><br />
| Vbrz<br />
|-<br />
| <code>HID_DESKTOP_VNO = $46;</code><br />
| Vno<br />
|-<br />
| <code>HID_DESKTOP_FEATURE_NOTIFICATION = $47;</code><br />
| Feature Notification<br />
|-<br />
| <code>HID_DESKTOP_RESOLUTION_MULTIPLIER = $48;</code><br />
| Resolution Multiplier<br />
|-<br />
| <code>HID_DESKTOP_QX = $49;</code><br />
| Qx<br />
|-<br />
| <code>HID_DESKTOP_QY = $4A;</code><br />
| Qy<br />
|-<br />
| <code>HID_DESKTOP_QZ = $4B;</code><br />
| Qz<br />
|-<br />
| <code>HID_DESKTOP_QW = $4C;</code><br />
| Qw<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID keyboard/keypad''' <code> SCAN_CODE_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|Note: These are the same as the SCAN_CODE_* values in GlobalConst<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID LED (Partial)''' <code> HID_LED_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>HID_LED_UNDEFINED = 00;</code><br />
| Undefined<br />
|-<br />
| <code>HID_LED_NUM_LOCK = 01;</code><br />
| Num Lock<br />
|-<br />
| <code>HID_LED_CAPS_LOCK = 02;</code><br />
| Caps Lock<br />
|-<br />
| <code>HID_LED_SCROLL_LOCK = 03;</code><br />
| Scroll Lock<br />
|-<br />
| <code>HID_LED_COMPOSE = 04;</code><br />
| Compose<br />
|-<br />
| <code>HID_LED_KANA = 05;</code><br />
| Kana<br />
|-<br />
| <code>HID_LED_POWER = 06;</code><br />
| Power<br />
|-<br />
| <code>HID_LED_SHIFT = 07;</code><br />
| Shift<br />
|-<br />
| <code>HID_LED_DO_NOT_DISTURB = 08;</code><br />
| Do Not Disturb<br />
|-<br />
| <code>HID_LED_MUTE = 09;</code><br />
| Mute<br />
|-<br />
|}<br />
</div></div><br />
<br /> <br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID button (Partial)''' <code> HID_BUTTON_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>HID_BUTTON_NONE = 0;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>HID_BUTTON_1 = 1;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_BUTTON_2 = 2;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_BUTTON_3 = 3;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_BUTTON_4 = 4;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_BUTTON_5 = 5;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_BUTTON_PRIMARY = HID_BUTTON_1;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_BUTTON_SECONDARY = HID_BUTTON_2;</code><br />
| &nbsp;<br />
|-<br />
| <code>HID_BUTTON_TERTIARY = HID_BUTTON_3;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|Note: Buttons are defined as Button 1 to Button 65535<br />
|-<br />
| <code>HID_BUTTON_65535 = $FFFF;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID digitizers (Partial)''' <code> HID_DIGITIZERS_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>HID_DIGITIZERS_UNDEFINED = $00;</code><br />
| Undefined<br />
|-<br />
| <code>HID_DIGITIZERS_DIGITIZER = $01;</code><br />
| Digitizer<br />
|-<br />
| <code>HID_DIGITIZERS_PEN = $02;</code><br />
| Pen<br />
|-<br />
| <code>HID_DIGITIZERS_LIGHT_PEN = $03;</code><br />
| Light Pen<br />
|-<br />
| <code>HID_DIGITIZERS_TOUCH_SCREEN = $04;</code><br />
| Touch Screen<br />
|-<br />
| <code>HID_DIGITIZERS_TOUCH_PAD = $05;</code><br />
| Touch Pad<br />
|-<br />
| <code>HID_DIGITIZERS_WHITEBOARD = $06;</code><br />
| Whiteboard<br />
|-<br />
| <code>HID_DIGITIZERS_COORD_MEASURING = $07;</code><br />
| Coordinate Measuring Machine<br />
|-<br />
| <code>HID_DIGITIZERS_3D_DIGITIZER = $08;</code><br />
| 3D Digitizer<br />
|-<br />
| <code>HID_DIGITIZERS_STEREO_PLOTTER = $09;</code><br />
| Stereo Plotter<br />
|-<br />
| <code>HID_DIGITIZERS_ARTICULATED_ARM = $0A;</code><br />
| Articulated Arm<br />
|-<br />
| <code>HID_DIGITIZERS_ARMATURE = $0B;</code><br />
| Armature<br />
|-<br />
| <code>HID_DIGITIZERS_MULTI_POINT_DIGITIZER = $0C;</code><br />
| Multiple Point Digitizer<br />
|-<br />
| <code>HID_DIGITIZERS_FREE_SPACE_WAND = $0D;</code><br />
| Free Space Wand<br />
|-<br />
| <code>HID_DIGITIZERS_DEVICE_CONFIGURATION = $0E;</code><br />
| Device Configuration<br />
|-<br />
| <code>HID_DIGITIZERS_CAPACITIVE_HEAT_MAP = $0F;</code><br />
| Capacitive Heat Map Digitizer<br />
|-<br />
|colspan="2"|''0x10-0x1F Reserved''<br />
|-<br />
| <code>HID_DIGITIZERS_STYLUS = $20;</code><br />
| Stylus<br />
|-<br />
| <code>HID_DIGITIZERS_PUCK = $21;</code><br />
| Puck<br />
|-<br />
| <code>HID_DIGITIZERS_FINGER = $22;</code><br />
| Finger<br />
|-<br />
| <code>HID_DIGITIZERS_DEVICE_SETTINGS = $23;</code><br />
| Device settings<br />
|-<br />
| <code>HID_DIGITIZERS_CHARACTER_GESTURE = $24;</code><br />
| Character Gesture<br />
|-<br />
|colspan="2"|''0x25-0x2F Reserved''<br />
|-<br />
| <code>HID_DIGITIZERS_TIP_PRESSURE = $30;</code><br />
| Tip Pressure<br />
|-<br />
| <code>HID_DIGITIZERS_BARREL_PRESSURE = $31;</code><br />
| Barrel Pressure<br />
|-<br />
| <code>HID_DIGITIZERS_IN_RANGE = $32;</code><br />
| In Range<br />
|-<br />
| <code>HID_DIGITIZERS_TOUCH = $33;</code><br />
| Touch<br />
|-<br />
| <code>HID_DIGITIZERS_UNTOUCH = $34;</code><br />
| Untouch<br />
|-<br />
| <code>HID_DIGITIZERS_TAP = $35;</code><br />
| Tap<br />
|-<br />
| <code>HID_DIGITIZERS_QUALITY = $36;</code><br />
| Quality<br />
|-<br />
| <code>HID_DIGITIZERS_DATA_VALID = $37;</code><br />
| Data Valid<br />
|-<br />
| <code>HID_DIGITIZERS_TRANSDUCER_INDEX = $38;</code><br />
| Transducer Index<br />
|-<br />
| <code>HID_DIGITIZERS_TABLET_FUNCTION_KEYS = $39;</code><br />
| Tablet Function Keys<br />
|-<br />
| <code>HID_DIGITIZERS_PROGRAM_CHANGE_KEYS = $3A;</code><br />
| Program Change Keys<br />
|-<br />
| <code>HID_DIGITIZERS_BATTERY_STRENGTH = $3B;</code><br />
| Battery Strength<br />
|-<br />
| <code>HID_DIGITIZERS_INVERT = $3C;</code><br />
| Invert<br />
|-<br />
| <code>HID_DIGITIZERS_X_TILT = $3D;</code><br />
| X Tilt<br />
|-<br />
| <code>HID_DIGITIZERS_Y_TILT = $3E;</code><br />
| Y Tilt<br />
|-<br />
| <code>HID_DIGITIZERS_AZIMUTH = $3F;</code><br />
| Azimuth<br />
|-<br />
| <code>HID_DIGITIZERS_ALTITUDE = $40;</code><br />
| Altitude<br />
|-<br />
| <code>HID_DIGITIZERS_TWIST = $41;</code><br />
| Twist<br />
|-<br />
| <code>HID_DIGITIZERS_TIP_SWITCH = $42;</code><br />
| Tip Switch<br />
|-<br />
| <code>HID_DIGITIZERS_SECONDARY_TIP_SWITCH = $43;</code><br />
| Secondary Tip Switch<br />
|-<br />
| <code>HID_DIGITIZERS_BARREL_SWITCH = $44;</code><br />
| Barrel Switch<br />
|-<br />
| <code>HID_DIGITIZERS_ERASER = $45;</code><br />
| Eraser<br />
|-<br />
| <code>HID_DIGITIZERS_TABLET_PICK = $46;</code><br />
| Tablet Pick<br />
|-<br />
| <code>HID_DIGITIZERS_TOUCH_VALID = $47;</code><br />
| Touch Valid (Confidence)<br />
|-<br />
| <code>HID_DIGITIZERS_WIDTH = $48;</code><br />
| Width<br />
|-<br />
| <code>HID_DIGITIZERS_HEIGHT = $49;</code><br />
| Height<br />
|-<br />
|colspan="2"|''0x4A-0x50 Reserved''<br />
|-<br />
| <code>HID_DIGITIZERS_CONTACT_IDENTIFIER = $51;</code><br />
| Contact Identifier<br />
|-<br />
| <code>HID_DIGITIZERS_DEVICE_MODE = $52;</code><br />
| Device Mode<br />
|-<br />
| <code>HID_DIGITIZERS_DEVICE_IDENTIFIER = $53;</code><br />
| Device Identifier<br />
|-<br />
| <code>HID_DIGITIZERS_CONTACT_COUNT = $54;</code><br />
| Contact Count<br />
|-<br />
| <code>HID_DIGITIZERS_CONTACT_COUNT_MAXIMUM = $55;</code><br />
| Contact Count Maximum<br />
|-<br />
| <code>HID_DIGITIZERS_SCAN_TIME = $56;</code><br />
| Scan Time<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID logging''' <code> HID_LOG_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>HID_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG;</code><br />
| HID debugging messages<br />
|-<br />
| <code>HID_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code><br />
| HID informational messages, such as a device being attached or detached.<br />
|-<br />
| <code>HID_LOG_LEVEL_WARN = LOG_LEVEL_WARN;</code><br />
| HID warning messages<br />
|-<br />
| <code>HID_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code><br />
| HID error messages<br />
|-<br />
| <code>HID_LOG_LEVEL_NONE = LOG_LEVEL_NONE;</code><br />
| No HID messages<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Type definitions ===<br />
----<br />
<br />
<br />
'''HID descriptor'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDDescriptor = ^THIDDescriptor;</code><br />
<br />
<code>THIDDescriptor = packed record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 6.2.1<br />
|-<br />
| <code>bLength:Byte;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>bDescriptorType:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>bcdHID:Word;</code><br />
| &nbsp;<br />
|-<br />
| <code>bCountryCode:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>bNumDescriptors:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>bHIDDescriptorType:Byte;</code><br />
| &nbsp;<br />
|-<br />
| <code>wHIDDescriptorLength:Word;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|Note: Up to two optional bHIDDescriptorType/wHIDDescriptorLength pairs after the Report descriptor details<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID report descriptor'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<br />
<code>PHIDReportDescriptor = Pointer;</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 6.2.2<br />
|-<br />
| &nbsp;<br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID physical descriptor'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDPhysicalDescriptor = ^THIDPhysicalDescriptor;</code><br />
<br />
<code>THIDPhysicalDescriptor = packed record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|See Section 6.2.3<br />
|-<br />
| <code>bDesignator:Byte;</code><br />
| Indicates which part of the body affects the item<br />
|-<br />
| <code>bFlags:Byte;</code><br />
| Bits specifying flags (7..5 Qualifier / 4..0 Effort)<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID physical descriptor set0'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDPhysicalDescriptorSet0 = ^THIDPhysicalDescriptorSet0;</code><br />
<br />
<code>THIDPhysicalDescriptorSet0 = packed record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>bNumber:Byte;</code><br />
| Number of Physical Descriptor sets not including Physical Descriptor set 0<br />
|-<br />
| <code>wLength:Word;</code><br />
| Length of each Physical descriptor set<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID physical descriptor set'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDPhysicalDescriptorSet = ^THIDPhysicalDescriptorSet;</code><br />
<br />
<code>THIDPhysicalDescriptorSet = packed record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>bPhysicalInfo:Byte;</code><br />
| Bits specifying physical information (7..5 Bias / 4..0 Preference)<br />
|-<br />
| <code>wPhysicalDescriptor:array[0..0] of THIDPhysicalDescriptor;</code><br />
| Physical descriptor data<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID state'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDState = ^THIDState;</code><br />
<br />
<code>THIDState = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|Local State<br />
|-<br />
| <code>Usage:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>UsageCount:LongWord;</code><br />
| Provides UsageMinimum/UsageMaximum<br />
|-<br />
| <code>DesignatorIndex:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>DesignatorCount:LongWord;</code><br />
| Provides DesignatorMinimum/DesignatorMaximum<br />
|-<br />
| <code>StringIndex:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>StringCount:LongWord;</code><br />
| Provides StringMinimum/StringMaximum<br />
|-<br />
| <code>Delimiter:Boolean;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|Global State<br />
|-<br />
| <code>UsagePage:Word;</code><br />
| &nbsp;<br />
|-<br />
| <code>LogicalMinimum:LongInt;</code><br />
| &nbsp;<br />
|-<br />
| <code>LogicalMaximum:LongInt;</code><br />
| &nbsp;<br />
|-<br />
| <code>PhysicalMinimum:LongInt;</code><br />
| &nbsp;<br />
|-<br />
| <code>PhysicalMaximum:LongInt;</code><br />
| &nbsp;<br />
|-<br />
| <code>UnitType:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>UnitExponent:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>ReportSize:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>ReportId:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>ReportCount:LongWord;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID stack'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDStack = ^THIDStack;</code><br />
<br />
<code>THIDStack = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>State:PHIDState;</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
| <code>Next:PHIDStack;</code><br />
| &nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID usages'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDUsages = ^THIDUsages;</code><br />
<br />
<code>THIDUsages = array[0..0] of PHIDUsage;</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| &nbsp;<br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID usage'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDUsage = ^THIDUsage;</code><br />
<br />
<code>THIDUsage = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>Page:Word;</code><br />
| The usage page this usage refers to<br />
|-<br />
| <code>Usage:Word;</code><br />
| The usage within the usage page<br />
|-<br />
| <code>Count:Word;</code><br />
| The total number of sequential usages where Usage represents the minimum value or 1 for a single usage (Usage range is from Usage to Usage + Count - 1)<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>Index:LongWord;</code><br />
| The index of this usage in the report (First usage is 0)<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>StringIndex:LongWord;</code><br />
| The string index for this usage<br />
|-<br />
| <code>StringCount:LongWord;</code><br />
| The total number of sequential string index values where string index represents the minimum value or 1 for a single string<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>DesignatorIndex:LongWord;</code><br />
| The designator index for this usage<br />
|-<br />
| <code>DesignatorCount:LongWord;</code><br />
| The total number of sequential designator index values where designator index represents the minimum value or 1 for a single designator<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>LogicalMinimum:LongInt;</code><br />
| The logical minimum value for this usage<br />
|-<br />
| <code>LogicalMaximum:LongInt;</code><br />
| The logical maximum value for this usage<br />
|-<br />
| <code>PhysicalMinimum:LongInt;</code><br />
| The physical minimum value for this usage (in Units)<br />
|-<br />
| <code>PhysicalMaximum:LongInt;</code><br />
| The physical maximum value for this usage (in Units)<br />
|-<br />
| <code>UnitType:LongWord;</code><br />
| The unit type for this usage<br />
|-<br />
| <code>UnitExponent:LongWord;</code><br />
| The unit exponent index for this usage<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>Aliases:PHIDUsages;</code><br />
| The list of aliased usages for this control (See Delimiters in Section 6.2.2.8)<br />
|-<br />
| <code>AliasCount:LongWord;</code><br />
| The number of aliased usages contained for this control<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>Report:PHIDReport;</code><br />
| The report this usage belongs to<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID reports'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDReports = ^THIDReports;</code><br />
<br />
<code>THIDReports = array[0..0] of PHIDReport;</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| &nbsp;<br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID report'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDReport = ^THIDReport;</code><br />
<br />
<code>THIDReport = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>Id:Byte;</code><br />
| The Id of this report<br />
|-<br />
| <code>Kind:Byte;</code><br />
| The type of report (Input, Output or Feature) (eg HID_REPORT_INPUT)<br />
|-<br />
| <code>Flags:LongWord;</code><br />
| The main item flags for this report (eg HID_MAIN_ITEM_VARIABLE)<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>Size:LongWord;</code><br />
| The number of bits per field in this report<br />
|-<br />
| <code>Count:LongWord;</code><br />
| The number of fields in this report<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>Index:LongWord;</code><br />
| The index of this report in the collection (First report is 0)<br />
|-<br />
| <code>Sequence:LongWord;</code><br />
| The sequence of this report in all collections (First report is 0)<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>Usages:PHIDUsages;</code><br />
| The list of usages contained in this report<br />
|-<br />
| <code>UsageCount:LongWord;</code><br />
| The number of usages contained in this report<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>Collection:PHIDCollection;</code><br />
| The collection this report belongs to<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID collections'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDCollections = ^THIDCollections;</code><br />
<br />
<code>THIDCollections = array[0..0] of PHIDCollection;</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| &nbsp;<br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID collection'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDCollection = ^THIDCollection;</code><br />
<br />
<code>THIDCollection = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>Page:Word;</code><br />
| The usage page this collection refers to (eg HID_PAGE_GENERIC_DESKTOP)<br />
|-<br />
| <code>Usage:Word;</code><br />
| The usage within the usage page (eg HID_DESKTOP_MOUSE)<br />
|-<br />
| <code>Flags:LongWord;</code><br />
| The main item flags for this collection (eg HID_MAIN_COLLECTION_APPLICATION)<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>Start:LongWord;</code><br />
| The first byte of this collection in the report descriptor<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>Reports:PHIDReports;</code><br />
| The list of reports contained in this collection<br />
|-<br />
| <code>ReportCount:LongWord;</code><br />
| The number of reports contained in this collection<br />
|-<br />
| <code>Collections:PHIDCollections;</code><br />
| The list of collections contained in this collection<br />
|-<br />
| <code>CollectionCount:LongWord;</code><br />
| The number of collections contained in this collection<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>Parent:PHIDCollection;</code><br />
| The parent collection or nil if this is a top level collection<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>Device:PHIDDevice;</code><br />
| The device this collection belongs to<br />
|-<br />
| <code>Consumer:PHIDConsumer;</code><br />
| The consumer which is bound to this collection (or nil if not bound)<br />
|-<br />
| <code>PrivateData:Pointer;</code><br />
| Private data for the consumer of this collection<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID device enumeration callback'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceEnumerate = function(Device:PHIDDevice;Data:Pointer):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''HID device notification callback'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''HID device get idle'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceGetIdle = function(Device:PHIDDevice; var Duration:Word; ReportId:Byte):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''HID device set idle'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceSetIdle = function(Device:PHIDDevice; Duration:Word; ReportId:Byte):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|} <br />
<br />
'''HID device get report'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceGetReport = function(Device:PHIDDevice; ReportType,ReportId:Byte; ReportData:Pointer; ReportSize:LongWord):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''HID device set report'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceSetReport = function(Device:PHIDDevice; ReportType,ReportId:Byte; ReportData:Pointer; ReportSize:LongWord):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|} <br />
<br />
'''HID device allocate report'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceAllocateReport = function(Device:PHIDDevice; Collection:PHIDCollection; ReportId:Byte; ReportSize:LongWord):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''HID device release report'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceReleaseReport = function(Device:PHIDDevice; ReportId:Byte):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''HID device submit report'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceSubmitReport = function(Device:PHIDDevice; ReportId:Byte):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''HID device cancel report'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceCancelReport = function(Device:PHIDDevice; ReportId:Byte):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''HID device get protocol'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceGetProtocol = function(Device:PHIDDevice; var Protocol:Byte):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|} <br />
<br />
'''HID device set protocol'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceSetProtocol = function(Device:PHIDDevice; Protocol:Byte):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|} <br />
<br />
'''HID device get interval'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceGetInterval = function(Device:PHIDDevice; var Interval:LongWord):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|} <br />
<br />
'''HID device set interval'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceSetInterval = function(Device:PHIDDevice; Interval:LongWord):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|} <br />
<br />
'''HID device get report descriptor'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceGetReportDescriptor = function(Device:PHIDDevice; Descriptor:PHIDReportDescriptor; Size:LongWord):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|} <br />
<br />
'''HID device get physical descriptor set0'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceGetPhysicalDescriptorSet0 = function(Device:PHIDDevice; Descriptor:PHIDPhysicalDescriptorSet0):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''HID device get physical descriptor set'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceGetPhysicalDescriptorSet = function(Device:PHIDDevice; Descriptor:PHIDPhysicalDescriptorSet; Index:Byte; Size:LongWord):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''HID device'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDDevice = ^THIDDevice;</code><br />
<br />
<code>THIDDevice = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|''Device Properties''<br />
|-<br />
| <code>Device:TDevice;</code><br />
| The Device entry for this HID<br />
|-<br />
|colspan="2"|''HID Properties''<br />
|-<br />
| <code>HIDId:LongWord;</code><br />
| Unique Id of this HID in the HID device table<br />
|-<br />
| <code>HIDState:LongWord;</code><br />
| HID device state (eg HID_STATE_ATTACHED)<br />
|-<br />
| <code>Consumer:PHIDConsumer;</code><br />
| The consumer which is bound to this device (or nil if not bound)<br />
|-<br />
| <code>DeviceGetIdle:THIDDeviceGetIdle;</code><br />
| A device specific GetIdle method (If supported by provider)<br />
|-<br />
| <code>DeviceSetIdle:THIDDeviceSetIdle;</code><br />
| A device specific SetIdle method (If supported by provider)<br />
|-<br />
| <code>DeviceGetReport:THIDDeviceGetReport;</code><br />
| A device specific GetReport method (If supported by provider)<br />
|-<br />
| <code>DeviceSetReport:THIDDeviceSetReport;</code><br />
| A device specific SetReport method (If supported by provider)<br />
|-<br />
| <code>DeviceAllocateReport:THIDDeviceAllocateReport;</code><br />
| A device specific AllocateReport method (If supported by provider)<br />
|-<br />
| <code>DeviceReleaseReport:THIDDeviceReleaseReport;</code><br />
| A device specific ReleaseReport method (If supported by provider)<br />
|-<br />
| <code>DeviceSubmitReport:THIDDeviceSubmitReport;</code><br />
| A device specific SubmitReport method (If supported by provider)<br />
|-<br />
| <code>DeviceCancelReport:THIDDeviceCancelReport;</code><br />
| A device specific CancelReport method (If supported by provider)<br />
|-<br />
| <code>DeviceGetProtocol:THIDDeviceGetProtocol;</code><br />
| A device specific GetProtocol method (If supported by provider)<br />
|-<br />
| <code>DeviceSetProtocol:THIDDeviceSetProtocol;</code><br />
| A device specific SetProtocol method (If supported by provider)<br />
|-<br />
| <code>DeviceGetInterval:THIDDeviceGetInterval;</code><br />
| A device specific GetInterval method (If supported by provider)<br />
|-<br />
| <code>DeviceSetInterval:THIDDeviceSetInterval;</code><br />
| A device specific SetInterval method (If supported by provider)<br />
|-<br />
| <code>DeviceGetReportDescriptor:THIDDeviceGetReportDescriptor;</code><br />
| A device specific GetReportDescriptor method (If supported by provider)<br />
|-<br />
| <code>DeviceGetPhysicalDescriptorSet0:THIDDeviceGetPhysicalDescriptorSet0;</code><br />
| A device specific GetPhysicalDescriptorSet0 method (If supported by provider)<br />
|-<br />
| <code>DeviceGetPhysicalDescriptorSet:THIDDeviceGetPhysicalDescriptorSet;</code><br />
| A device specific GetPhysicalDescriptorSet method (If supported by provider)<br />
|-<br />
|colspan="2"|''Driver Properties''<br />
|-<br />
| <code>Lock:TMutexHandle;</code><br />
| HID device lock<br />
|-<br />
| <code>PrivateData:Pointer;</code><br />
| Private data for the consumer of this HID device (If applicable)<br />
|-<br />
| <code>Collections:PHIDCollections;</code><br />
| The parsed report descriptor with collections, reports and usages<br />
|-<br />
| <code>CollectionCount:LongWord;</code><br />
| The number of top level collections contained in the report descriptor<br />
|-<br />
| <code>Descriptor:PHIDReportDescriptor;</code><br />
| The raw report descriptor obtained from the device<br />
|-<br />
| <code>DescriptorSize:LongWord;</code><br />
| The size of the data pointed to by Descriptor<br />
|-<br />
|colspan="2"|''Statistics Properties''<br />
|-<br />
| <code>ReceiveCount:LongWord;</code><br />
| &nbsp;<br />
|-<br />
| <code>ReceiveErrors:LongWord;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|''Internal Properties''<br />
|-<br />
| <code>Prev:PHIDDevice;</code><br />
| Previous entry in Device table<br />
|-<br />
| <code>Next:PHIDDevice;</code><br />
| Next entry in Device table<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID consumer enumeration callback'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDConsumerEnumerate = function(Consumer:PHIDConsumer; Data:Pointer):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''HID device bind'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceBind = function(Device:PHIDDevice):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|} <br />
<br />
'''HID device unbind'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDDeviceUnbind = function(Device:PHIDDevice):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|} <br />
<br />
'''HID collection bind'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDCollectionBind = function(Device:PHIDDevice; Collection:PHIDCollection):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|} <br />
<br />
'''HID collection unbind'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDCollectionUnbind = function(Device:PHIDDevice; Collection:PHIDCollection):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|} <br />
<br />
'''HID report receive'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>THIDReportReceive = function(Collection:PHIDCollection; ReportId:Byte; ReportData:Pointer; ReportSize:LongWord):LongWord;</code><br />
| style="width: 40%;"|<br />
|-<br />
|}<br />
<br />
'''HID consumer'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDConsumer = ^THIDConsumer;</code><br />
<br />
<code>THIDConsumer = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|''Driver Properties''<br />
|-<br />
| <code>Driver:TDriver;</code><br />
| The Driver entry for this HID Consumer<br />
|-<br />
|colspan="2"|''Consumer Properties''<br />
|-<br />
| <code>DeviceBind:THIDDeviceBind;</code><br />
| A Device Bind method to be called when a HID device bind is requested by a provider (Optional)<br />
|-<br />
| <code>DeviceUnbind:THIDDeviceUnbind;</code><br />
| A Device Ubind method to be called when a HID device unbind is requested by a provider (Optional)<br />
|-<br />
| <code>CollectionBind:THIDCollectionBind;</code><br />
| A Collection Bind method to be called when a HID collection bind is requested by a provider (Mandatory)<br />
|-<br />
| <code>CollectionUnbind:THIDCollectionUnbind;</code><br />
| A Collection Unbind method to be called when a HID collection unbind is requested by a provider (Mandatory)<br />
|-<br />
| <code>ReportReceive:THIDReportReceive;</code><br />
| A Report Receive method to be called when a HID input report is received by a provider (Mandatory)<br />
|-<br />
|colspan="2"|''Interface Properties''<br />
|-<br />
| <code>Lock:TMutexHandle;</code><br />
| Consumer lock<br />
|-<br />
|colspan="2"|''Internal Properties''<br />
|-<br />
| <code>Prev:PHIDConsumer;</code><br />
| Previous entry in Consumer table<br />
|-<br />
| <code>Next:PHIDConsumer;</code><br />
| Next entry in Consumer table<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID report extent'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDExtent = ^THIDExtent;</code><br />
<br />
<code>THIDExtent = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>Minimum:LongInt;</code><br />
| The minimum value for this extent<br />
|-<br />
| <code>Maximum:LongInt;</code><br />
| The maximum value for this extent<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID report field'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDField = ^THIDField;</code><br />
<br />
<code>THIDField = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>Page:Word;</code><br />
| The usage page of this field<br />
|-<br />
| <code>Usage:Word;</code><br />
| The usage within the usage page<br />
|-<br />
| <code>Count:LongWord;</code><br />
| The total number of sequential usages where Usage represents the minimum value or 1 for a single usage (Usage range is from Usage to Usage + Count - 1)<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>Flags:LongWord;</code><br />
| The flags for this field<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>Size:LongWord;</code><br />
| The length in bytes of this field within the input, output or feature report<br />
|-<br />
| <code>Bits:LongWord;</code><br />
| The length in bits of this field within the input, output or feature report<br />
|-<br />
| <code>Offset:LongWord;</code><br />
| The byte offset of this field within the input, output or feature report<br />
|-<br />
| <code>Shift:LongWord;</code><br />
| The number shift bits to access this field in the input, output or feature report<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>Logical:THIDExtent;</code><br />
| The minimum and maximum logical values for this field<br />
|-<br />
| <code>Physical:THIDExtent;</code><br />
| The minimum and maximum physical values for this field<br />
|-<br />
| <code>Multiplier:Double;</code><br />
| The conversion multiplier for this field from logical to physical units<br />
|-<br />
| <code>Resolution:Double;</code><br />
| The unit resolution for this field in counts per physical unit<br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
| <code>Next:PHIDField;</code><br />
| The next field in the list<br />
|-<br />
|}<br />
</div></div><br />
<br />
'''HID report definition'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDDefinition = ^THIDDefinition;</code><br />
<br />
<code>THIDDefinition = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>Id:Byte;</code><br />
| The Id of this report<br />
|-<br />
| <code>Kind:Byte;</code><br />
| The type of this report (Input, Output or Feature)<br />
|-<br />
| <code>Size:LongWord;</code><br />
| The total length of this input, output or feature report in bytes (Including the Id byte)<br />
|-<br />
| <code>Fields:PHIDField;</code><br />
| Linked list of fields in this input, output or feature report<br />
|-<br />
|colspan="2"|&nbsp; <br />
|-<br />
| <code>Next:PHIDDefinition;</code><br />
| The next definition in the list<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Public variables ===<br />
----<br />
<br />
<br />
'''HID logging'''<br />
<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>HID_DEFAULT_LOG_LEVEL:LongWord = HID_LOG_LEVEL_DEBUG;</code><br />
| style="width: 40%;"|Minimum level for HID messages. Only messages with level greater than or equal to this will be printed.<br />
|-<br />
|}<br />
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"<br />
|-<br />
| <code>HID_LOG_ENABLED:Boolean;</code><br />
| style="width: 40%;"|<br />
|-<br />
|} <br />
<br /><br />
<br />
=== Function declarations ===<br />
----<br />
<br />
<br />
'''Initialization functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure HIDInit;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the HID unit, device and consumer tables</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Called only during system startup<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''HID functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDParserParseCollections(Device:PHIDDevice; var Collections:PHIDCollections; var Count:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Parse the HID report descriptor of the provided device and populate the collections, reports and usages</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to parse collections for<br />
|-<br />
! Collections<br />
| A pointer to the top level collections array to be populated<br />
|-<br />
! Count<br />
| A variable to return the number of top level collections<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDParserFreeCollections(Collections:PHIDCollections; Count:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Free the collections, reports and usages parsed from a HID report descriptor</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Collections<br />
| A pointer to the top level collections array to be freed<br />
|-<br />
! Count<br />
| The number of top level collections in the array<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDParserCountCollections(Device:PHIDDevice; Parent:PHIDCollection):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Count the number of collections found in the HID report descriptor of the provided device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to count collections for<br />
|-<br />
! Parent<br />
| The parent HID collection, if supplied count child collections else count top level collections<br />
|-<br />
! Return<br />
| The number of collections found, 0 if none for or on error<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDParserCountReports(Device:PHIDDevice; Collection:PHIDCollection):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Count the number of reports found in the HID report descriptor of the supplied device and collection</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to count reports for<br />
|-<br />
! Collection<br />
| The HID collection to count reports for<br />
|-<br />
! Return<br />
| The number of reports found, 0 if none for or on error<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDParserCountUsages(Device:PHIDDevice; Report:PHIDReport):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Count the number of usages found in the HID report descriptor for the supplied device and report</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to count usages for<br />
|-<br />
! Report<br />
| The HID report to count usages for<br />
|-<br />
! Return<br />
| The number of usages found, 0 if none for or on error<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDParserAllocateCollection(Device:PHIDDevice; Parent:PHIDCollection; State:PHIDState; Flags,Start:LongWord):PHIDCollection;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate a HID collection to contain a set of reports and usages from a HID report descriptor</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device containing the collection<br />
|-<br />
! Parent<br />
| The HID collection containing the collection (or nil for a top level collection)<br />
|-<br />
! State<br />
| The current HID parser state<br />
|-<br />
! Flags<br />
| The flags for the collection from the HID report descriptor<br />
|-<br />
! Start<br />
| The starting byte offset of the collection in the HID report descriptor<br />
|-<br />
! Return<br />
| A pointer to the HID collection or nil on error<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDParserAllocateReport(Device:PHIDDevice; Collection:PHIDCollection; State:PHIDState; Kind:Byte; Flags,Index,Sequence:LongWord):PHIDReport;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate a HID report to contain a set of usages from a HID report descriptor</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device containing the report<br />
|-<br />
! Collection<br />
| The HID collection containing the report<br />
|-<br />
! State<br />
| The current HID parser state<br />
|-<br />
! Kind<br />
| The report kind (eg HID_REPORT_INPUT)<br />
|-<br />
! Flags<br />
| The flags for the report from the HID report descriptor<br />
|-<br />
! Index<br />
| The index of this report in the collection (First report is 0)<br />
|-<br />
! Sequence<br />
| The sequence of this report in all collections (First report is 0)<br />
|-<br />
! Return<br />
| A pointer to the HID report or nil on error<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDParserAllocateUsage(Device:PHIDDevice; Report:PHIDReport; State:PHIDState; Index:LongWord):PHIDUsage;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate a HID usage from a HID report descriptor</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device containing the usage<br />
|-<br />
! Report<br />
| The HID report containing the usage<br />
|-<br />
! State<br />
| The current HID parser state<br />
|-<br />
! Index<br />
| The index of this usage in the report (First usage is 0)<br />
|-<br />
! Return<br />
| A pointer to the HID usage or nil on error<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDParserUpdateUsage(Device:PHIDDevice; Report:PHIDReport; State:PHIDState; Usage:PHIDUsage):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Update a HID usage from a HID report descriptor</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device containing the usage<br />
|-<br />
! Report<br />
| The HID report containing the usage<br />
|-<br />
! State<br />
| The current HID parser state<br />
|-<br />
! Usage<br />
| The HID usage to update<br />
|-<br />
! Return<br />
| True if completed or False on error<br />
|-<br />
! Note<br />
| As usages must precede the main item they relate to in the HID report descriptor they need to be allocated before all the required information is known, this function updates the usage after the main item is found.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDParserFreeUsage(Device:PHIDDevice;Usage:PHIDUsage):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Free a HID usage and any associated usage aliases</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device containing the usage<br />
|-<br />
! Usage<br />
| The HID usage to free<br />
|-<br />
! Return<br />
| True if completed or False on error<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDParserPopStack(var Stack:PHIDStack; var State:PHIDState):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Replace the current HID parser state with the top item from the parser stack</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Stack<br />
| The HID parser stack<br />
|-<br />
! State<br />
| The HID parser state to replace<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDParserPushStack(Stack:PHIDStack):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Place a copy of the current HID parser state on top of the parser stack</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Stack<br />
| The HID parser stack<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDParserFreeStack(Stack:PHIDStack):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Free the HID parser stack and state</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Stack<br />
| The HID parser stack<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDParserResetState(State:PHIDState):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Clear the Local and Global HID parser state</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! State<br />
| The HID parser state to reset<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDParserCleanState(State:PHIDState):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Clear the Local HID parser state</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! State<br />
| The HID parser state to clean<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDFindCollection(Device:PHIDDevice; Page,Usage:Word):PHIDCollection;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find the first HID collection matching the specified page and usage</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to find collections from<br />
|-<br />
! Page<br />
| The HID Usage Page to match (eg HID_PAGE_GENERIC_DESKTOP)<br />
|-<br />
! Usage<br />
| The HID Usage to match (eg HID_DESKTOP_MOUSE)<br />
|-<br />
! Return<br />
| A pointer to the first matching collection or nil if not matched<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDFindReportIds(Device:PHIDDevice; Collection:PHIDCollection; var MinId,MaxId:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find the minimum and maximum report ids contained in the specified HID collection or all collections</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to find report ids from<br />
|-<br />
! Collection<br />
| The HID collection to find report ids from (or nil to find from all collections)<br />
|-<br />
! MinId<br />
| A variable to receive the minimum report id number<br />
|-<br />
! MaxId<br />
| A variable to receive the maximum report id number<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDFindReportSizes(Device:PHIDDevice; Collection:PHIDCollection; Kind:Byte; var MinSize,MaxSize:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find the minimum and maximum report sizes contained in the specified HID collection or all collections</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to find report sizes from<br />
|-<br />
! Collection<br />
| The HID collection to find report sizes from (or nil to find from all collections)<br />
|-<br />
! Kind<br />
| The report kind to find sizes for (eg HID_REPORT_INPUT)<br />
|-<br />
! MinSize<br />
| A variable to receive the minimum report size<br />
|-<br />
! MaxSize<br />
| A variable to receive the maximum report size<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDCountReports(Device:PHIDDevice; Collection:PHIDCollection; Kind,Id:Byte; var Count:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Count the number of HID reports of the specified type and id in the specified collection</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to get the report count from<br />
|-<br />
! Collection<br />
| The HID collection to get the report count from<br />
|-<br />
! Kind<br />
| The report kind to count reports for (eg HID_REPORT_INPUT)<br />
|-<br />
! Id<br />
| The report id to count reports for (must be less than or equal to the maximum report id)<br />
|-<br />
! Count<br />
| A variable to return the number of reports<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDFindReports(Device:PHIDDevice; Collection:PHIDCollection; Kind,Id:Byte; Reports:PHIDReports; Count:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find all HID reports of the specified type and id in the specified collection</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to get the reports from<br />
|-<br />
! Collection<br />
| The HID collection to get the reports from<br />
|-<br />
! Kind<br />
| The report kind to get reports for (eg HID_REPORT_INPUT)<br />
|-<br />
! Id<br />
| The report id to get reports for (must be less than or equal to the maximum report id)<br />
|-<br />
! Reports<br />
| A pointer to an array to return the list of reports<br />
|-<br />
! Count<br />
| The number of reports able to be returned in the reports array<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
! Note<br />
| The caller is responsible for allocating the reports array which must be large enough to hold a pointer to every report in the returned list. When finished the array should be freed by the caller but not the reports themselves. Call HIDCountReports first to obtain the correct size to be allocated for the array.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDAllocateDefinition(Device:PHIDDevice; Collection:PHIDCollection; Kind,Id:Byte):PHIDDefinition;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate a HID definition to describe an input, output or feature report contained in the specified collection</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to create the report definition from<br />
|-<br />
! Collection<br />
| The HID collection to create the report definition from<br />
|-<br />
! Kind<br />
| The report kind to create a definition for (eg HID_REPORT_INPUT)<br />
|-<br />
! Id<br />
| The report id to create a definition for (must be less than or equal to the maximum report id)<br />
|-<br />
! Return<br />
| A pointer to the allocated definition or nil on error<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDFreeDefinition(Definition:PHIDDefinition):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Free a HID definition describing an input, output or feature report</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Definition<br />
| The HID definition to be freed<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDInsertBitField(Field:PHIDField; Buffer:Pointer; Size:LongWord; Value:Boolean):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Insert a bit field value into a report buffer</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Field<br />
| The field to insert into the report<br />
|-<br />
! Buffer<br />
| A pointer to the report buffer<br />
|-<br />
! Size<br />
| The size in bytes of the report buffer<br />
|-<br />
! Value<br />
| The value to insert into the buffer<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDInsertSignedField(Field:PHIDField; Buffer:Pointer; Size:LongWord; Value:LongInt):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Insert a signed field value into a report buffer</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Field<br />
| The field to insert into the report<br />
|-<br />
! Buffer<br />
| A pointer to the report buffer<br />
|-<br />
! Size<br />
| The size in bytes of the report buffer<br />
|-<br />
! Value<br />
| The value to insert into the buffer<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDInsertUnsignedField(Field:PHIDField; Buffer:Pointer; Size,Value:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Insert an unsigned field value into a report buffer</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Field<br />
| The field to insert into the report<br />
|-<br />
! Buffer<br />
| A pointer to the report buffer<br />
|-<br />
! Size<br />
| The size in bytes of the report buffer<br />
|-<br />
! Value<br />
| The value to insert into the buffer<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDExtractBitField(Field:PHIDField; Buffer:Pointer; Size:LongWord; var Value:Boolean):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Extract a bit field value from a report buffer</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Field<br />
| The field to extract from the report<br />
|-<br />
! Buffer<br />
| A pointer to the report buffer<br />
|-<br />
! Size<br />
| The size in bytes of the report buffer<br />
|-<br />
! Value<br />
| A variable to receive the extracted value<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDExtractSignedField(Field:PHIDField; Buffer:Pointer; Size:LongWord; var Value:LongInt):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Extract a signed field value from a report buffer</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Field<br />
| The field to extract from the report<br />
|-<br />
! Buffer<br />
| A pointer to the report buffer<br />
|-<br />
! Size<br />
| The size in bytes of the report buffer<br />
|-<br />
! Value<br />
| A variable to receive the extracted value<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDExtractUnsignedField(Field:PHIDField; Buffer:Pointer; Size:LongWord; var Value:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Extract an unsigned field value from a report buffer</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Field<br />
| The field to extract from the report<br />
|-<br />
! Buffer<br />
| A pointer to the report buffer<br />
|-<br />
! Size<br />
| The size in bytes of the report buffer<br />
|-<br />
! Value<br />
| A variable to receive the extracted value<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''HID Device functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceSetState(Device:PHIDDevice; State:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the state of the specified HID device and send a notification</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to set the state for<br />
|-<br />
! State<br />
| The new state to set and notify (eg HID_STATE_ATTACHED)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceGetIdle(Device:PHIDDevice; var Duration:Word; ReportId:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the idle rate from a HID device for the specified report id</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to get the idle rate from<br />
|-<br />
! Duration<br />
| A variable to receive the idle rate (in Milliseconds)<br />
|-<br />
! ReportId<br />
| The report id to get the idle rate from<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceSetIdle(Device:PHIDDevice; Duration:Word; ReportId:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the idle rate on a HID device for the specified report id</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to set the idle rate for<br />
|-<br />
! Duration<br />
| The idle rate to set (in Milliseconds)<br />
|-<br />
! ReportId<br />
| The report id to set the idle rate for<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceGetReport(Device:PHIDDevice; ReportType,ReportId:Byte; ReportData:Pointer; ReportSize:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read a report by type and id from a HID device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to read the report from<br />
|-<br />
! ReportType<br />
| The report type to read (eg HID_REPORT_INPUT)<br />
|-<br />
! ReportId<br />
| The report id to read (eg HID_REPORTID_NONE)<br />
|-<br />
! ReportData<br />
| A pointer to a buffer to receive the report data<br />
|-<br />
! ReportSize<br />
| The size in bytes of the buffer pointed to by report data<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceSetReport(Device:PHIDDevice; ReportType,ReportId:Byte; ReportData:Pointer; ReportSize:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write a report by type and id to a HID device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to write the report to<br />
|-<br />
! ReportType<br />
| The report type to write (eg HID_REPORT_OUTPUT)<br />
|-<br />
! ReportId<br />
| The report id to write (eg HID_REPORTID_NONE)<br />
|-<br />
! ReportData<br />
| A pointer to a buffer containing the report data<br />
|-<br />
! ReportSize<br />
| The size in bytes of the buffer pointed to by report data<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceAllocateReport(Device:PHIDDevice; Collection:PHIDCollection; ReportId:Byte; ReportSize:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Allocate and initialize an input report by id on a HID device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to allocate the report on<br />
|-<br />
! Collection<br />
| The HID collection this request corresponds to<br />
|-<br />
! ReportId<br />
| The report id to allocate (eg HID_REPORTID_NONE)<br />
|-<br />
! ReportSize<br />
| The size in bytes to allocate for the report (Provider will handle alignment and other requirements)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
! Note<br />
| An allocated report must be submitted before reports will be received from the device<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceReleaseReport(Device:PHIDDevice; ReportId:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Release an input report by id from a HID device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to release the report from<br />
|-<br />
! ReportId<br />
| The report id to allocate (eg HID_REPORTID_NONE)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
! Note<br />
| If the report has been submitted it must be cancelled before being released<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceSubmitReport(Device:PHIDDevice; ReportId:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Submit an input report by id on a HID device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to submit the report on<br />
|-<br />
! ReportId<br />
| The report id to submit (eg HID_REPORTID_NONE)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
! Note<br />
| The report must be allocated then submitted before reports will be received from the device<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceCancelReport(Device:PHIDDevice; ReportId:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Cancel an input report by id on a HID device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to cancel the report on<br />
|-<br />
! ReportId<br />
| The report id to cancel (eg HID_REPORTID_NONE)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
! Note<br />
| The report should be cancelled then released to stop receiving reports from the device<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceGetProtocol(Device:PHIDDevice; var Protocol:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the report protocol from a HID device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to get the report protocol from<br />
|-<br />
! Protocol<br />
| A variable to receive the report protocol (eg HID_PROTOCOL_REPORT)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceSetProtocol(Device:PHIDDevice; Protocol:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the report protocol for a HID device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to set the report protocol for<br />
|-<br />
! Protocol<br />
| The report protocol to set (eg HID_PROTOCOL_REPORT)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceGetInterval(Device:PHIDDevice; var Interval:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the polling interval from a HID device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to get the polling interval from<br />
|-<br />
! Interval<br />
| A variable to receive the polling interval (in Milliseconds)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceSetInterval(Device:PHIDDevice; Interval:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the polling interval for a HID device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to set the polling interval for<br />
|-<br />
! Interval<br />
| The polling interval to set (in Milliseconds)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceGetReportDescriptor(Device:PHIDDevice; Descriptor:PHIDReportDescriptor; Size:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the Report Descriptor for a HID device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to get the descriptor for<br />
|-<br />
! Descriptor<br />
| Pointer to a buffer to return the HID Report Descriptor<br />
|-<br />
! Size<br />
| The size in bytes of the buffer pointed to by Descriptor<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceGetPhysicalDescriptorSet0(Device:PHIDDevice; Descriptor:PHIDPhysicalDescriptorSet0):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the HID Physical Descriptor Set 0 for a HID device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to get the descriptor for<br />
|-<br />
! Descriptor<br />
| Pointer to a HID Physical Descriptor Set 0 structure for the returned data<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceGetPhysicalDescriptorSet(Device:PHIDDevice; Descriptor:PHIDPhysicalDescriptorSet; Index:Byte; Size:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get a HID Physical Descriptor Set for a HID device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to get the descriptor for<br />
|-<br />
! Descriptor<br />
| Pointer to a HID Physical Descriptor Set structure for the returned data<br />
|-<br />
! Index<br />
| The index of the physical descriptor set to return<br />
|-<br />
! Size<br />
| The size in bytes of the buffer pointed to by Descriptor<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceBindDevice(Device:PHIDDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Attempt to bind a HID device to one of the registered consumers</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to attempt to bind a consumer to<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed, ERROR_NOT_SUPPORTED if unsupported or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceUnbindDevice(Device:PHIDDevice; Consumer:PHIDConsumer):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unbind a HID device from a consumer</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to unbind a consumer from<br />
|-<br />
! Consumer<br />
| The consumer to unbind the device from (nil to unbind from current consumer)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceBindCollections(Device:PHIDDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Attempt to bind the HID collections in the specified device to one of the registered consumers</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device containing the collections to attempt to bind a consumer to<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceUnbindCollections(Device:PHIDDevice; Consumer:PHIDConsumer):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Unbind the HID collections in the specified device from a consumer</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device containing the collections to unbind a consumer from<br />
|-<br />
! Consumer<br />
| The consumer to unbind the collections from (nil to unbind from current consumer)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceCreate:PHIDDevice;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new HID device entry</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Return<br />
| Pointer to new HID device entry or nil if HID device could not be created<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceCreateEx(Size:LongWord):PHIDDevice;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new HID device entry</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Size<br />
| Size in bytes to allocate for new HID device (Including the HID device entry)<br />
|-<br />
! Return<br />
| Pointer to new HID device entry or nil if HID device could not be created<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceDestroy(Device:PHIDDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Destroy an existing HID device entry</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to destroy<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceRegister(Device:PHIDDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a new HID device in the HID device table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to register<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceDeregister(Device:PHIDDevice):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Deregister a HID device from the HID device table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to deregister<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceFind(HIDId:LongWord):PHIDDevice;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a HID device by ID in the HID device table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! HIDId<br />
| The ID number of the HID device to find<br />
|-<br />
! Return<br />
| Pointer to HID device entry or nil if not found<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceFindByName(const Name:String):PHIDDevice; inline;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a HID device by name in the device table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Name<br />
| The name of the HID device to find (eg HID0)<br />
|-<br />
! Return<br />
| Pointer to HID device entry or nil if not found<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceFindByDescription(const Description:String):PHIDDevice; inline;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a HID device by description in the device table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Description<br />
| The description of the HID to find (eg Optical USB Mouse)<br />
|-<br />
! Return<br />
| Pointer to HID device entry or nil if not found<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceEnumerate(Callback:THIDDeviceEnumerate; Data:Pointer):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Enumerate all HID devices in the HID device table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Callback<br />
| The callback function to call for each HID device in the table<br />
|-<br />
! Data<br />
| A private data pointer to pass to callback for each HID device in the table<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceNotification(Device:PHIDDevice; Callback:THIDDeviceNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a notification for HID device changes</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Device<br />
| The HID device to notify changes for (Optional, pass nil for all HID devices)<br />
|-<br />
! Callback<br />
| The function to call when a notification event occurs<br />
|-<br />
! Data<br />
| A private data pointer to pass to callback when a notification event occurs<br />
|-<br />
! Notification<br />
| The events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER)<br />
|-<br />
! Flags<br />
| The flags to control the notification (eg NOTIFIER_FLAG_WORKER)<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''HID consumer functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerCreate:PHIDConsumer;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new HID Consumer entry</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Return<br />
| Pointer to new Consumer entry or nil if consumer could not be created<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerCreateEx(Size:LongWord):PHIDConsumer;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new HID Consumer entry</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Size<br />
| Size in bytes to allocate for new consumer (Including the consumer entry)<br />
|-<br />
! Return<br />
| Pointer to new Consumer entry or nil if consumer could not be created<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerDestroy(Consumer:PHIDConsumer):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Destroy an existing HID Consumer entry</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerRegister(Consumer:PHIDConsumer):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a new Consumer in the HID Consumer table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerDeregister(Consumer:PHIDConsumer):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Deregister a Consumer from the HID Consumer table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerFind(ConsumerId:LongWord):PHIDConsumer;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a consumer by Id in the HID Consumer table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerFindByName(const Name:String):PHIDConsumer; inline;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Find a consumer by name in the Driver table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerEnumerate(Callback:THIDConsumerEnumerate; Data:Pointer):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Enumerate all consumers in the HID Consumer table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''HID helper functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDIsBitField(Field:PHIDField):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return True if the supplied field contains a 1 bit value</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDIsByteField(Field:PHIDField):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return True if the supplied HID field contains a 1 byte value</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDIsWordField(Field:PHIDField):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return True if the supplied HID field contains a 2 byte value</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDIsLongField(Field:PHIDField):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return True if the supplied HID field contains a 3 or 4 byte value</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDIsSignedField(Field:PHIDField):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return True if the supplied HID field contains a signed value</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDPageToString(Page:Word):String;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing a HID usage page</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDUsageToString(Page,Usage,Count:Word):String;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing a HID usage within the given page</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDUnitTypeToString(UnitType:LongWord):String;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing a HID unit type</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDReportKindToString(Kind:Byte):String;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing a HID report type</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDReportFlagsToString(Flags:LongWord):String;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the flags of a HID report</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDCollectionFlagsToString(Flags:LongWord):String;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the flags of a HID collection</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure HIDLog(Level:LongWord; Device:PHIDDevice; const AText:String);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure HIDLogInfo(Device:PHIDDevice; const AText:String);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure HIDLogWarn(Device:PHIDDevice; const AText:String);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure HIDLogError(Device:PHIDDevice; const AText:String);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure HIDLogDebug(Device:PHIDDevice; const AText:String);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''HID device helper functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceGetCount:LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current HID Device count</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceCheck(Device:PHIDDevice):PHIDDevice;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the supplied HID Device is in the device table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceTypeToString(HIDType:LongWord):String;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the HID device type (eg HID_TYPE_USB)</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceStateToString(HIDState:LongWord):String;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return a string describing the HID device state (eg HID_STATE_ATTACHED)</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDDeviceStateToNotification(State:LongWord):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Convert a Device state value into the notification code for device notifications</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''HID consumer helper functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerGetCount:LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current HID Consumer count</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDConsumerCheck(Consumer:PHIDConsumer):PHIDConsumer;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the supplied HID Consumer is in the consumer table</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
Return to [[Unit_Reference|Unit Reference]]</div>
Ultibo
https://ultibo.org/wiki/Unit_HIDMOUSE
Unit HIDMOUSE
2022-10-14T04:57:12Z
<p>Ultibo: </p>
<hr />
<div>Return to [[Unit_Reference|Unit Reference]]<br />
<br />
<br />
=== Description ===<br />
----<br />
<br />
'''Ultibo HID Mouse Consumer unit'''<br />
<br />
This is a consumer for any generic HID mouse device, it accepts HID application collections in the generic desktop page (HID_PAGE_GENERIC_DESKTOP) with the usage set to mouse (HID_DESKTOP_MOUSE).<br />
<br />
The consumer will bind to any mouse collection that implements at a minimum the X and Y axis and the primary button. However the data reported can include X, Y and wheel as well as up to 5 buttons including left, right and middle.<br />
<br />
A mouse can report either absolute or relative positioning, an absolute position for X, Y or wheel will be reported in the buttons field of the mouse data packet using the MOUSE_ABSOLUTE_* flags.<br />
<br />
=== Constants ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID mouse specific constants''' <code> HID_MOUSE_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>HID_MOUSE_CONSUMER_NAME = 'HID Mouse Consumer';</code><br />
| Name of HID Mouse consumer<br />
|-<br />
| <code>HID_MOUSE_DESCRIPTION = 'HID Mouse';</code><br />
| Description of HID Mouse device<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Type definitions ===<br />
----<br />
<br />
<br />
'''HID mouse device'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDMouseDevice = ^THIDMouseDevice;</code><br />
<br />
<code>THIDMouseDevice = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|''Mouse Properties''<br />
|-<br />
| <code>Mouse:TMouseDevice;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|''HID Properties''<br />
|-<br />
| <code>Collection:PHIDCollection;</code><br />
| The HID collection this mouse is bound to<br />
|-<br />
| <code>Definitions:PHIDDefinition;</code><br />
| The input report definitions that can be accepted as mouse reports<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Public variables ===<br />
----<br />
<br />
''None defined''<br />
<br />
=== Function declarations ===<br />
----<br />
<br />
<br />
'''Initialization functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure HIDMouseInit;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the HID Mouse unit and HID Mouse driver</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Called only during system startup<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''HID mouse helper functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDMouseCheckCollection(Collection:PHIDCollection):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if a HID collection is suitable for use as a mouse device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDMouseCheckDefinition(Definition:PHIDDefinition):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if a HID definition is suitable for use as a mouse input report</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
Return to [[Unit_Reference|Unit Reference]]</div>
Ultibo
https://ultibo.org/wiki/Unit_HIDKEYBOARD
Unit HIDKEYBOARD
2022-10-14T04:56:43Z
<p>Ultibo: </p>
<hr />
<div>Return to [[Unit_Reference|Unit Reference]]<br />
<br />
<br />
=== Description ===<br />
----<br />
<br />
'''Ultibo HID Keyboard Consumer unit'''<br />
<br />
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).<br />
<br />
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.<br />
<br />
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.<br />
<br />
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.<br />
<br />
=== Constants ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"><br />
<div style="font-size: 14px; padding-left: 12px;">'''HID keyboard specific constants''' <code> HID_KEYBOARD_* </code></div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| <code>HID_KEYBOARD_CONSUMER_NAME = 'HID Keyboard Consumer';</code><br />
| Name of HID Keyboard consumer<br />
|-<br />
| <code>HID_KEYBOARD_DESCRIPTION = 'HID Keyboard';</code><br />
| Description of HID Keyboard device<br />
|-<br />
| <code>HID_KEYBOARD_MAX_KEYS = 16;</code><br />
| Maximum number of keys allowed in any report<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Type definitions ===<br />
----<br />
<br />
<br />
'''HID keyboard keys'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDKeyboardKeys = ^THIDKeyboardKeys;</code><br />
<br />
<code>THIDKeyboardKeys = array[0..HID_KEYBOARD_MAX_KEYS - 1] of Byte;</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
| &nbsp;<br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|}<br />
</div></div> <br />
<br />
'''HID keyboard device'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<code>PHIDKeyboardDevice = ^THIDKeyboardDevice;</code><br />
<br />
<code>THIDKeyboardDevice = record</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|''Keyboard Properties''<br />
|-<br />
| <code>Keyboard:TKeyboardDevice;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|''HID Properties''<br />
|-<br />
| <code>Collection:PHIDCollection;</code><br />
| The HID collection this keyboard is bound to<br />
|-<br />
| <code>Definitions:PHIDDefinition;</code><br />
| The input report definitions that can be accepted as keyboard reports<br />
|-<br />
| <code>LEDDefinition:PHIDDefinition;</code><br />
| The report definition that corresponds to the LED output<br />
|-<br />
| <code>LastCode:Word;</code><br />
| The scan code of the last key pressed<br />
|-<br />
| <code>LastCount:LongWord;</code><br />
| The repeat count of the last key pressed<br />
|-<br />
| <code>LastKeys:THIDKeyboardKeys;</code><br />
| The keys from the last keyboard report received<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Public variables ===<br />
----<br />
<br />
''None defined''<br />
<br />
=== Function declarations ===<br />
----<br />
<br />
<br />
'''Initialization functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">procedure HIDKeyboardInit;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the HID Keyboard unit and HID Keyboard driver</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Called only during system startup<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''HID keyboard functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDKeyboardDeviceControl(Keyboard:PKeyboardDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of KeyboardDeviceControl API for HID Keyboard</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| Not intended to be called directly by applications, use KeyboardDeviceControl instead.<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
'''HID keyboard helper functions'''<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDKeyboardCheckCollection(Collection:PHIDCollection):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if a HID collection is suitable for use as a keyboard device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDKeyboardCheckInputDefinition(Definition:PHIDDefinition):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if a HID definition is suitable for use as a keyboard input report</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDKeyboardCheckOutputDefinition(Definition:PHIDDefinition):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if a HID definition is suitable for use as a keyboard output (LED) report</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDKeyboardCheckPressed(Keyboard:PHIDKeyboardDevice; ScanCode:Byte):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the passed scan code has been pressed (True if not pressed in last report</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Keyboard<br />
| The HID keyboard device to check for<br />
|-<br />
! ScanCode<br />
| The keyboard scan code to check<br />
|-<br />
! Note<br />
| Caller must hold the keyboard lock<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDKeyboardCheckRepeated(Keyboard:PHIDKeyboardDevice; ScanCode:Byte):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the passed scan code was the last key pressed and if the repeat delay has expired</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Keyboard<br />
| The HID keyboard device to check for<br />
|-<br />
! ScanCode<br />
| The keyboard scan code to check<br />
|-<br />
! Note<br />
| Caller must hold the keyboard lock<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDKeyboardCheckReleased(Keyboard:PHIDKeyboardDevice; Keys:PHIDKeyboardKeys; ScanCode:Byte):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the passed scan code has been released (True if not pressed in current report)</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Keyboard<br />
| The HID keyboard device to check for<br />
|-<br />
! Keys<br />
| The HID keyboard keys to compare against (Current)<br />
|-<br />
! ScanCode<br />
| The keyboard scan code to check<br />
|-<br />
! Note<br />
| Caller must hold the keyboard lock<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDKeyboardDeviceSetLEDs(Keyboard:PHIDKeyboardDevice; LEDs:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the state of the LEDs for a HID keyboard device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Keyboard<br />
| The HID keyboard device to set the LEDs for<br />
|-<br />
! LEDs<br />
| The LED state to set (eg KEYBOARD_LED_NUMLOCK)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function HIDKeyboardDeviceSetIdle(Keyboard:PHIDKeyboardDevice; Duration,ReportId:Byte):LongWord;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the idle duration (Time between reports when no changes) for a HID keyboard device</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Keyboard<br />
| The HID keyboard device to set the idle duration for<br />
|-<br />
! Duration<br />
| The idle duration to set (Milliseconds divided by 4)<br />
|-<br />
! ReportId<br />
| The report Id to set the idle duration for (eg HID_REPORTID_NONE)<br />
|-<br />
! Return<br />
| ERROR_SUCCESS if completed or another error code on failure<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
Return to [[Unit_Reference|Unit Reference]]</div>
Ultibo
https://ultibo.org/wiki/TWebStatusHID
TWebStatusHID
2022-10-14T04:34:20Z
<p>Ultibo: Created page with "Return to Unit WebStatus __TOC__ === Description === ---- ''To be documented'' === Class definitions === ---- <div class="toccolours mw-collapsible m..."</p>
<hr />
<div>Return to [[Unit_WebStatus|Unit WebStatus]]<br />
<br />
<br />
__TOC__<br />
<br />
=== Description ===<br />
----<br />
<br />
''To be documented''<br />
<br />
=== Class definitions ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"><br />
<br />
<code>TWebStatusHID = class(TWebStatusSub)</code><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div><br />
|-<br />
| <code>constructor Create(AMain:TWebStatusMain);</code><br />
| style="width: 50%;"|&nbsp;<br />
|-<br />
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div><br />
|-<br />
| <code>function HIDFlagsToFlagNames(AFlags:LongWord):TStringList;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div><br />
|-<br />
| <code>function DoGet(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean; override;</code><br />
| &nbsp;<br />
|-<br />
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div><br />
|-<br />
|colspan="2"|&nbsp;<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
=== Function declarations ===<br />
----<br />
<br />
<br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">constructor TWebStatusHID.Create(AMain:TWebStatusMain);</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function TWebStatusHID.HIDFlagsToFlagNames(AFlags:LongWord):TStringList;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"><br />
<pre style="border: 0; padding-bottom:0px;">function TWebStatusHID.DoGet(AHost:THTTPHost; ARequest:THTTPServerRequest; AResponse:THTTPServerResponse):Boolean;</pre><br />
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div><br />
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"><br />
{| class="wikitable" style="font-size: 14px; background: white;"<br />
|-<br />
! Note<br />
| None documented<br />
|-<br />
|}<br />
</div></div><br />
<br /><br />
<br />
Return to [[Unit_Reference|Unit Reference]]</div>
Ultibo