Difference between revisions of "Unit PS2"

From Ultibo.org
Jump to: navigation, search
 
Line 627: Line 627:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<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 PS2MousePacketToMouseData(MousePacket:PPS2MousePacket; MouseData:PMouseData; Flags:LongWord):LongWord;</pre>
+
<pre style="border: 0; padding-bottom:0px;">function PS2MousePacketToMouseData(MousePacket:PPS2MousePacket; MouseData:PMouseData; Flags,Rotation:LongWord):LongWord;</pre>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Translate a PS/2 Mouse Packet into a Mouse Data structure</div>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Translate a PS/2 Mouse Packet into a Mouse Data structure</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
Line 640: Line 640:
 
! Flags
 
! Flags
 
| The Mouse device flags (eg MOUSE_FLAG_SWAP_BUTTONS)
 
| The Mouse device flags (eg MOUSE_FLAG_SWAP_BUTTONS)
 +
|-
 +
! Rotation
 +
| The Mouse device rotation setting (eg MOUSE_ROTATION_180)
 
|-
 
|-
 
! Return
 
! Return

Latest revision as of 04:45, 13 September 2022

Return to Unit Reference


Description


PS2 Keyboard/Mouse Controller Support unit

This unit provides supporting functions and definitions for PS/2 keyboard and mouse controller drivers.

The constants defined here are not a complete set but represent the most commonly used PS/2 functions and operations. Of most importance is the mouse packet and the keyboard scancode structures which provide support for receiving the actual data from a keyboard or a mouse.

This unit also includes the PS/2 scancode sets which define the actual values that are received in response to each key press and release. Currently only scancode set 2 is defined as in many instances that is considered the standard scancode set and some devices simply do not support scancode set 1 or 3.

Constants



[Expand]
PS2 keyboard command PS2_KEYBOARD_COMMAND_*


[Expand]
PS2 keyboard set LEDs PS2_KEYBOARD_SET_LEDS_*


[Expand]
PS2 keyboard scancode PS2_KEYBOARD_SCANCODE_*


[Expand]
PS2 keyboard set mask PS2_KEYBOARD_SET_*_MASK


[Expand]
PS2 keyboard set repeat rate PS2_KEYBOARD_SET_REPEAT_RATE_*


[Expand]
PS2 keyboard set delay PS2_KEYBOARD_SET_DELAY_*


[Expand]
PS2 mouse command PS2_MOUSE_COMMAND_*


[Expand]
PS2 response constants PS2_RESPONSE_*


[Expand]
PS2 mouse packets PS2_MOUSE_BITS_*


[Expand]
PS2 keyboard scancode types PS2_SCANCODE_MAKE*


[Expand]
PS2 keyboard scancode counts PS2_SCANCODE_*_COUNT


Type definitions



PS2 scancode data

[Expand]

PPS2ScancodeData = ^TPS2ScancodeData;

TPS2ScancodeData = array[0..(PS2_SCANCODE_COUNT * 2) - 1] of array[0..9] of Byte;

Keyboard scancode

[Expand]

PPS2KeyboardScancode = ^TPS2KeyboardScancode;

TPS2KeyboardScancode = record

Mouse packet types

[Expand]

PPS2MousePacket = ^TPS2MousePacket;

TPS2MousePacket = record


Public variables


None defined

Function declarations



PS2 helper functions

[Expand]
function KeyboardLEDsToPS2LEDs(LEDs:LongWord; var PS2LEDs:Byte):LongWord;
Description: Map the Keyboard LED values to the PS/2 Keyboard LED values


[Expand]
function KeyboardRateAndDelayToPS2Typematic(Rate,Delay:LongWord; var PS2Typematic:Byte):LongWord;
Description: Translate the Keyboard Repeat Rate and Delay values to the PS/2 Keyboard Typematic value


[Expand]
function PS2KeyboardScancodeMatch(KeyboardScancode:PPS2KeyboardScancode; var Index:LongInt):LongWord;
Description: Check a set of scancode bytes against the specified PS/2 Scancode set for a match


[Expand]
function PS2KeyboardScancodeToScanCode(KeyboardScancode:PPS2KeyboardScancode; Index:LongInt; var ScanCode:Word):LongWord;
Description: Return the Keyboard Scan Code value for a PS/2 scancode value


[Expand]
function PS2KeyboardScancodeToModifiers(KeyboardScancode:PPS2KeyboardScancode; Index:LongInt; var Modifiers:LongWord):LongWord;
Description: Return the Keyboard Modifiers flags for a PS/2 scancode value


[Expand]
function MouseSampleRateToPS2SampleRate(Rate:LongWord; var PS2Rate:Byte):LongWord;
Description: Translate a Mouse Sample Rate value to the PS/2 Mouse Sample Rate value


[Expand]
function PS2MousePacketToMouseData(MousePacket:PPS2MousePacket; MouseData:PMouseData; Flags,Rotation:LongWord):LongWord;
Description: Translate a PS/2 Mouse Packet into a Mouse Data structure


Return to Unit Reference