text
stringlengths 0
234
|
|---|
function Initialize (This : in out STMPE811_Device) return Boolean
|
is
|
begin
|
This.Time.Delay_Milliseconds (100);
|
if This.Get_IOE_ID /= 16#0811# then
|
return False;
|
end if;
|
This.IOE_Reset;
|
This.IOE_Function_Command (IOE_ADC_FCT, True);
|
This.IOE_Function_Command (IOE_TSC_FCT, True);
|
This.Write_Register (IOE_REG_ADC_CTRL1, 16#49#);
|
This.Time.Delay_Milliseconds (2);
|
This.Write_Register (IOE_REG_ADC_CTRL2, 16#01#);
|
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);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.