40 lines
1.3 KiB
ObjectPascal
40 lines
1.3 KiB
ObjectPascal
unit mr.trinity.utils;
|
|
|
|
interface
|
|
uses
|
|
mr.trinity.consts,
|
|
mr.trinity.types;
|
|
|
|
function DecodeCapabilities( caps: Int64 ): TCapabilities;
|
|
function EncodeCapabilities( caps: TCapabilities): Int64;
|
|
|
|
implementation
|
|
|
|
// ================================================================================================
|
|
// EncodeCapabilities
|
|
// ================================================================================================
|
|
function EncodeCapabilities( caps: TCapabilities): Int64;
|
|
begin
|
|
result := 0;
|
|
|
|
if capJTAG in caps then result := result or bmCap0_JTG;
|
|
end;
|
|
|
|
// ================================================================================================
|
|
// DecodeCapabilities
|
|
// ================================================================================================
|
|
function DecodeCapabilities( caps: Int64): TCapabilities;
|
|
begin
|
|
result := [];
|
|
|
|
if( caps and bmCap0_I2C ) <> 0 then Include( result, capIIC );
|
|
if( caps and bmCap0_SER ) <> 0 then Include( result, capSER );
|
|
if( caps and bmCap0_EPR ) <> 0 then Include( result, capEEPROM );
|
|
if( caps and bmCap0_RAM ) <> 0 then Include( result, capRAM );
|
|
if( caps and bmCap0_JTG ) <> 0 then Include( result, capJTAG );
|
|
|
|
if( caps and bmCap1_LCD ) <> 0 then Include( result, capLCD );
|
|
end;
|
|
|
|
end.
|