cwxiaos/esp_lcd_pt6891

1.0.0

uploaded 9 hours ago
ESP LCD PT6891

readme

# ESP LCD PT6891

Implementation of the 0.76 PT6891 OLED controller with esp_lcd component.

| LCD controller | Communication interface | Component name |
| :------------: | :---------------------: | :------------: |
| PT6891         | 4-Wire SPI              | esp_lcd_pt6891 |

## 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_pt6891==1.0.0
```

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

```c
ESP_LOGI(TAG, "init panel");
    spi_bus_config_t spi_bus_config = {
        .mosi_io_num = OLED_PIN_MOSI,
        .miso_io_num = OLED_PIN_MISO,
        .sclk_io_num = OLED_PIN_SCLK,
        .quadwp_io_num = -1,
        .quadhd_io_num = -1,
        .max_transfer_sz = OLED_WIDTH * OLED_HEIGHT * sizeof(uint16_t),
    };
    ESP_ERROR_CHECK(spi_bus_initialize(OLED_SPI_HOST, &spi_bus_config, SPI_DMA_CH_AUTO));

    esp_lcd_panel_io_handle_t panel_io_handle = NULL;
    esp_lcd_panel_io_spi_config_t panel_io_spi_config = {
        .cs_gpio_num = OLED_PIN_CS,
        .dc_gpio_num = OLED_PIN_DC,
        .spi_mode = 0,
        .pclk_hz = OLED_CLOCK_HZ,
        .trans_queue_depth = 10,
        .on_color_trans_done = notify_flush_ready,
        // .on_color_trans_done = NULL,
        .user_ctx = &disp_drv,
        .lcd_cmd_bits = OLED_CMD_BITS,
        .lcd_param_bits = OLED_PARAM_BITS,
    };
    ESP_ERROR_CHECK(esp_lcd_new_panel_io_spi((esp_lcd_spi_bus_handle_t)OLED_SPI_HOST, &panel_io_spi_config, &panel_io_handle));

    esp_lcd_panel_dev_config_t panel_dev_config = {
        .reset_gpio_num = OLED_PIN_RST,
        .rgb_ele_order = LCD_RGB_ELEMENT_ORDER_BGR,
        .bits_per_pixel = 16,
    };

    ESP_ERROR_CHECK(esp_lcd_new_panel_pt6891(panel_io_handle, &panel_dev_config, &panel_handle));

    ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_handle));
    ESP_ERROR_CHECK(esp_lcd_panel_init(panel_handle));
    // ESP_ERROR_CHECK(esp_lcd_panel_invert_color(panel_handle, true));
```

Links

Supports all targets

License: MIT

To add this component to your project, run:

idf.py add-dependency "cwxiaos/esp_lcd_pt6891^1.0.0"

or download archive

Stats

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

Badge

cwxiaos/esp_lcd_pt6891 version: 1.0.0
|