Unit HIDJOYSTICK

From Ultibo.org
Revision as of 04:36, 17 November 2022 by Ultibo (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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