text
stringlengths
0
234
-------------------
-- Set_FIFO_Mode --
-------------------
procedure Set_FIFO_Mode
(This : in out Three_Axis_Gyroscope;
Mode : FIFO_Modes)
is
FIFO : UInt8;
begin
Read (This, FIFO_CTRL, FIFO);
FIFO := FIFO and (not FIFO_Mode_Bits); -- clear the current bits
FIFO := FIFO or Mode'Enum_Rep;
Write (This, FIFO_CTRL, FIFO);
end Set_FIFO_Mode;
-----------------
-- Enable_FIFO --
-----------------
procedure Enable_FIFO (This : in out Three_Axis_Gyroscope) is
Ctrl5 : UInt8;
begin
Read (This, CTRL_REG5, Ctrl5);
Ctrl5 := Ctrl5 or FIFO_Enable_Bit;
Write (This, CTRL_REG5, Ctrl5);
end Enable_FIFO;
------------------
-- Disable_FIFO --
------------------
procedure Disable_FIFO (This : in out Three_Axis_Gyroscope) is
Ctrl5 : UInt8;
begin
Read (This, CTRL_REG5, Ctrl5);
Ctrl5 := Ctrl5 and (not FIFO_Enable_Bit);
Write (This, CTRL_REG5, Ctrl5);
end Disable_FIFO;
------------------------
-- Set_FIFO_Watermark --
------------------------
procedure Set_FIFO_Watermark
(This : in out Three_Axis_Gyroscope;
Level : FIFO_Level)
is
Value : UInt8;
begin
Read (This, FIFO_CTRL, Value);
Value := Value and (not Watermark_Threshold_Bits); -- clear the bits
Value := Value or UInt8 (Level);
Write (This, FIFO_CTRL, Value);
end Set_FIFO_Watermark;
------------------------------
-- Get_Raw_Angle_Rates_FIFO --
------------------------------
procedure Get_Raw_Angle_Rates_FIFO
(This : in out Three_Axis_Gyroscope;
Buffer : out Angle_Rates_FIFO_Buffer)
is
Ctrl4 : UInt8;
Angle_Rate_Size : constant Integer := 6; -- UInt8s
UInt8s_To_Read : constant Integer := Buffer'Length * Angle_Rate_Size;
Received : SPI_Data_8b (0 .. UInt8s_To_Read - 1)
with Alignment => 2;
begin
Read (This, CTRL_REG4, Ctrl4);
Read_UInt8s (This, OUT_X_L, Received, UInt8s_To_Read);
if (Ctrl4 and Endian_Selection_Mask) = L3GD20_Big_Endian'Enum_Rep then
declare
J : Integer := 0;
begin
for K in Received'First .. Received'Last / 2 loop
Swap2 (Received (J)'Address);
J := J + 2;
end loop;
Function Definition: function Read_Revision (This : VL53L0X_Ranging_Sensor) return HAL.UInt8
Function Body: is
Ret : UInt8;
Status : Boolean;
begin
Read (This, REG_IDENTIFICATION_REVISION_ID, Ret, Status);
if not Status then
return 0;
else
return Ret;
end if;
end Read_Revision;
------------------------
-- Set_Device_Address --