Skip to content

Commit

Permalink
Merge pull request #210 from DreamChaser-luzeyu/bsp/ssd1681_epaper_su…
Browse files Browse the repository at this point in the history
…pport

bsp/ssd1681: Add epaper support (BSP-369)
  • Loading branch information
espzav authored Sep 21, 2023
2 parents 0a447e7 + 4dac301 commit fff261c
Show file tree
Hide file tree
Showing 26 changed files with 2,778 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/upload_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
esp32_azure_iot_kit;esp32_s2_kaluga_kit;esp_wrover_kit;esp-box;esp32_s3_usb_otg;esp32_s3_eye;esp32_s3_lcd_ev_board;esp32_s3_korvo_2;esp-box-lite;esp32_lyrat;esp32_c3_lcdkit;esp-box-3;
components/bh1750;components/ds18b20;components/es8311;components/es7210;components/fbm320;components/hts221;components/mag3110;components/mpu6050;components/ssd1306;components/esp_lvgl_port;
components/lcd_touch/esp_lcd_touch;components/lcd_touch/esp_lcd_touch_ft5x06;components/lcd_touch/esp_lcd_touch_gt911;components/lcd_touch/esp_lcd_touch_tt21100;components/lcd_touch/esp_lcd_touch_gt1151;components/lcd_touch/esp_lcd_touch_cst816s;
components/lcd/esp_lcd_gc9a01;components/lcd/esp_lcd_ili9341;components/lcd/esp_lcd_ra8875;components/lcd_touch/esp_lcd_touch_stmpe610;components/lcd/esp_lcd_sh1107;components/lcd/esp_lcd_st7796;components/lcd/esp_lcd_gc9503;
components/lcd/esp_lcd_gc9a01;components/lcd/esp_lcd_ili9341;components/lcd/esp_lcd_ra8875;components/lcd_touch/esp_lcd_touch_stmpe610;components/lcd/esp_lcd_sh1107;components/lcd/esp_lcd_st7796;components/lcd/esp_lcd_gc9503;components/lcd/esp_lcd_ssd1681;
components/io_expander/esp_io_expander;components/io_expander/esp_io_expander_tca9554;components/io_expander/esp_io_expander_tca95xx_16bit;components/io_expander/esp_io_expander_ht8574;
namespace: "espressif"
api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }}
4 changes: 4 additions & 0 deletions components/lcd/esp_lcd_ssd1681/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
idf_component_register(SRCS "esp_lcd_panel_ssd1681"
INCLUDE_DIRS "include"
REQUIRES "esp_lcd"
PRIV_REQUIRES "driver")
106 changes: 106 additions & 0 deletions components/lcd/esp_lcd_ssd1681/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# SSD1681 e-Paper Driver

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

Implementation of the SSD1681 e-Paper controller with esp_lcd component.

| LCD controller | Communication interface | Component name | Link to datasheet |
| :------------: | :---------------------: | :------------: | :---------------: |
| SSD1681 | SPI | esp_lcd_ssd1681| [Specification](https://cdn-learn.adafruit.com/assets/assets/000/099/573/original/SSD1681.pdf) |

## 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-dependency`, e.g.

```bash
compote manifest add-dependency espressif/esp_lcd_ssd1681==0.1.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).

## Additional Description for `esp_lcd_panel_interface`

The SSD1681 e-Paper driver fully implements the `esp_lcd_panel_interface` interface. Due to the specificity of this hardware, please carefully read the description for the following API.

### `esp_lcd_panel_mirror`

Original function prototype:
```c
/**
* @brief Mirror the LCD panel on specific axis
*
* @note Combined with `esp_lcd_panel_swap_xy()`, one can realize screen rotation
*
* @param[in] panel LCD panel handle, which is created by other factory API like `esp_lcd_new_panel_st7789()`
* @param[in] mirror_x Whether the panel will be mirrored about the x axis
* @param[in] mirror_y Whether the panel will be mirrored about the y axis
* @return
* - ESP_OK on success
* - ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel
*/
esp_err_t esp_lcd_panel_mirror(esp_lcd_panel_handle_t panel, bool mirror_x, bool mirror_y);
```
Please note that `mirror_y` has to be false if you enabled the `non_copy_mode` when constructing the panel, otherwise the function will return `ESP_ERR_INVALID_ARG`.
### `esp_lcd_panel_swap_xy`
Original function prototype:
```c
/**
* @brief Swap/Exchange x and y axis
*
* @note Combined with `esp_lcd_panel_mirror()`, one can realize screen rotation
*
* @param[in] panel LCD panel handle, which is created by other factory API like `esp_lcd_new_panel_st7789()`
* @param[in] swap_axes Whether to swap the x and y axis
* @return
* - ESP_OK on success
* - ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel
*/
esp_err_t esp_lcd_panel_swap_xy(esp_lcd_panel_handle_t panel, bool swap_axes);
```
Please note that `swap_axes` has to be false if you enabled the `non_copy_mode` when constructing the panel, otherwise the function will return `ESP_ERR_INVALID_ARG`.

### `esp_lcd_panel_draw_bitmap`

Original function prototype:
```c
/**
* @brief Draw bitmap on LCD panel
*
* @param[in] panel LCD panel handle, which is created by other factory API like `esp_lcd_new_panel_st7789()`
* @param[in] x_start Start index on x-axis (x_start included)
* @param[in] y_start Start index on y-axis (y_start included)
* @param[in] x_end End index on x-axis (x_end not included)
* @param[in] y_end End index on y-axis (y_end not included)
* @param[in] color_data RGB color data that will be dumped to the specific window range
* @return
* - ESP_OK on success
*/
esp_err_t esp_lcd_panel_draw_bitmap(esp_lcd_panel_handle_t panel, int x_start, int y_start, int x_end, int y_end, const void *color_data);
```
Please note that this function will draw the bitmap but do not refresh the panel. You have to call the `epaper_panel_refresh_screen()` manually to refresh the bitmaps to the panel.
### `esp_lcd_panel_disp_on_off`
Original function prototype:
```c
/**
* @brief Turn on or off the display
*
* @param[in] panel LCD panel handle, which is created by other factory API like `esp_lcd_new_panel_st7789()`
* @param[in] on_off True to turns on display, False to turns off display
* @return
* - ESP_OK on success
* - ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel
*/
esp_err_t esp_lcd_panel_disp_on_off(esp_lcd_panel_handle_t panel, bool on_off);
```
Call with parameter `on_off` set to false will have the e-paper panel enter sleep mode. BUSY pin will stay HIGH in sleep mode and a `esp_lcd_panel_init()` call is needed to resume the panel. Call with parameter `on_off` set to true will load the panel built-in waveform LUT, it is useful if you had set a custom waveform LUT.

## Service Life Optimization

- The screen should not be powered on for extended periods of time. Please use the `disp_on_off` API to put the screen into sleep mode or cut down the power when the screen is not refreshing.
- Do not refresh the screen at maximum speed for a long time. E-Paper panels are not made to show dynamic contents quickly. The refresh interval should be at least 3 minutes if you want to refresh the screen continuously.
Loading

0 comments on commit fff261c

Please sign in to comment.