Skip to content

Commit af89b71

Browse files
committed
feat(lcd): add LCD controller EK79007
1 parent e496f61 commit af89b71

File tree

5 files changed

+495
-0
lines changed

5 files changed

+495
-0
lines changed

src/ESP_Panel_Library.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
/* LCD */
2727
#include "lcd/ESP_PanelLcd.h"
28+
#include "lcd/EK79007.h"
2829
#include "lcd/EK9716B.h"
2930
#include "lcd/GC9503.h"
3031
#include "lcd/GC9A01.h"

src/lcd/EK79007.cpp

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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 "EK79007.h"
12+
13+
static const char *TAG = "EK79007_CPP";
14+
15+
ESP_PanelLcd_EK79007::ESP_PanelLcd_EK79007(ESP_PanelBus *bus, uint8_t color_bits, int rst_io):
16+
ESP_PanelLcd(bus, color_bits, rst_io)
17+
{
18+
disabled_functions.display_on_off = 1;
19+
disabled_functions.set_gap = 1;
20+
disabled_functions.swap_xy = 1;
21+
}
22+
23+
ESP_PanelLcd_EK79007::ESP_PanelLcd_EK79007(ESP_PanelBus *bus, const esp_lcd_panel_dev_config_t &panel_config):
24+
ESP_PanelLcd(bus, panel_config)
25+
{
26+
disabled_functions.display_on_off = 1;
27+
disabled_functions.set_gap = 1;
28+
disabled_functions.swap_xy = 1;
29+
}
30+
31+
ESP_PanelLcd_EK79007::~ESP_PanelLcd_EK79007()
32+
{
33+
ESP_PANEL_ENABLE_TAG_DEBUG_LOG();
34+
35+
if (handle == NULL) {
36+
goto end;
37+
}
38+
39+
if (!del()) {
40+
ESP_LOGE(TAG, "Delete device failed");
41+
}
42+
43+
end:
44+
ESP_LOGD(TAG, "Destroyed");
45+
}
46+
47+
bool ESP_PanelLcd_EK79007::init(void)
48+
{
49+
ESP_PANEL_CHECK_NULL_RET(bus, false, "Invalid bus");
50+
51+
ESP_PANEL_CHECK_ERR_RET(
52+
esp_lcd_new_panel_ek79007(bus->getPanelIO_Handle(), &panel_config, &handle), false, "Create panel failed"
53+
);
54+
55+
return true;
56+
}
57+
58+
#endif

src/lcd/EK79007.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_ek79007.h"
14+
15+
/**
16+
* @brief EK79007 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_EK79007: 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_EK79007(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_EK79007(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_EK79007() 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)