text stringlengths 0 234 |
|---|
This.IOE_AF_Config (TOUCH_IO_ALL, False); |
This.Write_Register (IOE_REG_TSC_CFG, 16#9A#); |
This.Write_Register (IOE_REG_FIFO_TH, 16#01#); |
This.Write_Register (IOE_REG_FIFO_STA, 16#01#); |
This.Write_Register (IOE_REG_FIFO_TH, 16#00#); |
This.Write_Register (IOE_REG_TSC_FRACT_Z, 16#00#); |
This.Write_Register (IOE_REG_TSC_I_DRIVE, 16#01#); |
This.Write_Register (IOE_REG_TSC_CTRL, 16#01#); |
This.Write_Register (IOE_REG_INT_STA, 16#FF#); |
return True; |
end Initialize; |
---------------- |
-- Set_Bounds -- |
---------------- |
overriding |
procedure Set_Bounds (This : in out STMPE811_Device; |
Width : Natural; |
Height : Natural; |
Swap : HAL.Touch_Panel.Swap_State) |
is |
begin |
This.LCD_Natural_Width := Width; |
This.LCD_Natural_Height := Height; |
This.Swap := Swap; |
end Set_Bounds; |
------------------------- |
-- Active_Touch_Points -- |
------------------------- |
overriding |
function Active_Touch_Points (This : in out STMPE811_Device) |
return Touch_Identifier |
is |
Val : constant UInt8 := This.Read_Register (IOE_REG_TSC_CTRL) and 16#80#; |
begin |
if Val = 0 then |
This.Write_Register (IOE_REG_FIFO_STA, 16#01#); |
This.Write_Register (IOE_REG_FIFO_STA, 16#00#); |
return 0; |
else |
return 1; |
end if; |
end Active_Touch_Points; |
--------------------- |
-- Get_Touch_Point -- |
--------------------- |
overriding |
function Get_Touch_Point (This : in out STMPE811_Device; |
Touch_Id : Touch_Identifier) |
return TP_Touch_State |
is |
State : TP_Touch_State; |
Raw_X : UInt32; |
Raw_Y : UInt32; |
Raw_Z : UInt32; |
X : Integer; |
Y : Integer; |
Tmp : Integer; |
begin |
-- Check Touch detected bit in CTRL register |
if Touch_Id /= 1 or else This.Active_Touch_Points = 0 then |
return (0, 0, 0); |
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; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.