text
stringlengths
0
234
------------------------------------
procedure Perform_Single_Ref_Calibration
(This : VL53L0X_Ranging_Sensor;
VHV_Init : UInt8;
Status : out Boolean)
is
Val : UInt8;
begin
Write (This, REG_SYSRANGE_START, VHV_Init or 16#01#, Status);
if not Status then
return;
end if;
loop
Read (This, REG_RESULT_INTERRUPT_STATUS, Val, Status);
exit when not Status;
exit when (Val and 16#07#) /= 0;
end loop;
if not Status then
return;
end if;
Write (This, REG_SYSTEM_INTERRUPT_CLEAR, UInt8'(16#01#), Status);
if not Status then
return;
end if;
Write (This, REG_SYSRANGE_START, UInt8'(16#00#), Status);
end Perform_Single_Ref_Calibration;
-----------------------------
-- Perform_Ref_Calibration --
-----------------------------
procedure Perform_Ref_Calibration
(This : in out VL53L0X_Ranging_Sensor;
Status : out Boolean)
is
begin
-- VHV calibration
Write (This, REG_SYSTEM_SEQUENCE_CONFIG, UInt8'(16#01#), Status);
if Status then
Perform_Single_Ref_Calibration (This, 16#40#, Status);
end if;
-- Phase calibration
if Status then
Write (This, REG_SYSTEM_SEQUENCE_CONFIG, UInt8'(16#02#), Status);
end if;
if Status then
Perform_Single_Ref_Calibration (This, 16#00#, Status);
end if;
-- Restore the sequence config
if Status then
Write (This, REG_SYSTEM_SEQUENCE_CONFIG, UInt8'(16#E8#), Status);
end if;
end Perform_Ref_Calibration;
------------------------------------
-- Start_Range_Single_Millimeters --
------------------------------------
procedure Start_Range_Single_Millimeters
(This : VL53L0X_Ranging_Sensor;
Status : out Boolean)
is
Val : UInt8;
begin
Write (This, 16#80#, UInt8'(16#01#), Status);
if Status then
Write (This, 16#FF#, UInt8'(16#01#), Status);
end if;
if Status then
Write (This, 16#00#, UInt8'(16#00#), Status);
end if;
if Status then
Write (This, 16#91#, This.Stop_Variable, Status);
end if;
if Status then
Write (This, 16#00#, UInt8'(16#01#), Status);
end if;
if Status then
Write (This, 16#FF#, UInt8'(16#00#), Status);
end if;
if Status then
Write (This, 16#80#, UInt8'(16#00#), Status);
end if;
if Status then
Write (This, REG_SYSRANGE_START, UInt8'(16#01#), Status);
end if;
if not Status then