Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ file(GLOB SRCS
set(COMPONENT_SRCS ${SRCS})

if (IDF_VERSION_MAJOR GREATER_EQUAL 5)
set(COMPONENT_REQUIRES nvs_flash efuse driver esp_timer esp_lcd esp_mm)
set(COMPONENT_REQUIRES nvs_flash efuse driver esp_timer esp_lcd)
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.1")
list(APPEND COMPONENT_REQUIRES esp_mm)
endif()
elseif ((IDF_VERSION_MAJOR EQUAL 4) AND (IDF_VERSION_MINOR GREATER 3) OR IDF_VERSION_MAJOR GREATER 4)
set(COMPONENT_REQUIRES nvs_flash efuse esp_lcd)
else()
Expand Down
2 changes: 1 addition & 1 deletion idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ description: Graphics library for M5Stack series
issues: https://github.com/m5stack/M5GFX/issues
repository: https://github.com/m5stack/M5GFX.git
url: https://github.com/m5stack/M5GFX.git
version: 0.2.22
version: 0.2.23
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"type": "git",
"url": "https://github.com/m5stack/M5GFX.git"
},
"version": "0.2.22",
"version": "0.2.23",
"frameworks": ["arduino", "espidf", "*"],
"platforms": ["espressif32", "native"],
"headers": "M5GFX.h"
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=M5GFX
version=0.2.22
version=0.2.23
author=M5Stack
maintainer=M5Stack
sentence=Library for M5Stack All Display
Expand Down
82 changes: 73 additions & 9 deletions src/M5GFX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include "lgfx/v1/platforms/esp32p4/Bus_DSI.hpp"
#include "lgfx/v1/platforms/esp32p4/Panel_ILI9881C.hpp"
#include "lgfx/v1/platforms/esp32p4/Panel_ST7121.hpp"
#include "lgfx/v1/platforms/esp32p4/Panel_ST7123.hpp"
#include "lgfx/v1/platforms/esp32p4/Touch_ST7123.hpp"

Expand Down Expand Up @@ -1785,7 +1786,7 @@ namespace m5gfx
bus_cfg.spi_3wire = true;

bus_cfg.spi_host = SPI2_HOST;
bus_cfg.freq_write = 20000000;
bus_cfg.freq_write = 40000000;
bus_cfg.freq_read = 10000000;
bus_spi->config(bus_cfg);
bus_spi->init();
Expand All @@ -1797,11 +1798,11 @@ namespace m5gfx
cfg.pin_cs = GPIO_NUM_16;
cfg.pin_rst = GPIO_NUM_NC;
cfg.pin_busy = GPIO_NUM_18;
cfg.panel_width = 480;
cfg.panel_height = 800;
cfg.panel_width = 800;
cfg.panel_height = 480;
cfg.offset_x = 0;
cfg.offset_y = 0;
cfg.offset_rotation = 0;
cfg.offset_rotation = 3;
cfg.readable = false;
cfg.invert = false;
cfg.bus_shared = false;
Expand Down Expand Up @@ -2571,6 +2572,8 @@ The usage of each pin is as follows.
i2c_write_register8_array(in_i2c_port, pi4io2_i2c_addr, reg_data_io2, 100000);
lgfx::delay(10);
i2c_write_register8_array(in_i2c_port, pi4io1_i2c_addr, reg_data_io1_2, 100000);
lgfx::pinMode(GPIO_NUM_23, lgfx::pin_mode_t::input); // TP INT
lgfx::delay(100);

#if !CONFIG_SPIRAM
ESP_LOGE(LIBRARY_NAME, "M5Tab5 need PSRAM enabled");
Expand All @@ -2585,26 +2588,49 @@ The usage of each pin is as follows.
#endif

{
bool hit_st7121 = false;
bool hit_st7123 = false;
bool read_st_touch_fw = false;
for (int i = 0; i < 3; ++i) {
uint8_t fw_version = 0;
uint8_t fw_reg[2] = { 0, 0 };
if (lgfx::i2c::transactionWriteRead(in_i2c_port, Touch_ST7123::default_addr, fw_reg, sizeof(fw_reg), &fw_version, 1, 100000).has_value()) {
read_st_touch_fw = true;
ESP_LOGI(LIBRARY_NAME, "M5Tab5 ST touch FW version %02x", fw_version);
if (fw_version == 1) {
hit_st7121 = true;
break;
}
if (fw_version == 3) {
hit_st7123 = true;
break;
}
ESP_LOGW(LIBRARY_NAME, "M5Tab5 unknown ST touch FW version %02x", fw_version);
}
lgfx::delay(10);
}
if (!read_st_touch_fw) {
ESP_LOGW(LIBRARY_NAME, "M5Tab5 ST touch FW version read failed");
}

auto bus_dsi = new Bus_DSI();
_bus_last.reset(bus_dsi);
auto bus_cfg = bus_dsi->config();
bus_cfg.bus_id = 0;
bus_cfg.lane_num = 2;
bus_cfg.lane_mbps = 1040;
bus_cfg.lane_mbps = hit_st7121 ? 900 : 1040;
bus_cfg.ldo_chan_id = 3;
bus_cfg.ldo_voltage_mv = 2500;
bus_dsi->config(bus_cfg);
if (bus_dsi->init()) {
bool hit_ili9881 = false;
bool hit_st7123 = false;
lgfx::delay(80);
for (int i = 0; i < 3; ++i) {
for (int i = 0; !hit_st7121 && !hit_st7123 && !hit_ili9881 && i < 3; ++i) {
uint8_t id[3] = { 0, };
bus_dsi->readParams( 0xF4, id, 2 );
ESP_LOGD(LIBRARY_NAME, "ST ID %02x %02x", id[0], id[1]);
if (id[0] == 0x71 && id[1] == 0x23) {
hit_st7123 = true;
break;
ESP_LOGI(LIBRARY_NAME, "M5Tab5 ST DSI ID matched 71 23");
}
static constexpr uint8_t params_page1[] = { 0x98, 0x81, 0x01 };
bus_dsi->writeParams( 0xFF, params_page1, 3);
Expand Down Expand Up @@ -2632,7 +2658,23 @@ The usage of each pin is as follows.
det.vsync_pulse_width = 4;
det.vsync_front_porch = 20;
p->config_detail(det);
} else if (hit_st7121) {
ESP_LOGI(LIBRARY_NAME, "M5Tab5 detected ST7121 display");
_touch_last.reset(new Touch_ST7123());
auto p = new Panel_ST7121();
_panel_last.reset(p);
auto det = p->config_detail();

det.dpi_freq_mhz = 70;
det.hsync_back_porch = 40;
det.hsync_pulse_width = 2;
det.hsync_front_porch = 40;
det.vsync_back_porch = 24;
det.vsync_pulse_width = 20;
det.vsync_front_porch = 200;
p->config_detail(det);
} else if (hit_st7123) {
ESP_LOGI(LIBRARY_NAME, "M5Tab5 detected ST7123 display");
_touch_last.reset(new Touch_ST7123());
auto p = new Panel_ST7123();
_panel_last.reset(p);
Expand All @@ -2649,6 +2691,10 @@ The usage of each pin is as follows.
det.vsync_front_porch = 220;
p->config_detail(det);
}
if (_panel_last == nullptr) {
ESP_LOGE(LIBRARY_NAME, "M5Tab5 display panel was not detected");
goto init_clear;
}
{
auto p = _panel_last.get();
auto cfg = p->config();
Expand Down Expand Up @@ -2964,8 +3010,11 @@ The usage of each pin is as follows.
case board_M5StackCoreInk: title = "M5StackCoreInk"; break;
case board_M5Paper: title = "M5Paper"; break;
case board_M5PaperS3: title = "M5PaperS3"; break;
case board_M5PaperColor: title = "M5PaperColor"; break;
case board_M5PaperMono: title = "M5PaperMono"; break;
case board_M5Tough: title = "M5Tough"; break;
case board_M5Station: title = "M5Station"; break;
case board_M5StopWatch: title = "M5StopWatch"; break;
case board_M5AtomS3: title = "M5AtomS3"; break;
case board_M5AtomS3R: title = "M5AtomS3R"; break;
case board_M5Dial: title = "M5Dial"; break;
Expand Down Expand Up @@ -2997,6 +3046,21 @@ The usage of each pin is as follows.
r = 1;
break;

case board_M5PaperColor:
w = 400;
h = 600;
pnl_cfg.offset_rotation = 0;
r = 1;
break;

case board_M5PaperMono:
w = 800;
h = 480;
pnl_cfg.offset_rotation = 3;
p->setColorDepth(lgfx::color_depth_t::grayscale_8bit);
r = 1;
break;

case board_M5StackCoreInk:
case board_M5AirQ:
w = 200;
Expand Down
2 changes: 1 addition & 1 deletion src/lgfx/v1/gitTagVersion.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define LGFX_VERSION_MAJOR 1
#define LGFX_VERSION_MINOR 2
#define LGFX_VERSION_PATCH 22
#define LGFX_VERSION_PATCH 23
#define LOVYANGFX_VERSION F( LGFX_VERSION_MAJOR "." LGFX_VERSION_MINOR "." LGFX_VERSION_PATCH )
Loading
Loading