gt911 — GT911 5-Point Capacitive Touch Controller¶
class GT911 – 5-Point Capacitive Touch Controller¶
- class gt911.GT911(bus: machine.I2C, reset_pin: int | str, irq_pin: int | str, address: int = _DEFAULT_ADDR, width: int = 800, height: int = 480, touch_points: int = 1, reverse_x: bool = False, reverse_y: bool = False, reverse_axis: bool = True, sito: bool = True, refresh_rate: int = 240, touch_callback: Callable | None = None)¶
Creates a GT911 touch screen controller object.
busis themachine.I2Cbus object the GT911 is attached to.reset_pinis the pin number or name (not aPinobject) connected to the GT911 reset line. The driver needs to change pin direction during reset.irq_pinis the pin number or name (not aPinobject) connected to the GT911 interrupt line. The driver needs to change pin direction during reset.addressis the I2C address of the controller. Defaults togt911._DEFAULT_ADDR.widthis the touch panel resolution along the X axis in pixels.heightis the touch panel resolution along the Y axis in pixels.touch_pointsis the maximum number of simultaneous touch points to report (1 to 5).reverse_xif True flips the X axis.reverse_yif True flips the Y axis.reverse_axisif True swaps the X and Y axes.sitoenables the controller’s Single-Input-Touch-Output mode when True.refresh_rateis the touch report rate in Hz.touch_callbackis an optional callable invoked on the falling edge of the IRQ pin when a touch event occurs. PassNoneto use polling mode.- read_points() tuple¶
Returns a tuple
(n, points)wherenis the number of active touch points andpointsis a list of 5array("H", ...)entries. Each entry contains[x, y, size, id]:xandyare the screen coordinates,sizeis the touch pressure, andidis a unique tracking ID that remains stable for a given finger across reads.Only the first
nentries ofpointscontain valid data.