Skip to content

Commit 9d1cc1e

Browse files
lboueLzw655
andauthored
feat(board): add support for Fitipower EK9716B LCD controller for CrowPanel 7.0" board by @lboue (#78)
* Driver for the EK9716BD3 EK9716 is a highly integrated 1200 channel source driver with TTL interface Timing Controller for color TFT-LCD panels. EK9716 integrated source driver, timing controller and pin control interface. * Update ESP_Panel_Library.h to add EK9716B * Rename EK9716BD3.cpp to EK9716B.cpp * Rename EK9716BD3.h to EK9716B.h * Update EK9716B.cpp * Update EK9716B.h * Update LCD_Controllers.md * Update library.properties * Update ESP_PanelVersions.h * Update README.md to add Fitipower EK9716B * Update README_CN.md * Update CROWPANEL_7_0.h board definition to work with EK9716B (#1) * Update CROWPANEL_7_0.h * Update library.properties * Update ESP_PanelVersions.h * Update Supported LCD Controllers for RGB example (#2) * Update Supported LCD Controllers for RGB example * CROWPANEL: Remove the extra line causing the error during build (#3) * Update LCD_Controllers.md Co-authored-by: Zhongwei Liu <109257001+Lzw655@users.noreply.github.com> --------- Co-authored-by: Zhongwei Liu <109257001+Lzw655@users.noreply.github.com>
1 parent 289d357 commit 9d1cc1e

File tree

10 files changed

+168
-8
lines changed

10 files changed

+168
-8
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Below is a list of [supported LCD controllers](docs/LCD_Controllers.md):
7474

7575
| **Manufacturer** | **Model** |
7676
| --------------- | --------- |
77+
| Fitipower | EK9716B |
7778
| GalaxyCore | GC9A01, GC9B71, GC9503 |
7879
| Ilitek | ILI9341 |
7980
| NewVision | NV3022B |

README_CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ ESP32_Display_Panel 的功能框图如下所示,主要包含以下特性:
7474

7575
| **厂商** | **型号** |
7676
| -------- | -------- |
77+
| Fitipower | EK9716B |
7778
| GalaxyCore | GC9A01, GC9B71, GC9503 |
7879
| Ilitek | ILI9341 |
7980
| NewVision | NV3022B |

docs/LCD_Controllers.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
| [ST7796](https://components.espressif.com/components/espressif/esp_lcd_st7796) | 1.2.1 |
1616
| [ST77916](https://components.espressif.com/components/espressif/esp_lcd_st77916) | 0.0.2 |
1717
| [ST77922](https://components.espressif.com/components/espressif/esp_lcd_st77922) | 0.0.2 |
18+
| EK9716B | - |

examples/LCD/RGB/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
| Supported ESP SoCs | ESP32-S3 |
2-
| ------------------ | -------- |
1+
| Supported ESP SoCs |
2+
| ------------------ |
3+
| ESP32-S3 |
4+
5+
| Supported LCD Controllers |
6+
| ------------------------- |
7+
| EK9716B |
8+
| ST7262 |
39

4-
| Supported LCD Controllers | ST7262 |
5-
| ------------------------- | ------ |
610

711
# Single RGB LCD Example
812

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=ESP32_Display_Panel
2-
version=0.1.5
2+
version=0.1.6
33
author=espressif
44
maintainer=espressif
55
sentence=ESP32_Display_Panel is an Arduino library designed for ESP SoCs to drive display panels and facilitate rapid GUI development.

src/ESP_PanelVersions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/* Library Version */
1212
#define ESP_PANEL_VERSION_MAJOR 0
1313
#define ESP_PANEL_VERSION_MINOR 1
14-
#define ESP_PANEL_VERSION_PATCH 5
14+
#define ESP_PANEL_VERSION_PATCH 6
1515

1616
/* File `ESP_Panel_Conf.h` */
1717
#define ESP_PANEL_CONF_VERSION_MAJOR 0

src/ESP_Panel_Library.h

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

2525
/* LCD */
2626
#include "lcd/ESP_PanelLcd.h"
27+
#include "lcd/EK9716B.h"
2728
#include "lcd/GC9503.h"
2829
#include "lcd/GC9A01.h"
2930
#include "lcd/GC9B71.h"

src/board/elecrow/CROWPANEL_7_0.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/**
1919
* LCD Controller Name.
2020
*/
21-
#define ESP_PANEL_LCD_NAME EK9716BD3
21+
#define ESP_PANEL_LCD_NAME EK9716B // Fitipower EK9716B
2222

2323
/* LCD resolution in pixels */
2424
#define ESP_PANEL_LCD_WIDTH (800)
@@ -217,7 +217,6 @@
217217
// #define ESP_PANEL_BEGIN_EXPANDER_START_FUNCTION( panel )
218218
// #define ESP_PANEL_BEGIN_EXPANDER_END_FUNCTION( panel )
219219
#define ESP_PANEL_BEGIN_LCD_START_FUNCTION( panel ) \
220-
221220
{ \
222221
/* Maintain the touch INT signal in a low state during the reset process to set its I2C address to `0x5D` */ \
223222
gpio_set_direction((gpio_num_t)ESP_PANEL_TOUCH_IO_INT, GPIO_MODE_OUTPUT); \

src/lcd/EK9716B.cpp

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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_LCD_RGB_SUPPORTED
10+
#include "driver/gpio.h"
11+
#include "freertos/FreeRTOS.h"
12+
#include "freertos/task.h"
13+
#include "esp_check.h"
14+
#include "esp_lcd_panel_io.h"
15+
#include "esp_lcd_panel_rgb.h"
16+
#include "esp_lcd_panel_vendor.h"
17+
#include "esp_log.h"
18+
19+
#include "ESP_PanelLog.h"
20+
#include "bus/RGB.h"
21+
#include "EK9716B.h"
22+
23+
static const char *TAG = "EK9716B_CPP";
24+
25+
ESP_PanelLcd_EK9716B::ESP_PanelLcd_EK9716B(ESP_PanelBus *bus, uint8_t color_bits, int rst_io):
26+
ESP_PanelLcd(bus, color_bits, rst_io)
27+
{
28+
}
29+
30+
ESP_PanelLcd_EK9716B::ESP_PanelLcd_EK9716B(ESP_PanelBus *bus, const esp_lcd_panel_dev_config_t &panel_config):
31+
ESP_PanelLcd(bus, panel_config)
32+
{
33+
}
34+
35+
ESP_PanelLcd_EK9716B::~ESP_PanelLcd_EK9716B()
36+
{
37+
ESP_PANEL_ENABLE_TAG_DEBUG_LOG();
38+
39+
if (handle == NULL) {
40+
goto end;
41+
}
42+
43+
if (!del()) {
44+
ESP_LOGE(TAG, "Delete device failed");
45+
}
46+
47+
end:
48+
ESP_LOGD(TAG, "Destroyed");
49+
}
50+
51+
bool ESP_PanelLcd_EK9716B::init(void)
52+
{
53+
ESP_PANEL_ENABLE_TAG_DEBUG_LOG();
54+
55+
if (panel_config.reset_gpio_num >= 0) {
56+
gpio_config_t gpio_conf = {
57+
.pin_bit_mask = BIT64(panel_config.reset_gpio_num),
58+
.mode = GPIO_MODE_OUTPUT,
59+
.pull_up_en = GPIO_PULLUP_DISABLE,
60+
.pull_down_en = GPIO_PULLDOWN_DISABLE,
61+
.intr_type = GPIO_INTR_DISABLE,
62+
};
63+
ESP_PANEL_CHECK_ERR_RET(gpio_config(&gpio_conf), false, "`Config RST gpio failed");
64+
}
65+
ESP_PANEL_CHECK_ERR_RET(esp_lcd_new_rgb_panel(vendor_config.rgb_config, &handle), false, "Create panel failed");
66+
67+
ESP_LOGD(TAG, "LCD panel @%p created", handle);
68+
69+
return true;
70+
}
71+
72+
bool ESP_PanelLcd_EK9716B::reset(void)
73+
{
74+
ESP_PANEL_CHECK_NULL_RET(handle, false, "Invalid handle");
75+
76+
if (panel_config.reset_gpio_num >= 0) {
77+
gpio_set_level((gpio_num_t)panel_config.reset_gpio_num, panel_config.flags.reset_active_high);
78+
vTaskDelay(pdMS_TO_TICKS(10));
79+
gpio_set_level((gpio_num_t)panel_config.reset_gpio_num, !panel_config.flags.reset_active_high);
80+
vTaskDelay(pdMS_TO_TICKS(120));
81+
}
82+
ESP_PANEL_CHECK_ERR_RET(esp_lcd_panel_reset(handle), false, "Reset panel failed");
83+
84+
return true;
85+
}
86+
87+
#endif /* SOC_LCD_RGB_SUPPORTED */

src/lcd/EK9716B.h

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

0 commit comments

Comments
 (0)