azagaya/waveshare_epd_2in66b

0.1.0

Latest
uploaded 5 hours ago
Native ESP-IDF driver for the Waveshare 2.66-inch black/white/red e-Paper Module (B)

Readme

# Waveshare 2.66-inch e-Paper (B) ESP-IDF Component

Native ESP-IDF driver for the Waveshare 2.66-inch, 296x152,
black/white/red e-Paper Module (B). The component uses ESP-IDF SPI and GPIO
drivers directly; Arduino is not required.

Tested with ESP-IDF 5.5 on ESP32-P4.

## Origin

This is a port of Waveshare's official
[`RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in66b.c`](https://github.com/waveshareteam/e-Paper/blob/master/RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_2in66b.c)
driver. It preserves the original initialization, display-update, clear, and
sleep command sequence while replacing the Waveshare platform layer with
native ESP-IDF SPI, GPIO, logging, Kconfig, and FreeRTOS APIs.

The original driver and this port are distributed under the MIT License. See
`LICENSE` and `NOTICE.md` for attribution.

## Installation

As a Git submodule:

```sh
git submodule add https://github.com/azagaya/waveshare-epd-2in66b.git \
    components/waveshare_epd_2in66b
```

As a Git dependency with ESP-IDF 5.5 or newer:

```sh
idf.py add-dependency waveshare_epd_2in66b \
    --git https://github.com/azagaya/waveshare-epd-2in66b.git \
    --git-ref v0.1.0
```

After publishing to the ESP Component Registry:

```sh
idf.py add-dependency "azagaya/waveshare_epd_2in66b^0.1.0"
```

## Configuration

Run `idf.py menuconfig`, then open **Waveshare 2.66-inch e-Paper (B)**.

The defaults below match the Waveshare ESP32-P4-Module-DEV-KIT used during
development:

| Signal | GPIO | Header pin |
|---|---:|---:|
| VCC | 3.3 V | 17 |
| GND | GND | 30 |
| DIN/MOSI | 33 | 29 |
| CLK/SCLK | 36 | 24 |
| CS | 32 | 26 |
| DC | 26 | 31 |
| RST | 27 | 38 |
| BUSY | 48 | 33 |

## Usage

The application owns and initializes the SPI bus. Set `max_transfer_sz` to at
least `EPD_2IN66B_FRAME_BYTES`, then initialize and use the panel:

```c
spi_bus_config_t bus_config = {
    .mosi_io_num = CONFIG_EPD_SPI_MOSI_PIN,
    .miso_io_num = -1,
    .sclk_io_num = CONFIG_EPD_SPI_SCLK_PIN,
    .quadwp_io_num = -1,
    .quadhd_io_num = -1,
    .max_transfer_sz = EPD_2IN66B_FRAME_BYTES,
};

ESP_ERROR_CHECK(spi_bus_initialize(
    (spi_host_device_t)CONFIG_EPD_SPI_HOST,
    &bus_config,
    SPI_DMA_CH_AUTO));

EPD_2IN66B_Init();
EPD_2IN66B_Display(black_buffer, red_buffer);
EPD_2IN66B_Sleep();
```

Each frame buffer is `EPD_2IN66B_FRAME_BYTES` (5624) bytes in row-major order,
with the most significant bit representing the leftmost pixel of each byte.

Input buffer encoding:

| Color | Black-buffer bit | Red-buffer bit |
|---|---:|---:|
| White | 1 | 1 |
| Black | 0 | 1 |
| Red | 1 | 0 |

The driver inverts the red input buffer before writing the panel's red RAM.
Use DMA-capable buffers when SPI DMA is enabled.

## Refresh Behavior

A full refresh normally takes approximately 15-20 seconds and visibly flashes
several times. `EPD_2IN66B_Display()` blocks until BUSY is released. Waveshare
recommends allowing about 180 seconds between full refreshes. Put the panel to
sleep after updating it; the image remains visible without power.

## Example

```sh
cd examples/basic
idf.py set-target esp32p4
idf.py build flash monitor
```

## License

MIT. See `LICENSE` and `NOTICE.md`.

Links

Target

To add this component to your project, run:

idf.py add-dependency "azagaya/waveshare_epd_2in66b^0.1.0"

download archive

Stats

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

Badge

azagaya/waveshare_epd_2in66b version: 0.1.0
|