text
stringlengths 0
234
|
|---|
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_Continuous --
|
----------------------
|
procedure Start_Continuous (This : VL53L0X.VL53L0X_Ranging_Sensor;
|
Period_Ms : HAL.UInt32;
|
Status : out Boolean) is
|
-- From vl53l0xStartContinuous() in
|
-- crazyflie-firmware/src/drivers/src/vl53l0x.c
|
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#, UInt8'(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 not Status then
|
return;
|
end if;
|
if Period_Ms /= 0 then
|
-- continuous timed mode
|
declare
|
procedure Set_Inter_Measurement_Period_Milliseconds;
|
-- The Crazyflie code indicates that this is a missing
|
-- function that they've inlined.
|
procedure Set_Inter_Measurement_Period_Milliseconds is
|
Osc_Calibrate_Val : UInt16;
|
Period : UInt32 := Period_Ms;
|
begin
|
Read (This, REG_OSC_CALIBRATE_VAL, Osc_Calibrate_Val, Status);
|
if Status and then Osc_Calibrate_Val /= 0 then
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.