Difference between revisions of "Unit HIDJOYSTICK"

From Ultibo.org
Jump to: navigation, search
(Created page with "Return to Unit Reference === Description === ---- ''To be documented'' === Constants === ---- ''To be documented'' === Type definitions === ---- ''To...")
 
 
(2 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
''To be documented''
+
'''Ultibo HID Joystick and Gamepad Consumer unit'''
 +
 
 +
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).
 +
 +
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.
 +
 +
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.
  
 
=== Constants ===
 
=== Constants ===
 
----
 
----
  
''To be documented''
+
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''HID joystick specific constants''' <code> HID_JOYSTICK_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>HID_JOYSTICK_CONSUMER_NAME = 'HID Joystick and Gamepad Consumer';</code>
 +
| Name of HID Joystick consumer
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>HID_JOYSTICK_DESCRIPTION = 'HID Joystick';</code>
 +
| Description of HID Joystick device
 +
|-
 +
| <code>HID_GAMEPAD_DESCRIPTION = 'HID Gamepad';</code>
 +
| Description of HID Gamepad device
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===
 
----
 
----
  
''To be documented''
+
 
 +
'''HID joystick device'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHIDJoystickDevice = ^THIDJoystickDevice;</code>
 +
 
 +
<code>THIDJoystickDevice = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Joystick Properties''
 +
|-
 +
| <code>Joystick:TJoystickDevice;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''HID Properties''
 +
|-
 +
| <code>Collection:PHIDCollection;</code>
 +
| The HID collection this joystick is bound to
 +
|-
 +
| <code>Definitions:PHIDDefinition;</code>
 +
| The input report definitions that can be accepted as joystick reports
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===
 
----
 
----
  
''To be documented''
+
''None defined''
  
 
=== Function declarations ===
 
=== Function declarations ===
 
----
 
----
  
''To be documented''
 
  
 +
'''Initialization functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure HIDJoystickInit;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the HID Joystick unit and HID Joystick driver</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Called only during system startup
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''HID joystick functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDJoystickStart(Joystick:PJoystickDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of JoystickDeviceStart API for HID Joystick device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Not intended to be called directly by applications, use JoystickDeviceStart instead.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDJoystickStop(Joystick:PJoystickDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of JoystickDeviceStop API for HID Joystick device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Not intended to be called directly by applications, use JoystickDeviceStop instead.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDJoystickUpdate(Joystick:PJoystickDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of JoystickDeviceUpdate API for HID Joystick device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Not intended to be called directly by applications, use JoystickDeviceUpdate instead.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''HID joystick helper functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDJoystickCheckCollection(Collection:PHIDCollection):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if a HID collection is suitable for use as a joystick device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function HIDJoystickCheckDefinition(Definition:PHIDDefinition):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if a HID definition is suitable for use as a joystick input report</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
Return to [[Unit_Reference|Unit Reference]]
 
Return to [[Unit_Reference|Unit Reference]]

Latest revision as of 04:36, 17 November 2022

Return to Unit Reference


Description


Ultibo HID Joystick and Gamepad Consumer unit

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).

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.

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.

Constants



HID joystick specific constants HID_JOYSTICK_*
HID_JOYSTICK_CONSUMER_NAME = 'HID Joystick and Gamepad Consumer'; Name of HID Joystick consumer
 
HID_JOYSTICK_DESCRIPTION = 'HID Joystick'; Description of HID Joystick device
HID_GAMEPAD_DESCRIPTION = 'HID Gamepad'; Description of HID Gamepad device


Type definitions



HID joystick device

PHIDJoystickDevice = ^THIDJoystickDevice;

THIDJoystickDevice = record

Joystick Properties
Joystick:TJoystickDevice;  
HID Properties
Collection:PHIDCollection; The HID collection this joystick is bound to
Definitions:PHIDDefinition; The input report definitions that can be accepted as joystick reports


Public variables


None defined

Function declarations



Initialization functions

procedure HIDJoystickInit;
Description: Initialize the HID Joystick unit and HID Joystick driver
Note Called only during system startup


HID joystick functions

function HIDJoystickStart(Joystick:PJoystickDevice):LongWord;
Description: Implementation of JoystickDeviceStart API for HID Joystick device
Note Not intended to be called directly by applications, use JoystickDeviceStart instead.


function HIDJoystickStop(Joystick:PJoystickDevice):LongWord;
Description: Implementation of JoystickDeviceStop API for HID Joystick device
Note Not intended to be called directly by applications, use JoystickDeviceStop instead.


function HIDJoystickUpdate(Joystick:PJoystickDevice):LongWord;
Description: Implementation of JoystickDeviceUpdate API for HID Joystick device
Note Not intended to be called directly by applications, use JoystickDeviceUpdate instead.


HID joystick helper functions

function HIDJoystickCheckCollection(Collection:PHIDCollection):LongWord;
Description: Check if a HID collection is suitable for use as a joystick device
Note None documented


function HIDJoystickCheckDefinition(Definition:PHIDDefinition):LongWord;
Description: Check if a HID definition is suitable for use as a joystick input report
Note None documented


Return to Unit Reference