text
stringlengths
0
234
Data_Z : constant TSC_Data := This.Read_Data (IOE_REG_TSC_DATA_Z, 1);
Z_Frac : constant TSC_Data := This.Read_Data (IOE_REG_TSC_FRACT_Z, 1);
begin
Raw_X := 2 ** 12 -
(Shift_Left (UInt32 (Data_X (1)) and 16#0F#, 8) or UInt32 (Data_X (2)));
Raw_Y :=
Shift_Left (UInt32 (Data_Y (1)) and 16#0F#, 8) or UInt32 (Data_Y (2));
Raw_Z :=
Shift_Right (UInt32 (Data_Z (1)), Natural (Z_Frac (1) and 2#111#));
Function Definition: function To_UInt16 is
Function Body: new Ada.Unchecked_Conversion (UInt16_HL_Type, UInt16);
Ret : TP_Touch_State;
Regs : FT5336_Pressure_Registers;
Tmp : UInt16_HL_Type;
Status : Boolean;
begin
-- X/Y are swaped from the screen coordinates
if Touch_Id not in FT5336_Px_Regs'Range
or else Touch_Id > This.Active_Touch_Points
then
return (0, 0, 0);
end if;
Regs := FT5336_Px_Regs (Touch_Id);
Tmp.Low := This.I2C_Read (Regs.XL_Reg, Status);
if not Status then
return (0, 0, 0);
end if;
Tmp.High := This.I2C_Read (Regs.XH_Reg, Status) and
FT5336_TOUCH_POS_MSB_MASK;
if not Status then
return (0, 0, 0);
end if;
Ret.Y := Natural (To_UInt16 (Tmp));
Tmp.Low := This.I2C_Read (Regs.YL_Reg, Status);
if not Status then
return (0, 0, 0);
end if;
Tmp.High := This.I2C_Read (Regs.YH_Reg, Status) and
FT5336_TOUCH_POS_MSB_MASK;
if not Status then
return (0, 0, 0);
end if;
Ret.X := Natural (To_UInt16 (Tmp));
Ret.Weight := Natural (This.I2C_Read (Regs.Weight_Reg, Status));
if not Status then
Ret.Weight := 0;
end if;
Ret.X :=
Natural'Min (Natural'Max (0, Ret.X), This.LCD_Natural_Width - 1);
Ret.Y :=
Natural'Min (Natural'Max (0, Ret.Y), This.LCD_Natural_Height - 1);
if (This.Swap and Invert_X) /= 0 then
Ret.X := This.LCD_Natural_Width - Ret.X - 1;
end if;
if (This.Swap and Invert_Y) /= 0 then
Ret.Y := This.LCD_Natural_Height - Ret.Y - 1;
end if;
if (This.Swap and Swap_XY) /= 0 then
declare
Tmp_X : constant Integer := Ret.X;
begin
Ret.X := Ret.Y;
Ret.Y := Tmp_X;
Function Definition: procedure Destroy is new Ada.Unchecked_Deallocation
Function Body: (File_Handle, File_Handle_Access);
procedure Destroy is new Ada.Unchecked_Deallocation
(Directory_Handle, Directory_Handle_Access);
procedure Destroy is new Ada.Unchecked_Deallocation
(Node_Handle, Node_Handle_Access);
function "<" (Left, Right : Node_Handle) return Boolean is
(Ada.Strings.Unbounded."<" (Left.Name, Right.Name));
package Node_Sorting is
new Node_Vectors.Generic_Sorting;
-- Most of the time, standard operations give us no reliable way to
-- determine specifically what triggered a failure, so use the following
-- error code as a "generic" one.