wvirgil123/esp_lcd_touch_gsl3670

1.0.0

Latest
uploaded 1 day ago
GSL3670 multi-touch controller driver for the Seeed reTerminal D1001

Readme

# esp_lcd_touch_gsl3670

ESP-IDF touch driver for the **GSL3670** controller used on the
[Seeed reTerminal D1001](https://www.seeedstudio.com/reTerminal-D1001-p-6729.html)
(ESP32-P4, 800x1280 MIPI-DSI panel).

The component wraps Silead's GSL3670 point algorithm in the standard
`esp_lcd_touch` interface and adds the pieces needed by embedded hosts:

- loads and verifies the controller firmware at initialization;
- up to three simultaneous contacts with stable track IDs;
- reset through a board callback (the D1001 reset line is on its PCA9535
  expander, not a GPIO);
- a corrected 44-byte report buffer and contact-count clamping;
- ESP-IDF 5.4+ APIs, including ESP-IDF 6.1.

## License

**The component as a whole is GPL-2.0-or-later.** See `LICENSE` and
`THIRD_PARTY_NOTICES.md`.

- `gsl_point_id.c`, `gsl_config_data_id`, and the touch algorithm are Silead
  code under GPL-2.0-or-later.
- The controller firmware image in `firmware/` is supplied by Seeed Studio
  under Apache-2.0.
- The integration changes are provided under GPL-2.0-or-later to match the
  combined component.

A firmware image that links this component is a combined GPL work. If you
distribute such an image, you must comply with the GPL.

## Requirements

- ESP-IDF 5.4 or newer (validated with ESP-IDF 6.1)
- `esp_lcd_touch` 1.1.x
- A GSL3670 controller wired to an I2C bus at address `0x40`

## Installation

Once the component is published in the ESP Component Registry:

```sh
idf.py add-dependency "seeed/esp_lcd_touch_gsl3670^1.0.0"
```

For local development, point `override_path` at a checkout of this repository
or add it to `EXTRA_COMPONENT_DIRS`.

## Usage

```c
#include "esp_lcd_touch_gsl3670.h"

static esp_err_t set_touch_reset(void *context, bool asserted)
{
    // Replace this with the board's reset line. On the D1001 it is PCA9535
    // P1.4; asserted == true drives the line low.
    return board_set_touch_reset(asserted);
}

void start_touch(esp_lcd_panel_io_handle_t io)
{
    esp_lcd_touch_config_t config = {
        .x_max = 800,
        .y_max = 1280,
        .rst_gpio_num = GPIO_NUM_NC,
        .int_gpio_num = GPIO_NUM_NC,
        .levels = {.reset = 0, .interrupt = 0},
        .flags = {
            .swap_xy = 0,
            .mirror_x = 1,
            .mirror_y = 1,
        },
    };
    gsl3670_io_config_t reset_io = {
        .set_reset = set_touch_reset,
        .reset_context = NULL,
    };
    config.driver_data = &reset_io;

    esp_lcd_touch_handle_t touch = NULL;
    ESP_ERROR_CHECK(esp_lcd_touch_new_i2c_gsl3670(io, &config, &touch));

    // Read contacts with the standard esp_lcd_touch API:
    // esp_lcd_touch_read_data(touch);
    // esp_lcd_touch_get_data(touch, points, &count, max_points);
}
```

The panel IO must use `ESP_LCD_TOUCH_IO_I2C_GSL3670_CONFIG()` (or equivalent
settings: address `0x40`, 8-bit command/parameter, control phase disabled).

`gsl3670_io_config_t.set_reset` may be `NULL` if the board instead exposes the
reset line as `rst_gpio_num`.

## Multi-touch

The controller and firmware support up to three contacts. The driver reports
`track_id` through `esp_lcd_touch_get_data()`, so hosts can pair Down/Move/Up
events for each finger. You can override the mapping and mirroring for a
different panel orientation in `esp_lcd_touch_config_t`.

## Initialization

Initialization performs the vendor register sequence, loads the firmware image,
starts the controller twice, and verifies the `0xB0` signature
(`5A 5A 5A 5A`). It takes roughly one second at a 400 kHz I2C clock. A failure
returns an error from `esp_lcd_touch_new_i2c_gsl3670()`; the host should log it
and continue without touch.

## Hardware

The Seeed reTerminal D1001 uses:

| Signal | Connection |
|---|---|
| I2C address | `0x40` |
| Touch reset | PCA9535 P1.4 (active low) |
| Interrupt | not connected in the default profile (host polls) |
| Panel | 800x1280 portrait, RGB565 |

## Development

This repository contains:

- `esp_lcd_touch_gsl3670.c` - firmware loader, report parser and wrapper;
- `gsl_point_id.c` - Silead's GPL point algorithm;
- `firmware/gsl3670_firmware.c` - Seeed-supplied Apache-2.0 firmware image;
- `include/` - public API and vendor-side types.

The component was validated on a production reTerminal D1001 (ESP32-P4 v3.2,
32 MiB flash) with ESP-IDF 6.1.

Links

Supports all targets

To add this component to your project, run:

idf.py add-dependency "wvirgil123/esp_lcd_touch_gsl3670^1.0.0"

download archive

Stats

  • Archive size
    Archive size ~ 52.30 KB
  • Downloaded in total
    Downloaded in total 0 times
  • Downloaded this version
    This version: 0 times

Badge

wvirgil123/esp_lcd_touch_gsl3670 version: 1.0.0
|