Skip to main content

Touch Class

Package: GHIElectronics.Endpoint.Devices.Touch
Namespace: GHIElectronics.Endpoint.Devices.Touch

A touchscreen on the board. This class is abstract: the library ships one concrete subclass, Touch.InputTouch, for touchscreens the kernel exposes at /dev/input/eventN (USB HID touchscreens). All other touch controllers (SPI chips like XPT2046, I2C chips like FT5x06 or GT911, custom boards) are the customer's own subclass code using the Core Spi/I2c/Gpio APIs. Interrupt-based drivers are first class: GpioPin.ValueChanged wakes the touch thread the moment the chip pulls the IRQ line. Subclasses raise Touch.OnChangedEvent by calling Touch.RaiseChanged from their reader loop or interrupt handler.

public abstract class Touch : IDisposable

Constructors​

Touch()​

protected Touch()

Properties​

Connected​

public bool Connected { get; }

True while the touchscreen is physically present and responding.

Returns bool

Height​

public int Height { get; }

Visible height of the touchscreen area, in pixels.

Returns int

Width​

public int Width { get; }

Visible width of the touchscreen area, in pixels.

Returns int

Methods​

Dispose()​

public abstract void Dispose()

Releases the touchscreen handle and stops the reader thread.

GetDefault()​

public static Touch GetDefault()

The first kernel-exposed touchscreen the library can find at /dev/input/eventN, or null if none is present. Used for USB touchscreens; the on-board panel's chip is the customer's own subclass and does not come through here.

Returns Touch

RaiseChanged(TouchEventArgs e)​

protected void RaiseChanged(TouchEventArgs e)

Subclasses call this to emit a touch event to the user.

Events​

OnChangedEvent​

public event TouchChangedEventHandler OnChangedEvent

Fired on every change in finger state (press / move / release).