Unit Keyboard

From Ultibo.org
Revision as of 00:27, 19 August 2016 by Ultibo (Talk | contribs)

Jump to: navigation, search

Return to Unit Reference


Description



Keyboard Devices

This unit provides both the Keyboard device interface and the generic USB HID keyboard driver. The keyboard unit also provides the STDIN interface for the Run Time Library (RTL).


USB Keyboard Devices

This driver currently uses HID Boot Protocol only and could be redesigned in future to use the HID Report Protocol instead to allow for greater language support etc.

Constants


To be documented

Type definitions


To be documented

Public variables


To be documented

Function declarations



Initialization functions

[Expand]
procedure KeyboardInit;
Description: Initialize the keyboard unit, device table and USB keyboard driver


Keyboard functions

[Expand]
function KeyboardGet(var KeyCode:Word):LongWord;
Description: Get the first key code from the global keyboard buffer


[Expand]
function KeyboardPeek:LongWord;
Description: Peek at the global keyboard buffer to see if any data packets are ready


[Expand]
function KeyboardRead(Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord; inline;
Description: Read keyboard data packets from the global keyboard buffer


[Expand]
function KeyboardReadEx(Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
Description: Read keyboard data packets from the global keyboard buffer


[Expand]
function KeyboardPut(ScanCode,KeyCode:Word; Modifiers:LongWord):LongWord;
Description: Put a scan code and key code in the global keyboard buffer


[Expand]
function KeyboardWrite(Buffer:Pointer; Size,Count:LongWord):LongWord;
Description: Write keyboard data packets to the global keyboard buffer


[Expand]
function KeyboardFlush:LongWord;
Description: Flush the contents of the global keyboard buffer


[Expand]
function KeyboardDeviceGet(Keyboard:PKeyboardDevice; var KeyCode:Word):LongWord;
Description: Get the first key code from the buffer of the specified keyboard


[Expand]
function KeyboardDeviceRead(Keyboard:PKeyboardDevice; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;
Description: Read keyboard data packets from the buffer of the specified keyboard


[Expand]
function KeyboardDeviceControl(Keyboard:PKeyboardDevice; Request:Integer; Argument1:LongWord; var Argument2:LongWord):LongWord;
Description: Perform a control request on the specified keyboard device


[Expand]
function KeyboardDeviceSetState(Keyboard:PKeyboardDevice; State:LongWord):LongWord;
Description: Set the state of the specified keyboard and send a notification


[Expand]
function KeyboardDeviceCreate:PKeyboardDevice;
Description: Create a new Keyboard device entry


[Expand]
function KeyboardDeviceCreateEx(Size:LongWord):PKeyboardDevice;
Description: Create a new Keyboard device entry


[Expand]
function KeyboardDeviceDestroy(Keyboard:PKeyboardDevice):LongWord;
Description: Destroy an existing Keyboard device entry


[Expand]
function KeyboardDeviceRegister(Keyboard:PKeyboardDevice):LongWord;
Description: Register a new Keyboard device in the Keyboard table


[Expand]
function KeyboardDeviceDeregister(Keyboard:PKeyboardDevice):LongWord;
Description: Deregister a Keyboard device from the Keyboard table


[Expand]
function KeyboardDeviceFind(KeyboardId:LongWord):PKeyboardDevice;
Description: Find a keyboard device by ID in the keyboard table


[Expand]
function KeyboardDeviceFindByName(const Name:String):PKeyboardDevice; inline;
Description: Find a keyboard device by name in the keyboard table


[Expand]
function KeyboardDeviceFindByDescription(const Description:String):PKeyboardDevice; inline;
Description: Find a keyboard device by description in the keyboard table


[Expand]
function KeyboardDeviceEnumerate(Callback:TKeyboardEnumerate; Data:Pointer):LongWord;
Description: Enumerate all keyboard devices in the keyboard table


[Expand]
function KeyboardDeviceNotification(Keyboard:PKeyboardDevice; Callback:TKeyboardNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: Register a notification for keyboard device changes


RTL console functions

[Expand]
function SysConsoleGetKey(var ACh:Char; AUserData:Pointer):Boolean;
Description: Handler for Platform ConsoleGetKey function


[Expand]
function SysConsolePeekKey(var ACh:Char; AUserData:Pointer):Boolean;
Description: Handler for Platform ConsolePeekKey function


[Expand]
function SysConsoleReadChar(var ACh:Char; AUserData:Pointer):Boolean;
Description: Handler for Platform ConsoleReadChar function


[Expand]
function SysConsoleReadWideChar(var ACh:WideChar; AUserData:Pointer):Boolean;
Description: Handler for Platform ConsoleReadWideChar function


USB keyboard functions

[Expand]
function USBKeyboardDeviceRead(Keyboard:PKeyboardDevice; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;
Description: Implementation of KeyboardDeviceRead API for USB Keyboard


[Expand]
function USBKeyboardDeviceControl(Keyboard:PKeyboardDevice; Request:Integer; Argument1:LongWord; var Argument2:LongWord):LongWord;
Description: Implementation of KeyboardDeviceControl API for USB Keyboard


[Expand]
function USBKeyboardDriverBind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Bind the Keyboard driver to a USB device if it is suitable


[Expand]
function USBKeyboardDriverUnbind(Device:PUSBDevice; Interrface:PUSBInterface):LongWord;
Description: Unbind the Keyboard driver from a USB device


[Expand]
procedure USBKeyboardReportWorker(Request:PUSBRequest);
Description: Called (by a Worker thread) to process a completed USB request from a USB keyboard IN interrupt endpoint


[Expand]
procedure USBKeyboardReportComplete(Request:PUSBRequest);
Description: Called when a USB request from a USB keyboard IN interrupt endpoint completes



Return to Unit Reference