text
stringlengths 0
234
|
|---|
return;
|
end if;
|
loop
|
Read (This, REG_SYSRANGE_START, Val, Status);
|
exit when not Status;
|
exit when (Val and 16#01#) = 0;
|
end loop;
|
end Start_Range_Single_Millimeters;
|
---------------------------
|
-- Range_Value_Available --
|
---------------------------
|
function Range_Value_Available
|
(This : VL53L0X_Ranging_Sensor) return Boolean
|
is
|
Status : Boolean with Unreferenced;
|
Val : UInt8;
|
begin
|
Read (This, REG_RESULT_INTERRUPT_STATUS, Val, Status);
|
return (Val and 16#07#) /= 0;
|
end Range_Value_Available;
|
----------------------------
|
-- Read_Range_Millimeters --
|
----------------------------
|
function Read_Range_Millimeters
|
(This : VL53L0X_Ranging_Sensor) return HAL.UInt16
|
is
|
Status : Boolean with Unreferenced;
|
Ret : HAL.UInt16;
|
begin
|
Read (This, REG_RESULT_RANGE_STATUS + 10, Ret, Status);
|
Write (This, REG_SYSTEM_INTERRUPT_CLEAR, UInt8'(16#01#), Status);
|
return Ret;
|
end Read_Range_Millimeters;
|
-----------------------------------
|
-- Read_Range_Single_Millimeters --
|
-----------------------------------
|
function Read_Range_Single_Millimeters
|
(This : VL53L0X_Ranging_Sensor) return HAL.UInt16
|
is
|
Status : Boolean;
|
begin
|
Start_Range_Single_Millimeters (This, Status);
|
if not Status then
|
return 4000;
|
end if;
|
while not Range_Value_Available (This) loop
|
null;
|
end loop;
|
return Read_Range_Millimeters (This);
|
end Read_Range_Single_Millimeters;
|
---------------------
|
-- Set_GPIO_Config --
|
---------------------
|
procedure Set_GPIO_Config
|
(This : in out VL53L0X_Ranging_Sensor;
|
Functionality : VL53L0X_GPIO_Functionality;
|
Polarity : VL53L0X_Interrupt_Polarity;
|
Status : out Boolean)
|
is
|
Data : UInt8;
|
Tmp : UInt8;
|
begin
|
case Functionality is
|
when No_Interrupt =>
|
Data := 0;
|
when Level_Low =>
|
Data := 1;
|
when Level_High =>
|
Data := 2;
|
when Out_Of_Window =>
|
Data := 3;
|
when New_Sample_Ready =>
|
Data := 4;
|
end case;
|
-- 16#04#: interrupt on new measure ready
|
Write (This, REG_SYSTEM_INTERRUPT_CONFIG_GPIO, Data, Status);
|
-- Interrupt polarity
|
if Status then
|
case Polarity is
|
when Polarity_Low =>
|
Data := 16#10#;
|
when Polarity_High =>
|
Data := 16#00#;
|
end case;
|
Read (This, REG_GPIO_HV_MUX_ACTIVE_HIGH, Tmp, Status);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.