text
stringlengths 0
234
|
|---|
-- Set_Threshold --
|
-------------------
|
procedure Set_Threshold
|
(This : in out Three_Axis_Gyroscope;
|
Event : Axes_Interrupts;
|
Value : Axis_Sample_Threshold)
|
is
|
begin
|
case Event is
|
when Z_High_Interrupt | Z_Low_Interrupt =>
|
Write (This, INT1_TSH_ZL, UInt8 (Value));
|
Write (This, INT1_TSH_ZH, UInt8 (Shift_Right (Value, 8)));
|
when Y_High_Interrupt | Y_Low_Interrupt =>
|
Write (This, INT1_TSH_YL, UInt8 (Value));
|
Write (This, INT1_TSH_YH, UInt8 (Shift_Right (Value, 8)));
|
when X_High_Interrupt | X_Low_Interrupt =>
|
Write (This, INT1_TSH_XL, UInt8 (Value));
|
Write (This, INT1_TSH_XH, UInt8 (Shift_Right (Value, 8)));
|
end case;
|
end Set_Threshold;
|
-------------------
|
-- 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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.