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
12 changes: 6 additions & 6 deletions src/M5GFX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,10 +475,10 @@ namespace m5gfx

struct Light_M5StackAtomS3R : public lgfx::ILight
{
Light_M5StackAtomS3R(int i2c_port, int sda, int scl, std::uint8_t i2c_addr,
std::uint32_t i2c_freq)
: _i2c_port(i2c_port), _sda(sda), _scl(scl), _i2c_addr(i2c_addr),
_i2c_freq(i2c_freq) {}
Light_M5StackAtomS3R(int port, int sda, int scl, std::uint8_t i2c_addr,
std::uint32_t freq)
: _i2c_port(port), _sda(sda), _scl(scl), _i2c_addr(i2c_addr),
_i2c_freq(freq) {}

bool init(uint8_t brightness) override
{
Expand Down Expand Up @@ -507,8 +507,8 @@ namespace m5gfx

struct Light_M5StackStamPLC : public lgfx::ILight
{
Light_M5StackStamPLC(int i2c_port, int sda, int scl, std::uint8_t i2c_addr)
: _i2c_port(i2c_port), _sda(sda), _scl(scl), _i2c_addr(i2c_addr) {}
Light_M5StackStamPLC(int port, int sda, int scl, std::uint8_t i2c_addr)
: _i2c_port(port), _sda(sda), _scl(scl), _i2c_addr(i2c_addr) {}

bool _is_backlight_inited = false;

Expand Down
4 changes: 2 additions & 2 deletions src/board_detect/board_detect.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1585,9 +1585,9 @@ namespace board_detect
class spi_id_detector_t final : public board_detector_t
{
public:
spi_id_detector_t(const board_def_t* const* members, const spi_id_member_t* members_desc,
spi_id_detector_t(const board_def_t* const* board_members, const spi_id_member_t* members_desc,
std::uint8_t member_count, bool shared_id_read = false)
: board_detector_t(members),
: board_detector_t(board_members),
members_desc_(members_desc), member_count_(member_count),
shared_id_read_(shared_id_read) {}
bool signature(probe_ctx_t&) const override { return true; }
Expand Down
12 changes: 6 additions & 6 deletions src/board_detect/m5/esp32s3/cores3.inl
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@
const auto port0 = lgfx::i2c::readRegister8(port, aw_addr, port0_reg, freq);
if (!port0.has_value()) { return "read failed"; }
if (port0.value() & bus_en) { return nullptr; }
const std::uint8_t off = port0.value();
const std::uint8_t off_value = port0.value();
enum class off_state_t { unknown, off, on };
const auto confirm_off = [&]()
{
bool read_ok = false;
for (int retry = 0; retry < 3; ++retry)
{
lgfx::i2c::writeRegister8(port, aw_addr, port0_reg, off, 0, freq);
lgfx::i2c::writeRegister8(port, aw_addr, port0_reg, off_value, 0, freq);
const auto read = lgfx::i2c::readRegister8(port, aw_addr, port0_reg, freq);
read_ok = read.has_value();
if (read_ok && !(read.value() & bus_en)) { return off_state_t::off; }
Expand All @@ -148,14 +148,14 @@
};
for (std::uint32_t i = 0; i < 8; ++i)
{
if (!lgfx::i2c::writeRegister8(port, aw_addr, port0_reg, off | bus_en, 0, freq).has_value())
if (!lgfx::i2c::writeRegister8(port, aw_addr, port0_reg, off_value | bus_en, 0, freq).has_value())
{
const auto state = confirm_off();
if (state == off_state_t::on) { break; }
return state == off_state_t::off ? "precharge write failed" : "precharge read failed";
}
lgfx::delayMicroseconds(i * 16);
if (!lgfx::i2c::writeRegister8(port, aw_addr, port0_reg, off, 0, freq).has_value())
if (!lgfx::i2c::writeRegister8(port, aw_addr, port0_reg, off_value, 0, freq).has_value())
{
const auto state = confirm_off();
if (state == off_state_t::unknown) { return "precharge read failed"; }
Expand All @@ -165,8 +165,8 @@
}
for (int retry = 0; retry < 3; ++retry)
{
if (lgfx::i2c::writeRegister8(port, aw_addr, port0_reg, off | bus_en, 0, freq).has_value()
&& lgfx::i2c::readRegister8(port, aw_addr, port0_reg, freq).value_or(0) == (off | bus_en))
if (lgfx::i2c::writeRegister8(port, aw_addr, port0_reg, off_value | bus_en, 0, freq).has_value()
&& lgfx::i2c::readRegister8(port, aw_addr, port0_reg, freq).value_or(0) == (off_value | bus_en))
{
return nullptr;
}
Expand Down
3 changes: 2 additions & 1 deletion src/lgfx/utility/lgfx_qoi.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ int lgfx_qoi_prepare(qoi_t *qoi, lgfx_qoi_read_callback_t read_cb, void* user_da
// if( qoi->desc.height >= QOI_PIXELS_MAX / qoi->desc.width ) return QOI_ERROR("Image too big");
// The row buffer is width * 4 bytes. Where size_t is 32 bits that product wraps for a large width,
// and the decoder would then write width pixels into the small buffer that malloc() gave back.
#if SIZE_MAX <= UINT32_MAX
if (qoi->desc.width > SIZE_MAX / sizeof(qoi_rgba_t)) return QOI_ERROR("Image too wide");
#endif

qoi->pixelBuffer = (qoi_rgba_t*)malloc(qoi->desc.width * sizeof(qoi_rgba_t));
if (qoi->pixelBuffer == NULL) { return QOI_ERROR("Insufficient memory"); }
Expand Down Expand Up @@ -464,4 +466,3 @@ size_t lgfx_qoi_encode(const void *lineBuffer, const qoi_desc_t *desc, int flip,

return p;
}

2 changes: 1 addition & 1 deletion src/lgfx/v1/panel/Panel_ED2208.inl
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ namespace lgfx
_bus->endTransaction();
}

bool Panel_ED2208::init(bool use_reset)
bool Panel_ED2208::init(bool /*use_reset*/)
{
pinMode(_cfg.pin_busy, pin_mode_t::input_pullup);

Expand Down
4 changes: 2 additions & 2 deletions src/lgfx/v1/panel/Panel_FrameBufferBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ namespace lgfx
color_depth_t setColorDepth(color_depth_t depth) override { _write_depth = depth; _read_depth = depth; return depth; }

void setInvert(bool invert) override { _invert = invert; }
void setSleep(bool flg) override {}
void setPowerSave(bool flg) override {}
void setSleep(bool /*flg*/) override {}
void setPowerSave(bool /*flg*/) override {}

void display(uint_fast16_t x, uint_fast16_t y, uint_fast16_t w, uint_fast16_t h) override;

Expand Down
4 changes: 2 additions & 2 deletions src/lgfx/v1/panel/Panel_FrameBufferBase.inl
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ namespace lgfx

void* ptr_start = (void*)~0;
void* ptr_end = nullptr;
for (int y = _range_mod.top; y < ye; ++y)
for (int line_y = _range_mod.top; line_y < ye; ++line_y)
{
auto ptr = &_lines_buffer[y][xs_byte];
auto ptr = &_lines_buffer[line_y][xs_byte];
if (!isEmbeddedMemory(ptr))
{
if (ptr_start < ptr_end) {
Expand Down
4 changes: 2 additions & 2 deletions src/lgfx/v1/panel/Panel_GDEW0154D67.inl
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ epd_mode が epd_qualityか否かの変化をした場合も同様にCMD_DISPLAY
} while (++y <= ye);
}

void Panel_GDEW0154D67::writeImage(uint_fast16_t x, uint_fast16_t y, uint_fast16_t w, uint_fast16_t h, pixelcopy_t* param, bool use_dma)
void Panel_GDEW0154D67::writeImage(uint_fast16_t x, uint_fast16_t y, uint_fast16_t w, uint_fast16_t h, pixelcopy_t* param, bool /*use_dma*/)
{
uint_fast16_t xs = x, xe = x + w - 1;
uint_fast16_t ys = y, ye = y + h - 1;
Expand Down Expand Up @@ -348,7 +348,7 @@ epd_mode が epd_qualityか否かの変化をした場合も同様にCMD_DISPLAY
} while (++y < h);
}

void Panel_GDEW0154D67::writePixels(pixelcopy_t* param, uint32_t length, bool use_dma)
void Panel_GDEW0154D67::writePixels(pixelcopy_t* param, uint32_t length, bool /*use_dma*/)
{
{
uint_fast16_t xs = _xs;
Expand Down
6 changes: 3 additions & 3 deletions src/lgfx/v1/panel/Panel_GDEW0154M09.inl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace lgfx
_epd_mode = epd_mode_t::epd_quality;
}

color_depth_t Panel_GDEW0154M09::setColorDepth(color_depth_t depth)
color_depth_t Panel_GDEW0154M09::setColorDepth(color_depth_t /*depth*/)
{
_write_depth = color_depth_t::rgb565_2Byte;
_read_depth = color_depth_t::rgb565_2Byte;
Expand Down Expand Up @@ -213,7 +213,7 @@ namespace lgfx
} while (++y <= ye);
}

void Panel_GDEW0154M09::writeImage(uint_fast16_t x, uint_fast16_t y, uint_fast16_t w, uint_fast16_t h, pixelcopy_t* param, bool use_dma)
void Panel_GDEW0154M09::writeImage(uint_fast16_t x, uint_fast16_t y, uint_fast16_t w, uint_fast16_t h, pixelcopy_t* param, bool /*use_dma*/)
{
uint_fast16_t xs = x, xe = x + w - 1;
uint_fast16_t ys = y, ye = y + h - 1;
Expand Down Expand Up @@ -242,7 +242,7 @@ namespace lgfx
} while (++y < h);
}

void Panel_GDEW0154M09::writePixels(pixelcopy_t* param, uint32_t length, bool use_dma)
void Panel_GDEW0154M09::writePixels(pixelcopy_t* param, uint32_t length, bool /*use_dma*/)
{
{
uint_fast16_t xs = _xs;
Expand Down
6 changes: 3 additions & 3 deletions src/lgfx/v1/panel/Panel_IT8951.inl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ IT8951 Registers defines
{
}

color_depth_t Panel_IT8951::setColorDepth(color_depth_t depth)
color_depth_t Panel_IT8951::setColorDepth(color_depth_t /*depth*/)
{
_write_depth = color_depth_t::rgb888_3Byte;
_read_depth = color_depth_t::rgb888_3Byte;
Expand Down Expand Up @@ -596,7 +596,7 @@ IT8951 Registers defines
_write_command(IT8951_TCON_LD_IMG_END);
}

void Panel_IT8951::writeImage(uint_fast16_t x, uint_fast16_t y, uint_fast16_t w, uint_fast16_t h, pixelcopy_t* param, bool use_dma)
void Panel_IT8951::writeImage(uint_fast16_t x, uint_fast16_t y, uint_fast16_t w, uint_fast16_t h, pixelcopy_t* param, bool /*use_dma*/)
{
uint16_t* writebuf = static_cast<uint16_t*>(heap_alloc(w * sizeof(bgr888_t) + 4));
bgr888_t* readbuf = reinterpret_cast<lgfx::bgr888_t*>(&writebuf[2]);
Expand Down Expand Up @@ -707,7 +707,7 @@ IT8951 Registers defines
_xpos = xpos;
}

void Panel_IT8951::writePixels(pixelcopy_t* param, uint32_t length, bool use_dma)
void Panel_IT8951::writePixels(pixelcopy_t* param, uint32_t length, bool /*use_dma*/)
{
uint32_t xs = _xs ;
uint32_t ys = _ys ;
Expand Down
6 changes: 3 additions & 3 deletions src/lgfx/v1/panel/Panel_SSD1306.inl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace lgfx
_bayer_offset = bayer_4x4[i & 15] >> 4;
}

color_depth_t Panel_1bitOLED::setColorDepth(color_depth_t depth)
color_depth_t Panel_1bitOLED::setColorDepth(color_depth_t /*depth*/)
{
_write_depth = color_depth_t::rgb565_2Byte;
_read_depth = color_depth_t::rgb565_2Byte;
Expand Down Expand Up @@ -141,7 +141,7 @@ namespace lgfx
} while (++y <= ye);
}

void Panel_1bitOLED::writeImage(uint_fast16_t x, uint_fast16_t y, uint_fast16_t w, uint_fast16_t h, pixelcopy_t* param, bool use_dma)
void Panel_1bitOLED::writeImage(uint_fast16_t x, uint_fast16_t y, uint_fast16_t w, uint_fast16_t h, pixelcopy_t* param, bool /*use_dma*/)
{
uint_fast16_t xs = x, xe = x + w - 1;
uint_fast16_t ys = y, ye = y + h - 1;
Expand Down Expand Up @@ -170,7 +170,7 @@ namespace lgfx
} while (++y < h);
}

void Panel_1bitOLED::writePixels(pixelcopy_t* param, uint32_t length, bool use_dma)
void Panel_1bitOLED::writePixels(pixelcopy_t* param, uint32_t length, bool /*use_dma*/)
{
{
uint_fast16_t xs = _xs;
Expand Down
5 changes: 5 additions & 0 deletions src/lgfx/v1/platforms/esp32/Bus_SPI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ Original Source:

#if __has_include(<esp_private/spi_common_internal.h>)
// ESP-IDF v5
#pragma GCC diagnostic push
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic ignored "-Wliteral-suffix"
#endif
#include <esp_private/spi_common_internal.h>
#pragma GCC diagnostic pop
#elif __has_include(<driver/spi_common_internal.h>)
// ESP-IDF v4
#include <driver/spi_common_internal.h>
Expand Down
3 changes: 2 additions & 1 deletion src/lgfx/v1/platforms/esp32/Bus_SPI.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,8 @@ label_start:
_dma_queue[index].next = &_dma_queue[index + 1];
}

dma_desc_t* first = &_dma_queue[0];
// Unused on targets that start the queue some other way.
__attribute__((unused)) dma_desc_t* first = &_dma_queue[0];
#if defined ( LGFX_PSRAM_DMA_CAPABLE )
// 先頭 descriptor が外部 RAM なら、先頭を DMA ブロック境界に揃える (writeBytes と同じ理由)。
// 端数は CPU で送り、descriptor の先頭と長さを詰める。短い descriptor は丸ごと CPU で送って次へ進む。
Expand Down
41 changes: 33 additions & 8 deletions src/lgfx/v1/platforms/esp32/common.inl
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,21 @@ Contributors:
#endif
#include <soc/i2c_reg.h>
#include <soc/i2c_struct.h>
// Where no lock is needed, still declare the variable PERIPH_RCC_ATOMIC() provides: the *_ll_* macros inside the block refer to it.
#define LGFX_RCC_NO_ATOMIC() for (int _rc_cnt = 1, __DECLARE_RCC_ATOMIC_ENV; _rc_cnt; _rc_cnt--)
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0))
#if __has_include(<hal/i2c_ll.h>)
#include <hal/i2c_ll.h>
#if defined ( i2c_ll_reset_register ) || (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0))
#if SOC_PERIPH_CLK_CTRL_SHARED
#define I2C_CLOCK_SRC_ATOMIC() PERIPH_RCC_ATOMIC()
#else
#define I2C_CLOCK_SRC_ATOMIC()
#define I2C_CLOCK_SRC_ATOMIC() LGFX_RCC_NO_ATOMIC()
#endif
#if !SOC_RCC_IS_INDEPENDENT
#define I2C_RCC_ATOMIC() PERIPH_RCC_ATOMIC()
#else
#define I2C_RCC_ATOMIC()
#define I2C_RCC_ATOMIC() LGFX_RCC_NO_ATOMIC()
#endif
#endif
#endif
Expand All @@ -75,7 +77,9 @@ Contributors:
#include <soc/syscon_reg.h>
#endif
#else
#if __has_include (<soc/apb_ctrl_reg.h>)
#if __has_include(<soc/syscon_reg.h>) // apb_ctrl_reg.h is the deprecated alias of syscon_reg.h (#warning in IDF 5.x)
#include <soc/syscon_reg.h>
#elif __has_include (<soc/apb_ctrl_reg.h>)
#include <soc/apb_ctrl_reg.h>
#endif
#endif
Expand Down Expand Up @@ -119,23 +123,34 @@ Contributors:
#define LGFX_LP_I2C_NUM 0
#endif

#include <initializer_list>

// Some ESP-IDF gpio_ll.h versions (e.g. ESP32-C5 in IDF 5.5) leave struct members out of an initializer,
// which C++ reports under -Wextra. Keep that warning out of user builds.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 10
#pragma GCC diagnostic ignored "-Wvolatile"
#endif
#if __has_include(<esp_private/gpio.h>)
#include <esp_private/gpio.h>
#endif

#include <initializer_list>

#if __has_include(<hal/gpio_ll.h>)
#include <hal/gpio_ll.h>
#endif

#if __has_include(<esp_rom_gpio.h>)
#include <esp_rom_gpio.h>
#endif
#pragma GCC diagnostic pop

#if defined (ESP_IDF_VERSION_VAL)
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#include <hal/gpio_hal.h>
#pragma GCC diagnostic pop
#endif
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(3, 4, 0)

Expand Down Expand Up @@ -171,7 +186,12 @@ Contributors:

#if defined (SOC_GDMA_SUPPORTED) // for C3/S3
#if __has_include(<hal/gdma_ll.h>)
#pragma GCC diagnostic push
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 10
#pragma GCC diagnostic ignored "-Wvolatile"
#endif
#include <hal/gdma_ll.h>
#pragma GCC diagnostic pop
#endif
#if __has_include(<soc/gdma_reg.h>)
#include <soc/gdma_reg.h>
Expand Down Expand Up @@ -487,7 +507,11 @@ namespace lgfx
uint32_t pkg_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4)
{
#if defined ( SYSCON_DATE_REG )
if (REG_READ(SYSCON_DATE_REG) & 0x80000000)
#else
if (REG_READ(APB_CTRL_DATE_REG) & 0x80000000)
#endif
{ // ESP32PICOV302
return 6;
}
Expand Down Expand Up @@ -1196,8 +1220,6 @@ namespace lgfx
}

//----------------------------------------------------------------------------
static constexpr const int __DECLARE_RCC_ATOMIC_ENV = 0;

namespace i2c
{
#if __has_include( <core_version.h> )
Expand Down Expand Up @@ -1416,7 +1438,10 @@ namespace lgfx
#if LGFX_LP_I2C_NUM > 0
if (isLpPort(i2c_num))
{ // HP 用の i2c_ll_reset_register は SoC の PCR I2C 配列を範囲外参照するため LP 専用関数を使う;
lp_i2c_ll_reset_register(i2c_num - LGFX_HP_I2C_NUM);
LGFX_RCC_NO_ATOMIC() {
lp_i2c_ll_reset_register(i2c_num - LGFX_HP_I2C_NUM);
(void)__DECLARE_RCC_ATOMIC_ENV;
}
return;
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/lgfx/v1/platforms/esp32p4/Panel_LT8912B.inl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct esp_lcd_dsi_bus_t {

// LT8912B esp_lcd compatibility implementation. Kept in this file to match
// the M5GFX Panel_xxx convention while Panel_LT8912B wraps it for LovyanGFX.
static const char *TAG = "lt8912b";
static const char *TAG __attribute__((unused)) = "lt8912b";

static constexpr uint8_t LT8912B_IO_I2C_MAIN_ADDRESS = 0x48;
static constexpr uint8_t LT8912B_IO_I2C_CEC_ADDRESS = 0x49;
Expand Down
Loading