Initial check in
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
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.
|
||||
@@ -0,0 +1,17 @@
|
||||
unit m.led.types;
|
||||
|
||||
interface
|
||||
const
|
||||
LCD_LED = $40;
|
||||
|
||||
type
|
||||
ILED = interface
|
||||
['{C3908812-2FB3-4A8F-8159-9B96E06C0659}']
|
||||
|
||||
procedure LedOn( led: byte);
|
||||
procedure LedOff(led: byte);
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
Reference in New Issue
Block a user