Skip to content

Commit 2f71edc

Browse files
committed
feat(lcd): add LCD controller ILI9881C
1 parent 6dbe5fd commit 2f71edc

File tree

8 files changed

+804
-5
lines changed

8 files changed

+804
-5
lines changed

examples/LCD/MIPI_DSI/MIPI_DSI.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* | Supported ESP SoCs | ESP32-P4 |
33
* | ------------------ | -------- |
44
*
5-
* | Supported LCD Controllers | EK79007 |
6-
* | ------------------------- | ------- |
5+
* | Supported LCD Controllers | EK79007 | ILI9881C |
6+
* | ------------------------- | ------- | -------- |
77
*
88
* # MIPI-DSI LCD Example
99
*
@@ -73,7 +73,7 @@
7373
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7474
/**
7575
* Currently, the library supports the following MIPI-DSI LCDs:
76-
* - EK79007
76+
* - EK79007, ILI9881C
7777
*/
7878
#define EXAMPLE_LCD_NAME EK79007
7979
#define EXAMPLE_LCD_WIDTH (1024)

examples/LCD/MIPI_DSI/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
| Supported ESP SoCs | ESP32-P4 |
22
| ------------------ | -------- |
33

4-
| Supported LCD Controllers | EK79007 |
5-
| ------------------------- | ------- |
4+
| Supported LCD Controllers | EK79007 | ILI9881C |
5+
| ------------------------- | ------- | -------- |
66

77
# MIPI-DSI LCD Example
88

src/ESP_Panel_Library.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "lcd/GC9A01.h"
3232
#include "lcd/GC9B71.h"
3333
#include "lcd/ILI9341.h"
34+
#include "lcd/ILI9881C.h"
3435
#include "lcd/NV3022B.h"
3536
#include "lcd/SH8601.h"
3637
#include "lcd/SPD2010.h"

src/lcd/ILI9881C.cpp

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include "soc/soc_caps.h"
8+
9+
#if SOC_MIPI_DSI_SUPPORTED
10+
#include "ESP_PanelLog.h"
11+
#include "ILI9881C.h"
12+
13+
static const char *TAG = "ILI9881C_CPP";
14+
15+
ESP_PanelLcd_ILI9881C::ESP_PanelLcd_ILI9881C(ESP_PanelBus *bus, uint8_t color_bits, int rst_io):
16+
ESP_PanelLcd(bus, color_bits, rst_io)
17+
{
18+
disabled_functions.set_gap = 1;
19+
disabled_functions.swap_xy = 1;
20+
}
21+
22+
ESP_PanelLcd_ILI9881C::ESP_PanelLcd_ILI9881C(ESP_PanelBus *bus, const esp_lcd_panel_dev_config_t &panel_config):
23+
ESP_PanelLcd(bus, panel_config)
24+
{
25+
disabled_functions.set_gap = 1;
26+
disabled_functions.swap_xy = 1;
27+
}
28+
29+
ESP_PanelLcd_ILI9881C::~ESP_PanelLcd_ILI9881C()
30+
{
31+
ESP_PANEL_ENABLE_TAG_DEBUG_LOG();
32+
33+
if (handle == NULL) {
34+
goto end;
35+
}
36+
37+
if (!del()) {
38+
ESP_LOGE(TAG, "Delete device failed");
39+
}
40+
41+
end:
42+
ESP_LOGD(TAG, "Destroyed");
43+
}
44+
45+
bool ESP_PanelLcd_ILI9881C::init(void)
46+
{
47+
ESP_PANEL_CHECK_NULL_RET(bus, false, "Invalid bus");
48+
49+
ESP_PANEL_CHECK_ERR_RET(
50+
esp_lcd_new_panel_ili9881c(bus->getPanelIO_Handle(), &panel_config, &handle), false, "Create panel failed"
51+
);
52+
53+
return true;
54+
}
55+
56+
#endif

src/lcd/ILI9881C.h

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
#pragma once
7+
8+
#include "soc/soc_caps.h"
9+
10+
#if SOC_MIPI_DSI_SUPPORTED
11+
#include "ESP_PanelLcd.h"
12+
#include "base/esp_lcd_vendor_types.h"
13+
#include "base/esp_lcd_ili9881c.h"
14+
15+
/**
16+
* @brief ILI9881C LCD device object class
17+
*
18+
* @note This class is a derived class of `ESP_PanelLcd`, user can use it directly
19+
*/
20+
class ESP_PanelLcd_ILI9881C: public ESP_PanelLcd {
21+
public:
22+
/**
23+
* @brief Construct a new LCD device in a simple way, the `init()` function should be called after this function
24+
*
25+
* @note This function uses some default values to config the LCD device, please use `config*()` functions to
26+
* change them
27+
* @note Vendor specific initialization can be different between manufacturers, should consult the LCD supplier
28+
* for initialization sequence code, and use `configVendorCommands()` to configure
29+
*
30+
* @param bus Pointer of panel bus
31+
* @param color_bits Bits per pixel (16/18/24)
32+
* @param rst_io Reset pin, set to -1 if no use
33+
*/
34+
ESP_PanelLcd_ILI9881C(ESP_PanelBus *bus, uint8_t color_bits, int rst_io = -1);
35+
36+
/**
37+
* @brief Construct a new LCD in a complex way, the `init()` function should be called after this function
38+
*
39+
* @param bus Pointer of panel bus
40+
* @param panel_config LCD device configuration
41+
*/
42+
ESP_PanelLcd_ILI9881C(ESP_PanelBus *bus, const esp_lcd_panel_dev_config_t &panel_config);
43+
44+
/**
45+
* @brief Destroy the LCD device
46+
*
47+
*/
48+
~ESP_PanelLcd_ILI9881C() override;
49+
50+
/**
51+
* @brief Initialize the LCD device, the `begin()` function should be called after this function
52+
*
53+
* @note This function typically calls `esp_lcd_new_panel_*()` to create the LCD panel handle
54+
*
55+
* @return true if success, otherwise false
56+
*/
57+
bool init(void) override;
58+
};
59+
#endif

0 commit comments

Comments
 (0)