Skip to content

Commit 5748208

Browse files
Merge pull request #3 from Y1hsiaochunnn/master
Add esp_lcd_sh8601 variant component to ESP32-S3-Touch-AMOLED-1.8
2 parents 686f28a + 37101fa commit 5748208

File tree

15 files changed

+3080
-0
lines changed

15 files changed

+3080
-0
lines changed

.github/workflows/upload_component.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ jobs:
2121
display/lcd/esp_lcd_jd9365_10_1;
2222
display/lcd/esp_lcd_hx8394;
2323
display/lcd/esp_lcd_dsi;
24+
display/lcd/esp_lcd_sh8601;
2425
namespace: "waveshare"
2526
api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# ChangeLog
2+
3+
## v1.0.0 - 2025-01-14
4+
5+
### Enhancements:
6+
7+
* Adapted by waveshare electronics according to [esp_lcd_sh8601](https://components.espressif.com/components/espressif/esp_lcd_sh8601)
8+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
idf_component_register(SRCS "esp_lcd_sh8601.c" INCLUDE_DIRS "include" PRIV_REQUIRES "driver" REQUIRES "esp_lcd")
2+
3+
include(package_manager)
4+
cu_pkg_define_version(${CMAKE_CURRENT_LIST_DIR})
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Waveshare ESP32-S3-Touch-AMOLED-1.8 Display Support
2+
3+
[![Component Registry](https://components.espressif.com/components/waveshare/esp_lcd_sh8601/badge.svg)](https://components.espressif.com/components/waveshare/esp_lcd_sh8601)
4+
5+
Waveshare ESP32-S3-Touch-AMOLED-1.8 Display used QSPI
6+
7+
| LCD controller | Communication interface | Component name | Link to datasheet |
8+
| :------------: |:-----------------------:| :------------: | :---------------------------------------------------------------------------: |
9+
| SH8601 | QSPI | esp_lcd_sh8601 | [PDF](https://dl.espressif.com/AE/esp-iot-solution/SH8601A0_DataSheet_Preliminary_V0.0_UCS__191107_1_.pdf) |
10+
11+
## Add to project
12+
13+
Packages from this repository are uploaded to [Espressif's component service](https://components.espressif.com/).
14+
You can add them to your project via `idf.py add-dependancy`, e.g.
15+
```
16+
idf.py add-dependency "waveshare/esp_lcd_sh8601"
17+
```
18+
19+
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).
20+
21+
## BackLight
22+
23+
sent 0x51 0x00~0xFF to control backlight
24+
25+
## Initialization Code
26+
27+
28+
### QSPI Interface
29+
30+
```c
31+
ESP_LOGI(TAG, "Initialize QSPI bus");
32+
const esp_lcd_panel_io_spi_config_t io_config = SH8601_PANEL_BUS_QSPI_CONFIG(EXAMPLE_PIN_NUM_LCD_PCLK,
33+
EXAMPLE_PIN_NUM_LCD_DATA0,
34+
EXAMPLE_PIN_NUM_LCD_DATA1,
35+
EXAMPLE_PIN_NUM_LCD_DATA2,
36+
EXAMPLE_PIN_NUM_LCD_DATA3,
37+
EXAMPLE_LCD_H_RES * 80 * sizeof(uint16_t));
38+
ESP_ERROR_CHECK(spi_bus_initialize(EXAMPLE_LCD_HOST, &buscfg, SPI_DMA_CH_AUTO));
39+
40+
ESP_LOGI(TAG, "Install panel IO");
41+
esp_lcd_panel_io_handle_t io_handle = NULL;
42+
const esp_lcd_panel_io_spi_config_t io_config = SH8601_PANEL_IO_QSPI_CONFIG(EXAMPLE_PIN_NUM_LCD_CS, callback, &callback_data);
43+
ESP_ERROR_CHECK(esp_lcd_new_panel_io_spi((esp_lcd_spi_bus_handle_t)EXAMPLE_LCD_HOST, &io_config, &io_handle));
44+
45+
/**
46+
* Uncomment these line if use custom initialization commands.
47+
* The array should be declared as static const and positioned outside the function.
48+
*/
49+
// static const sh8601_lcd_init_cmd_t lcd_init_cmds[] = {
50+
// // {cmd, { data }, data_size, delay_ms}
51+
// {0x44, (uint8_t []){0x00, 0xc8}, 2, 0},
52+
// {0x35, (uint8_t []){0x00}, 0, 0},
53+
// {0x53, (uint8_t []){0x20}, 1, 25},
54+
// {0x29, (uint8_t []){0x00}, 0, 120},
55+
// ...
56+
// };
57+
58+
ESP_LOGI(TAG, "Install SH8601 panel driver");
59+
esp_lcd_panel_handle_t panel_handle = NULL;
60+
const sh8601_vendor_config_t vendor_config = {
61+
// .init_cmds = lcd_init_cmds, // Uncomment these line if use custom initialization commands
62+
// .init_cmds_size = sizeof(lcd_init_cmds) / sizeof(sh8601_lcd_init_cmd_t),
63+
.flags = {
64+
.use_qspi_interface = 1,
65+
},
66+
};
67+
const esp_lcd_panel_dev_config_t panel_config = {
68+
.reset_gpio_num = EXAMPLE_PIN_NUM_LCD_RST,
69+
.rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB, // Implemented by LCD command `36h`
70+
.bits_per_pixel = 16, // Implemented by LCD command `3Ah`
71+
.vendor_config = &vendor_config,
72+
};
73+
ESP_ERROR_CHECK(esp_lcd_new_panel_sh8601(io_handle, &panel_config, &panel_handle));
74+
75+
esp_lcd_panel_reset(panel_handle);
76+
esp_lcd_panel_init(panel_handle);
77+
esp_lcd_panel_disp_on_off(panel_handle, true);
78+
```
79+
80+
## Notes
81+
82+
* When utilizing `esp_panel_lcd_draw_bitmap()` to refresh the screen, ensure that `x_start`, `y_start`, `x_end` and `y_end` are divisible by `2`. This is a requirement of SH8610. For LVGL, register the following function into `rounder_cb` of `lv_disp_drv_t` to round the coordinates.
83+
84+
```c
85+
void lvgl_port_rounder_callback(struct _lv_disp_drv_t * disp_drv, lv_area_t * area)
86+
{
87+
uint16_t x1 = area->x1;
88+
uint16_t x2 = area->x2;
89+
uint16_t y1 = area->y1;
90+
uint16_t y2 = area->y2;
91+
92+
// round the start of area down to the nearest even number
93+
area->x1 = (x1 >> 1) << 1;
94+
area->y1 = (y1 >> 1) << 1;
95+
96+
// round the end of area up to the nearest odd number
97+
area->x2 = ((x2 >> 1) << 1) + 1;
98+
area->y2 = ((y2 >> 1) << 1) + 1;
99+
}
100+
```

0 commit comments

Comments
 (0)