Skip to content

feat(repo): add legacy header files to maintain compatibility #18

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 2 commits into from
Feb 7, 2025
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<$<COMPILE_LANGUAGE:CXX>:-std=gnu++17>
)
4 changes: 2 additions & 2 deletions idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
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
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
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
2 changes: 1 addition & 1 deletion micropython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<$<COMPILE_LANGUAGE:CXX>:-std=gnu++2b>
-Wno-missing-field-initializers -DESP_PLATFORM $<$<COMPILE_LANGUAGE:CXX>:-std=gnu++17>
)

# Link our INTERFACE library to the usermod target.
Expand Down
16 changes: 16 additions & 0 deletions src/ESP_IOExpander.h
Original file line number Diff line number Diff line change
@@ -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"
16 changes: 16 additions & 0 deletions src/base/esp_io_expander.h
Original file line number Diff line number Diff line change
@@ -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"
39 changes: 20 additions & 19 deletions src/chip/esp_expander_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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<int>(host_id)
, static_cast<int>(config.mode)
, static_cast<int>(config.sda_io_num)
, static_cast<int>(config.scl_io_num)
, static_cast<int>(config.sda_pullup_en)
, static_cast<int>(config.scl_pullup_en)
, static_cast<int>(config.master.clk_speed)
, static_cast<int>(config.clk_flags)
);
} else {
auto &config = std::get<HostPartialConfig>(host.value());
Expand All @@ -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<int>(host_id)
, static_cast<int>(config.sda_io_num)
, static_cast<int>(config.scl_io_num)
, static_cast<int>(config.sda_pullup_en)
, static_cast<int>(config.scl_pullup_en)
, static_cast<int>(config.clk_speed)
);
}

Expand All @@ -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<int>(host_id)
, static_cast<int>(device.address)
);

ESP_UTILS_LOG_TRACE_EXIT_WITH_THIS();
Expand Down Expand Up @@ -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;
Expand All @@ -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");

Expand All @@ -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");
Expand Down
Loading