87 lines
2.4 KiB
ObjectPascal
87 lines
2.4 KiB
ObjectPascal
unit m.led;
|
|
|
|
interface
|
|
uses
|
|
m.base,
|
|
m.led.types;
|
|
|
|
type
|
|
TmodLED = class( TmodBase, ILED)
|
|
// ------------------------------------------------------------
|
|
// ILED
|
|
// ------------------------------------------------------------
|
|
procedure LedOn( led: byte);
|
|
procedure LedOff(led: byte);
|
|
end;
|
|
|
|
|
|
implementation
|
|
uses
|
|
Windows;
|
|
|
|
function CyWORD( value: word): word;
|
|
begin
|
|
result := (LoByte(value) shl 8) or HiByte(value);
|
|
end;
|
|
|
|
|
|
{ TmodLED }
|
|
|
|
// ================================================================================================
|
|
// led on
|
|
// ================================================================================================
|
|
procedure TmodLED.LedOn( LED: byte);
|
|
var
|
|
cnt : cardinal;
|
|
w : word;
|
|
|
|
begin
|
|
cnt := 0;
|
|
w := CyWord((LED shl 8) +1);
|
|
|
|
assert( fDevice <> nil);
|
|
|
|
with fDevice do
|
|
if (VendorID = $16d0) and (ProductID = $0712) then
|
|
Pipe0.Transfer( $00, // OUT
|
|
LCD_LED, //
|
|
w, // Value
|
|
$0000, // Index (not used)
|
|
$0000, // Length (not used)
|
|
|
|
nil, // Buffer to receive data
|
|
0, // Length of buffer
|
|
cnt, // Transferred bytes
|
|
nil) // Overlapped (not used)
|
|
end;
|
|
|
|
// ================================================================================================
|
|
// led off
|
|
// ================================================================================================
|
|
procedure TmodLED.LedOff( LED: byte);
|
|
var
|
|
cnt : cardinal;
|
|
w : word;
|
|
|
|
begin
|
|
cnt := 0;
|
|
w := CyWord(LED shl 8);
|
|
|
|
assert( fDevice <> nil);
|
|
|
|
with fDevice do
|
|
if (VendorID = $16d0) and (ProductID = $0712) then
|
|
Pipe0.Transfer( $00, // OUT
|
|
LCD_LED, //
|
|
w, // Value
|
|
$0000, // Index (not used)
|
|
$0000, // Length (not used)
|
|
|
|
nil, // Buffer to receive data
|
|
0, // Length of buffer
|
|
cnt, // Transferred bytes
|
|
nil) // Overlapped (not used)
|
|
end;
|
|
|
|
end.
|