Skip to content

Add support for Fitipower EK9716B LCD controller for CrowPanel 7.0" board #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jul 29, 2024
Merged
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Below is a list of [supported LCD controllers](docs/LCD_Controllers.md):

| **Manufacturer** | **Model** |
| --------------- | --------- |
| Fitipower | EK9716B |
| GalaxyCore | GC9A01, GC9B71, GC9503 |
| Ilitek | ILI9341 |
| NewVision | NV3022B |
Expand Down
1 change: 1 addition & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ ESP32_Display_Panel 的功能框图如下所示,主要包含以下特性:

| **厂商** | **型号** |
| -------- | -------- |
| Fitipower | EK9716B |
| GalaxyCore | GC9A01, GC9B71, GC9503 |
| Ilitek | ILI9341 |
| NewVision | NV3022B |
Expand Down
1 change: 1 addition & 0 deletions docs/LCD_Controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
| [ST7796](https://components.espressif.com/components/espressif/esp_lcd_st7796) | 1.2.1 |
| [ST77916](https://components.espressif.com/components/espressif/esp_lcd_st77916) | 0.0.2 |
| [ST77922](https://components.espressif.com/components/espressif/esp_lcd_st77922) | 0.0.2 |
| EK9716B | - |
12 changes: 8 additions & 4 deletions examples/LCD/RGB/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
| Supported ESP SoCs | ESP32-S3 |
| ------------------ | -------- |
| Supported ESP SoCs |
| ------------------ |
| ESP32-S3 |

| Supported LCD Controllers |
| ------------------------- |
| EK9716B |
| ST7262 |

| Supported LCD Controllers | ST7262 |
| ------------------------- | ------ |

# Single RGB LCD Example

Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ESP32_Display_Panel
version=0.1.5
version=0.1.6
author=espressif
maintainer=espressif
sentence=ESP32_Display_Panel is an Arduino library designed for ESP SoCs to drive display panels and facilitate rapid GUI development.
Expand Down
2 changes: 1 addition & 1 deletion src/ESP_PanelVersions.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/* Library Version */
#define ESP_PANEL_VERSION_MAJOR 0
#define ESP_PANEL_VERSION_MINOR 1
#define ESP_PANEL_VERSION_PATCH 5
#define ESP_PANEL_VERSION_PATCH 6

/* File `ESP_Panel_Conf.h` */
#define ESP_PANEL_CONF_VERSION_MAJOR 0
Expand Down
1 change: 1 addition & 0 deletions src/ESP_Panel_Library.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

/* LCD */
#include "lcd/ESP_PanelLcd.h"
#include "lcd/EK9716B.h"
#include "lcd/GC9503.h"
#include "lcd/GC9A01.h"
#include "lcd/GC9B71.h"
Expand Down
3 changes: 1 addition & 2 deletions src/board/elecrow/CROWPANEL_7_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* LCD Controller Name.
*/
#define ESP_PANEL_LCD_NAME EK9716BD3
#define ESP_PANEL_LCD_NAME EK9716B // Fitipower EK9716B

/* LCD resolution in pixels */
#define ESP_PANEL_LCD_WIDTH (800)
Expand Down Expand Up @@ -217,7 +217,6 @@
// #define ESP_PANEL_BEGIN_EXPANDER_START_FUNCTION( panel )
// #define ESP_PANEL_BEGIN_EXPANDER_END_FUNCTION( panel )
#define ESP_PANEL_BEGIN_LCD_START_FUNCTION( panel ) \

{ \
/* Maintain the touch INT signal in a low state during the reset process to set its I2C address to `0x5D` */ \
gpio_set_direction((gpio_num_t)ESP_PANEL_TOUCH_IO_INT, GPIO_MODE_OUTPUT); \
Expand Down
87 changes: 87 additions & 0 deletions src/lcd/EK9716B.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "soc/soc_caps.h"

#if SOC_LCD_RGB_SUPPORTED
#include "driver/gpio.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_check.h"
#include "esp_lcd_panel_io.h"
#include "esp_lcd_panel_rgb.h"
#include "esp_lcd_panel_vendor.h"
#include "esp_log.h"

#include "ESP_PanelLog.h"
#include "bus/RGB.h"
#include "EK9716B.h"

static const char *TAG = "EK9716B_CPP";

ESP_PanelLcd_EK9716B::ESP_PanelLcd_EK9716B(ESP_PanelBus *bus, uint8_t color_bits, int rst_io):
ESP_PanelLcd(bus, color_bits, rst_io)
{
}

ESP_PanelLcd_EK9716B::ESP_PanelLcd_EK9716B(ESP_PanelBus *bus, const esp_lcd_panel_dev_config_t &panel_config):
ESP_PanelLcd(bus, panel_config)
{
}

ESP_PanelLcd_EK9716B::~ESP_PanelLcd_EK9716B()
{
ESP_PANEL_ENABLE_TAG_DEBUG_LOG();

if (handle == NULL) {
goto end;
}

if (!del()) {
ESP_LOGE(TAG, "Delete device failed");
}

end:
ESP_LOGD(TAG, "Destroyed");
}

bool ESP_PanelLcd_EK9716B::init(void)
{
ESP_PANEL_ENABLE_TAG_DEBUG_LOG();

if (panel_config.reset_gpio_num >= 0) {
gpio_config_t gpio_conf = {
.pin_bit_mask = BIT64(panel_config.reset_gpio_num),
.mode = GPIO_MODE_OUTPUT,
.pull_up_en = GPIO_PULLUP_DISABLE,
.pull_down_en = GPIO_PULLDOWN_DISABLE,
.intr_type = GPIO_INTR_DISABLE,
};
ESP_PANEL_CHECK_ERR_RET(gpio_config(&gpio_conf), false, "`Config RST gpio failed");
}
ESP_PANEL_CHECK_ERR_RET(esp_lcd_new_rgb_panel(vendor_config.rgb_config, &handle), false, "Create panel failed");

ESP_LOGD(TAG, "LCD panel @%p created", handle);

return true;
}

bool ESP_PanelLcd_EK9716B::reset(void)
{
ESP_PANEL_CHECK_NULL_RET(handle, false, "Invalid handle");

if (panel_config.reset_gpio_num >= 0) {
gpio_set_level((gpio_num_t)panel_config.reset_gpio_num, panel_config.flags.reset_active_high);
vTaskDelay(pdMS_TO_TICKS(10));
gpio_set_level((gpio_num_t)panel_config.reset_gpio_num, !panel_config.flags.reset_active_high);
vTaskDelay(pdMS_TO_TICKS(120));
}
ESP_PANEL_CHECK_ERR_RET(esp_lcd_panel_reset(handle), false, "Reset panel failed");

return true;
}

#endif /* SOC_LCD_RGB_SUPPORTED */
66 changes: 66 additions & 0 deletions src/lcd/EK9716B.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include "soc/soc_caps.h"

#if SOC_LCD_RGB_SUPPORTED
#include "ESP_PanelLcd.h"

/**
* @brief EK9716B LCD device object class
*
* @note This class is a derived class of `ESP_PanelLcd`, user can use it directly
*/
class ESP_PanelLcd_EK9716B: public ESP_PanelLcd {
public:
/**
* @brief Construct a new LCD device in a simple way, the `init()` function should be called after this function
*
* @note This function uses some default values to config the LCD device, please use `config*()` functions to
* change them
*
* @param bus Pointer of panel bus
* @param color_bits Bits per pixel (24)
* @param rst_io Reset pin, set to `-1` if no use
*/
ESP_PanelLcd_EK9716B(ESP_PanelBus *bus, uint8_t color_bits, int rst_io = -1);

/**
* @brief Construct a new LCD device in a complex way, the `init()` function should be called after this function
*
* @param bus Pointer of panel bus
* @param panel_config LCD device configuration
*/
ESP_PanelLcd_EK9716B(ESP_PanelBus *bus, const esp_lcd_panel_dev_config_t &panel_config);

/**
* @brief Destroy the LCD device
*
*/
~ESP_PanelLcd_EK9716B() override;

/**
* @brief Initialize the LCD device, the `begin()` function should be called after this function
*
* @note This function typically calls `esp_lcd_new_panel_*()` to create the LCD panel handle
*
* @return true if success, otherwise false
*/
bool init(void) override;

/**
* @brief Reset the LCD. If the `rst_io` is not set, this function will do reset by software instead of hardware
*
* @note This function should be called after `init()`
*
* @return true if success, otherwise false
*/
bool reset(void);
};

#endif /* SOC_LCD_RGB_SUPPORTED */
Loading