diff --git a/CHANGELOG.md b/CHANGELOG.md index eebfcfa..3b1a2ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # ChangeLog +## v1.1.0 - 2025-02-07 + +### Enhancements: + +* feat(repo): add legacy header files to maintain compatibility +* feat(repo): update with esp-lib-utils v0.2.* + ## v1.0.1 - 2025-01-23 ### Enhancements: diff --git a/CMakeLists.txt b/CMakeLists.txt index c1af501..350d52b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,4 +13,9 @@ idf_component_register( driver ) -target_compile_options(${COMPONENT_LIB} PUBLIC -Wno-missing-field-initializers) +target_compile_options(${COMPONENT_LIB} + PUBLIC + -Wno-missing-field-initializers + PRIVATE + $<$:-std=gnu++17> +) diff --git a/idf_component.yml b/idf_component.yml index 846d206..3cd47cf 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -1,4 +1,4 @@ -version: "1.0.1" +version: "1.1.0" description: ESP32_IO_Expander is a library designed for driving IO expander chips using ESP SoCs url: https://github.com/esp-arduino-libs/ESP32_IO_Expander repository: https://github.com/esp-arduino-libs/ESP32_IO_Expander.git @@ -6,5 +6,5 @@ issues: https://github.com/esp-arduino-libs/ESP32_IO_Expander/issues dependencies: idf: ">=5.1" espressif/esp-lib-utils: - version: "0.1.*" + version: "0.2.*" public: true diff --git a/library.properties b/library.properties index df3c950..46fc8ad 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ESP32_IO_Expander -version=1.0.1 +version=1.1.0 author=espressif maintainer=espressif sentence=ESP32_IO_Expander is a library designed for driving IO expander chips using ESP SoCs @@ -8,4 +8,4 @@ category=Other architectures=esp32 url=https://github.com/esp-arduino-libs/ESP32_IO_Expander includes=esp_io_expander.hpp -depends=esp-lib-utils (>=0.1.0 && <0.2.0) +depends=esp-lib-utils (>=0.2.0 && <0.3.0) diff --git a/micropython.cmake b/micropython.cmake index 62d0d5a..f0caa53 100644 --- a/micropython.cmake +++ b/micropython.cmake @@ -16,7 +16,7 @@ target_include_directories(usermod_esp_io_expander INTERFACE ${SRC_DIR}) # Add compile options. Since the target is not created by `idf_component_register()`, we need to add the `ESP_PLATFORM` define manually. target_compile_options(usermod_esp_io_expander INTERFACE - -Wno-missing-field-initializers -DESP_PLATFORM $<$:-std=gnu++2b> + -Wno-missing-field-initializers -DESP_PLATFORM $<$:-std=gnu++17> ) # Link our INTERFACE library to the usermod target. diff --git a/src/ESP_IOExpander.h b/src/ESP_IOExpander.h new file mode 100644 index 0000000..7212f7d --- /dev/null +++ b/src/ESP_IOExpander.h @@ -0,0 +1,16 @@ + +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * This file is just to keep the compatibility with the old version of the library. Please use the file `chip/esp_expander_base.hpp` instead. + */ + +#pragma once + +#warning "This file is deprecated. Please use the file `chip/esp_expander_base.hpp` instead." + +#include "chip/esp_expander_base.hpp" diff --git a/src/base/esp_io_expander.h b/src/base/esp_io_expander.h new file mode 100644 index 0000000..0f26e86 --- /dev/null +++ b/src/base/esp_io_expander.h @@ -0,0 +1,16 @@ + +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * This file is just to keep the compatibility with the old version of the library. Please use the file `port/esp_io_expander.h` instead. + */ + +#pragma once + +#warning "This file is deprecated. Please use the file `port/esp_io_expander.h` instead." + +#include "port/esp_io_expander.h" diff --git a/src/chip/esp_expander_base.cpp b/src/chip/esp_expander_base.cpp index d535efe..1ad2262 100644 --- a/src/chip/esp_expander_base.cpp +++ b/src/chip/esp_expander_base.cpp @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include "inttypes.h" #include "driver/i2c.h" #include "esp_expander_utils.h" #include "esp_expander_base.hpp" @@ -59,14 +60,14 @@ void Base::Config::printHostConfig(void) const "\t\t-> [scl_pullup_en]: %d\n" "\t\t-> [master.clk_speed]: %d\n" "\t\t-> [clk_flags]: %d" - , host_id - , config.mode - , config.sda_io_num - , config.scl_io_num - , config.sda_pullup_en - , config.scl_pullup_en - , config.master.clk_speed - , config.clk_flags + , static_cast(host_id) + , static_cast(config.mode) + , static_cast(config.sda_io_num) + , static_cast(config.scl_io_num) + , static_cast(config.sda_pullup_en) + , static_cast(config.scl_pullup_en) + , static_cast(config.master.clk_speed) + , static_cast(config.clk_flags) ); } else { auto &config = std::get(host.value()); @@ -78,12 +79,12 @@ void Base::Config::printHostConfig(void) const "\t\t-> [sda_pullup_en]: %d\n" "\t\t-> [scl_pullup_en]: %d\n" "\t\t-> [clk_speed]: %d" - , host_id - , config.sda_io_num - , config.scl_io_num - , config.sda_pullup_en - , config.scl_pullup_en - , config.clk_speed + , static_cast(host_id) + , static_cast(config.sda_io_num) + , static_cast(config.scl_io_num) + , static_cast(config.sda_pullup_en) + , static_cast(config.scl_pullup_en) + , static_cast(config.clk_speed) ); } @@ -99,8 +100,8 @@ void Base::Config::printDeviceConfig(void) const "\n\t{Device config}[partial]\n" "\t\t-> [host_id]: %d\n" "\t\t-> [address]: 0x%02X" - , host_id - , device.address + , static_cast(host_id) + , static_cast(device.address) ); ESP_UTILS_LOG_TRACE_EXIT_WITH_THIS(); @@ -248,7 +249,7 @@ bool Base::multiPinMode(uint32_t pin_mask, uint8_t mode) ESP_UTILS_CHECK_FALSE_RETURN(isOverState(State::BEGIN), false, "Not begun"); - ESP_UTILS_LOGD("Param: pin_mask(%0x), mode(%d)", pin_mask, mode); + ESP_UTILS_LOGD("Param: pin_mask(0x%" PRIx32 "), mode(%d)", pin_mask, mode); ESP_UTILS_CHECK_FALSE_RETURN((mode == INPUT) || (mode == OUTPUT), false, "Invalid mode"); esp_io_expander_dir_t dir = (mode == INPUT) ? IO_EXPANDER_INPUT : IO_EXPANDER_OUTPUT; @@ -265,7 +266,7 @@ bool Base::multiDigitalWrite(uint32_t pin_mask, uint8_t value) ESP_UTILS_CHECK_FALSE_RETURN(isOverState(State::BEGIN), false, "Not begun"); - ESP_UTILS_LOGD("Param: pin_mask(%0x), value(%d)", pin_mask, value); + ESP_UTILS_LOGD("Param: pin_mask(0x%" PRIx32 "), value(%d)", pin_mask, value); ESP_UTILS_CHECK_ERROR_RETURN(esp_io_expander_set_level(device_handle, pin_mask, value), false, "Set level failed"); @@ -280,7 +281,7 @@ int64_t Base::multiDigitalRead(uint32_t pin_mask) ESP_UTILS_CHECK_FALSE_RETURN(isOverState(State::BEGIN), false, "Not begun"); - ESP_UTILS_LOGD("Param: pin_mask(%0x)", pin_mask); + ESP_UTILS_LOGD("Param: pin_mask(0x%" PRIx32 ")", pin_mask); uint32_t level = 0; ESP_UTILS_CHECK_ERROR_RETURN(esp_io_expander_get_level(device_handle, pin_mask, &level), false, "Get level failed");