Keyboard.device
Revision as of 18:56, 21 March 2015 by Molly (talk | contribs) (→Example: Show active keyboard matrix: Added)
Short explanatory description not available.
Description
There's no description available.
Usage
There is no usage information available.
Examples
Example: Show active keyboard matrix
Small example that shows how to read and display the current keyboard matrix. Note that the matrix result only contains the current keys being pressed.
program ShowActiveMatrix;
{$MODE OBJFPC}{$H+}
Uses
sysutils,
exec, amigados,
aros_device_keyboard;
procedure doTest;
Type
IOStd = Type PIOStdReq;
Var
mp : pMsgPort;
io : pIORequest = nil;
i : integer;
matrix : packed Array [0..Pred(KB_MATRIXSIZE)] of byte;
begin
mp := CreateMsgPort;
if (Mp <> Nil) then
begin
io := CreateIORequest(mp, sizeof (TIOStdReq));
if (io <> nil) then
begin
If (0 = OpenDevice('keyboard.device', 0, io, 0)) then
begin
writeln('checking keyboard matrix');
ioStd(io)^.io_Command := KBD_READMATRIX;
ioStd(io)^.io_Data := @matrix[0];
ioStd(io)^.io_Length := SizeOf(Matrix);
DoIO(io);
if (0 = io^.io_Error) then
begin
Write('Matrix: ');
for i := 0 to ioStd(io)^.io_Actual - 1 do
begin
Write('0x', IntToHex(matrix[i], 2), ' ');
end;
end;
CloseDevice(io);
end;
DeleteIORequest(io);
end;
DeleteMsgPort(mp);
end;
end;
begin
writeln('enter');
DoTest;
writeln('leave');
end.
Example: ( insert example title )
There's no example available.
Example: ( insert example title )
There's no example available.
The unit
The header unit source-code is not available.
unit aros_device_keyboard;
{$MODE OBJFPC}{$H+}
interface
Uses
Exec;
Const
//**********************************************************************
//********************** Keyboard Device Commands **********************
//**********************************************************************/
KBD_READEVENT = (CMD_NONSTD + 0);
KBD_READMATRIX = (CMD_NONSTD + 1);
KBD_ADDRESETHANDLER = (CMD_NONSTD + 2);
KBD_REMRESETHANDLER = (CMD_NONSTD + 3);
KBD_RESETHANDLERDONE = (CMD_NONSTD + 4);
implementation
end.
Unit documentation
Currently there's no Free Pascal specific documentation available for this unit. Please consult the original SDK.