waveshare/esp_lcd_touch_hi8561

0.0.1

Latest
uploaded 23 hours ago
ESP LCD Touch HI8561 -The touch controller HI8561 is adapted by waveshare

Readme

# ESP LCD Touch HI8561 Controller

[![Component Registry](https://components.espressif.com/components/waveshare/esp_lcd_touch_hi8561/badge.svg)](https://components.espressif.com/components/waveshare/esp_lcd_touch_hi8561)

Implementation of the HI8561 touch controller with esp_lcd_touch component.

| Touch controller | Communication interface |    Component name     |                            Link to datasheet                             |
| :--------------: | :---------------------: | :-------------------: | :----------------------------------------------------------------------: |
|     HI8561       |          I2C            | esp_lcd_touch_hi8561  |                        []()                                              |

## Add to project

Packages from this repository are uploaded to [Espressif's component service](https://components.espressif.com/).
You can add them to your project via `idf.py add-dependancy`, e.g.
```
    idf.py add-dependency esp_lcd_touch_hi8561==0.0.1
```

Alternatively, you can create `idf_component.yml`. More is in [Espressif's documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-component-manager.html).

## Example use

Initialization of the touch component.

```
    esp_lcd_touch_io_hi8561_config_t tp_hi8561_config = {
        .dev_addr = ESP_LCD_TOUCH_IO_I2C_HI8561_ADDRESS,
        .touch_info_start_address = 0x20011008,
    };

    esp_lcd_touch_config_t tp_cfg = {
        .x_max = CONFIG_LCD_HRES,
        .y_max = CONFIG_LCD_VRES,
        .rst_gpio_num = -1,
        .int_gpio_num = -1,
        .levels = {
            .reset = 0,
            .interrupt = 0,
        },
        .flags = {
            .swap_xy = 0,
            .mirror_x = 0,
            .mirror_y = 0,
        },
        .driver_data = &tp_hi8561_config,
    };

    esp_lcd_touch_handle_t tp;
    esp_lcd_touch_new_i2c_hi8561(io_handle, &tp_cfg, &tp);
```

Read data from the touch controller and store it in RAM memory. It should be called regularly in poll.

```
    esp_lcd_touch_read_data(tp);
```

Get one X and Y coordinates with strength of touch.

```
    uint16_t touch_x[1];
    uint16_t touch_y[1];
    uint16_t touch_strength[1];
    uint8_t touch_cnt = 0;

    bool touchpad_pressed = esp_lcd_touch_get_coordinates(tp, touch_x, touch_y, touch_strength, &touch_cnt, 1);
```

Links

Supports all targets

To add this component to your project, run:

idf.py add-dependency "waveshare/esp_lcd_touch_hi8561^0.0.1"

download archive

Stats

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

Badge

waveshare/esp_lcd_touch_hi8561 version: 0.0.1
|