touchscreen - wolfen351/public-micropython-iot-platform GitHub Wiki

Overview

The touchscreen module provides functionality for interfacing with an ILI9341 display and XPT2046 touch controller. It includes utilities for rendering graphics, handling touch input, and managing fonts.

Features

  • Support for ILI9341 LCD display with RGB565 color format.
  • Touch input handling using the XPT2046 touch controller.
  • Font rendering with X-GLCD format fonts.
  • Utility for converting images to RGB565 format.

UI Hardware / Pinout Configuration

  • ILI9341 Display:
    • SPI interface
    • Pins: sck=Pin(7), mosi=Pin(11), miso=Pin(9), dc=Pin(12), cs=Pin(5), rst=Pin(0)
  • XPT2046 Touch Controller:
    • SPI interface
    • Pins: sck=Pin(7), mosi=Pin(11), miso=Pin(9), cs=Pin(18)

Telemetry Provided

  • touchX: X-coordinate of the last touch.
  • touchY: Y-coordinate of the last touch.

Telemetry Consumed

None.

Commands Provided

  • /touch/0/0: Command generated when a touch is detected.

Commands Consumed

None.

Other information

  • Font Utility: The XglcdFont class supports loading and rendering fonts in X-GLCD format.
  • Image Conversion: The img2rgb565.py script converts images to raw RGB565 format for use with the display.
  • Graphics Support: The ili9341.py module provides methods for drawing shapes, text, and images on the display.
  • Touch Handling: The xpt2046.py module handles raw and normalized touch input from the XPT2046 controller.