text stringlengths 0 234 |
|---|
Ctrl3 : UInt8; |
begin |
Read (This, CTRL_REG3, Ctrl3); |
Ctrl3 := Ctrl3 or INT1_Interrupt_Enable; |
Write (This, CTRL_REG3, Ctrl3); |
end Enable_Interrupt1; |
------------------------ |
-- Disable_Interrupt1 -- |
------------------------ |
procedure Disable_Interrupt1 (This : in out Three_Axis_Gyroscope) is |
Ctrl3 : UInt8; |
begin |
Read (This, CTRL_REG3, Ctrl3); |
Ctrl3 := Ctrl3 and (not INT1_Interrupt_Enable); |
Write (This, CTRL_REG3, Ctrl3); |
end Disable_Interrupt1; |
----------------------- |
-- Interrupt1_Status -- |
----------------------- |
function Interrupt1_Source (This : Three_Axis_Gyroscope) return Interrupt1_Sources is |
Result : UInt8; |
function As_Interrupt_Source is new Ada.Unchecked_Conversion |
(Source => UInt8, Target => Interrupt1_Sources); |
begin |
Read (This, INT1_SRC, Result); |
return As_Interrupt_Source (Result); |
end Interrupt1_Source; |
-------------------------- |
-- Set_Duration_Counter -- |
-------------------------- |
procedure Set_Duration_Counter |
(This : in out Three_Axis_Gyroscope; |
Value : Sample_Counter) |
is |
Wait_Bit : constant := 2#1000_0000#; |
begin |
Write (This, INT1_Duration, UInt8 (Value) or Wait_Bit); |
end Set_Duration_Counter; |
------------------ |
-- Enable_Event -- |
------------------ |
procedure Enable_Event |
(This : in out Three_Axis_Gyroscope; |
Event : Axes_Interrupts) |
is |
Config : UInt8; |
begin |
Read (This, INT1_CFG, Config); |
Config := Config or Axes_Interrupt_Enablers (Event); |
Write (This, INT1_CFG, Config); |
end Enable_Event; |
------------------- |
-- Disable_Event -- |
------------------- |
procedure Disable_Event |
(This : in out Three_Axis_Gyroscope; |
Event : Axes_Interrupts) |
is |
Config : UInt8; |
begin |
Read (This, INT1_CFG, Config); |
Config := Config and (not Axes_Interrupt_Enablers (Event)); |
Write (This, INT1_CFG, Config); |
end Disable_Event; |
------------------- |
-- 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; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.