text
stringlengths
0
234
end if;
declare
Data_X : constant TSC_Data := This.Read_Data (IOE_REG_TSC_DATA_X, 2);
Data_Y : constant TSC_Data := This.Read_Data (IOE_REG_TSC_DATA_Y, 2);
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 adainit is
Function Body: Binder_Sec_Stacks_Count : Natural;
pragma Import (Ada, Binder_Sec_Stacks_Count, "__gnat_binder_ss_count");
Default_Secondary_Stack_Size : System.Parameters.Size_Type;
pragma Import (C, Default_Secondary_Stack_Size, "__gnat_default_ss_size");
Default_Sized_SS_Pool : System.Address;
pragma Import (Ada, Default_Sized_SS_Pool, "__gnat_default_ss_pool");
begin
null;