text
stringlengths
0
234
Period := Period * UInt32 (Osc_Calibrate_Val);
end if;
if Status then
Write
(This, REG_SYSTEM_INTERMEASUREMENT_PERIOD, Period, Status);
end if;
end Set_Inter_Measurement_Period_Milliseconds;
begin
Set_Inter_Measurement_Period_Milliseconds;
if Status then
Write (This,
REG_SYSRANGE_START,
UInt8'(REG_SYSRANGE_MODE_TIMED),
Status);
end if;
Function Definition: function To_U32 is new Ada.Unchecked_Conversion
Function Body: (Fix_Point_16_16, UInt32);
Val : UInt16;
Status : Boolean;
begin
-- Expecting Fixed Point 9.7
Val := UInt16 (Shift_Right (To_U32 (Limit_Mcps), 9) and 16#FF_FF#);
Write (This,
REG_FINAL_RANGE_CONFIG_MIN_COUNT_RATE_RTN_LIMIT,
Val,
Status);
return Status;
end Set_Signal_Rate_Limit;
---------------
-- SPAD_Info --
---------------
function SPAD_Info
(This : VL53L0X_Ranging_Sensor;
SPAD_Count : out HAL.UInt8;
Is_Aperture : out Boolean) return Boolean
is
Status : Boolean;
Tmp : 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#FF#, UInt8'(16#06#), Status);
end if;
if Status then
Read (This, 16#83#, Tmp, Status);
end if;
if Status then
Write (This, 16#83#, Tmp or 16#04#, Status);
end if;
if Status then
Write (This, 16#FF#, UInt8'(16#07#), Status);
end if;
if Status then
Write (This, 16#81#, UInt8'(16#01#), Status);
end if;
if Status then
Write (This, 16#80#, UInt8'(16#01#), Status);
end if;
if Status then
Write (This, 16#94#, UInt8'(16#6B#), Status);
end if;
if Status then
Write (This, 16#83#, UInt8'(16#00#), Status);
end if;
loop
exit when not Status;
Read (This, 16#83#, Tmp, Status);
exit when Tmp /= 0;
end loop;
if Status then
Write (This, 16#83#, UInt8'(16#01#), Status);
end if;
if Status then
Read (This, 16#92#, Tmp, Status);
end if;
if Status then
SPAD_Count := Tmp and 16#7F#;
Is_Aperture := (Tmp and 16#80#) /= 0;
Write (This, 16#81#, UInt8'(16#00#), Status);
end if;
if Status then
Write (This, 16#FF#, UInt8'(16#06#), Status);
end if;