diff --git a/src/M5GFX.cpp b/src/M5GFX.cpp index 4f0373c9..c7597679 100644 --- a/src/M5GFX.cpp +++ b/src/M5GFX.cpp @@ -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 { @@ -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; diff --git a/src/board_detect/board_detect.inl b/src/board_detect/board_detect.inl index 43de7970..d9a0f67c 100644 --- a/src/board_detect/board_detect.inl +++ b/src/board_detect/board_detect.inl @@ -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; } diff --git a/src/board_detect/m5/esp32s3/cores3.inl b/src/board_detect/m5/esp32s3/cores3.inl index 6111ad7e..81cd3136 100644 --- a/src/board_detect/m5/esp32s3/cores3.inl +++ b/src/board_detect/m5/esp32s3/cores3.inl @@ -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; } @@ -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"; } @@ -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; } diff --git a/src/lgfx/utility/lgfx_qoi.c b/src/lgfx/utility/lgfx_qoi.c index 033bd98a..047e7434 100644 --- a/src/lgfx/utility/lgfx_qoi.c +++ b/src/lgfx/utility/lgfx_qoi.c @@ -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"); } @@ -464,4 +466,3 @@ size_t lgfx_qoi_encode(const void *lineBuffer, const qoi_desc_t *desc, int flip, return p; } - diff --git a/src/lgfx/v1/panel/Panel_ED2208.inl b/src/lgfx/v1/panel/Panel_ED2208.inl index 32f7b72a..22d16a6f 100644 --- a/src/lgfx/v1/panel/Panel_ED2208.inl +++ b/src/lgfx/v1/panel/Panel_ED2208.inl @@ -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); diff --git a/src/lgfx/v1/panel/Panel_FrameBufferBase.hpp b/src/lgfx/v1/panel/Panel_FrameBufferBase.hpp index a50f2055..a60087ec 100644 --- a/src/lgfx/v1/panel/Panel_FrameBufferBase.hpp +++ b/src/lgfx/v1/panel/Panel_FrameBufferBase.hpp @@ -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; diff --git a/src/lgfx/v1/panel/Panel_FrameBufferBase.inl b/src/lgfx/v1/panel/Panel_FrameBufferBase.inl index e24e19d7..a74caa61 100644 --- a/src/lgfx/v1/panel/Panel_FrameBufferBase.inl +++ b/src/lgfx/v1/panel/Panel_FrameBufferBase.inl @@ -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) { diff --git a/src/lgfx/v1/panel/Panel_GDEW0154D67.inl b/src/lgfx/v1/panel/Panel_GDEW0154D67.inl index c0c3f4bb..39a2d443 100644 --- a/src/lgfx/v1/panel/Panel_GDEW0154D67.inl +++ b/src/lgfx/v1/panel/Panel_GDEW0154D67.inl @@ -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; @@ -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; diff --git a/src/lgfx/v1/panel/Panel_GDEW0154M09.inl b/src/lgfx/v1/panel/Panel_GDEW0154M09.inl index 20ed375e..2d0f7efa 100644 --- a/src/lgfx/v1/panel/Panel_GDEW0154M09.inl +++ b/src/lgfx/v1/panel/Panel_GDEW0154M09.inl @@ -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; @@ -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; @@ -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; diff --git a/src/lgfx/v1/panel/Panel_IT8951.inl b/src/lgfx/v1/panel/Panel_IT8951.inl index 8f9618e4..e669589f 100644 --- a/src/lgfx/v1/panel/Panel_IT8951.inl +++ b/src/lgfx/v1/panel/Panel_IT8951.inl @@ -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; @@ -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(heap_alloc(w * sizeof(bgr888_t) + 4)); bgr888_t* readbuf = reinterpret_cast(&writebuf[2]); @@ -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 ; diff --git a/src/lgfx/v1/panel/Panel_SSD1306.inl b/src/lgfx/v1/panel/Panel_SSD1306.inl index 802f869f..038f88d9 100644 --- a/src/lgfx/v1/panel/Panel_SSD1306.inl +++ b/src/lgfx/v1/panel/Panel_SSD1306.inl @@ -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; @@ -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; @@ -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; diff --git a/src/lgfx/v1/platforms/esp32/Bus_SPI.hpp b/src/lgfx/v1/platforms/esp32/Bus_SPI.hpp index 25e9b894..73134cdd 100644 --- a/src/lgfx/v1/platforms/esp32/Bus_SPI.hpp +++ b/src/lgfx/v1/platforms/esp32/Bus_SPI.hpp @@ -33,7 +33,12 @@ Original Source: #if __has_include() // ESP-IDF v5 + #pragma GCC diagnostic push + #if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic ignored "-Wliteral-suffix" + #endif #include + #pragma GCC diagnostic pop #elif __has_include() // ESP-IDF v4 #include diff --git a/src/lgfx/v1/platforms/esp32/Bus_SPI.inl b/src/lgfx/v1/platforms/esp32/Bus_SPI.inl index b0f57e72..1190f450 100644 --- a/src/lgfx/v1/platforms/esp32/Bus_SPI.inl +++ b/src/lgfx/v1/platforms/esp32/Bus_SPI.inl @@ -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 で送って次へ進む。 diff --git a/src/lgfx/v1/platforms/esp32/common.inl b/src/lgfx/v1/platforms/esp32/common.inl index dcb90d13..bd1286da 100644 --- a/src/lgfx/v1/platforms/esp32/common.inl +++ b/src/lgfx/v1/platforms/esp32/common.inl @@ -54,6 +54,8 @@ Contributors: #endif #include #include +// 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() #include @@ -61,12 +63,12 @@ Contributors: #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 @@ -75,7 +77,9 @@ Contributors: #include #endif #else - #if __has_include () + #if __has_include() // apb_ctrl_reg.h is the deprecated alias of syscon_reg.h (#warning in IDF 5.x) + #include + #elif __has_include () #include #endif #endif @@ -119,12 +123,19 @@ Contributors: #define LGFX_LP_I2C_NUM 0 #endif +#include + +// 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() #include #endif -#include - #if __has_include() #include #endif @@ -132,10 +143,14 @@ Contributors: #if __has_include() #include #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 + #pragma GCC diagnostic pop #endif #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(3, 4, 0) @@ -171,7 +186,12 @@ Contributors: #if defined (SOC_GDMA_SUPPORTED) // for C3/S3 #if __has_include() + #pragma GCC diagnostic push + #if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 10 + #pragma GCC diagnostic ignored "-Wvolatile" + #endif #include + #pragma GCC diagnostic pop #endif #if __has_include() #include @@ -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; } @@ -1196,8 +1220,6 @@ namespace lgfx } //---------------------------------------------------------------------------- - static constexpr const int __DECLARE_RCC_ATOMIC_ENV = 0; - namespace i2c { #if __has_include( ) @@ -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 diff --git a/src/lgfx/v1/platforms/esp32p4/Panel_LT8912B.inl b/src/lgfx/v1/platforms/esp32p4/Panel_LT8912B.inl index 2b798bf7..b7dbae4d 100644 --- a/src/lgfx/v1/platforms/esp32p4/Panel_LT8912B.inl +++ b/src/lgfx/v1/platforms/esp32p4/Panel_LT8912B.inl @@ -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;