Skip to content

Commit e79a638

Browse files
authored
Merge pull request #18 from esp-arduino-libs/feat/maintain_compatibility
feat(repo): add legacy header files to maintain compatibility
2 parents 61fbf44 + 25cb940 commit e79a638

8 files changed

+70
-25
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# ChangeLog
22

3+
## v1.1.0 - 2025-02-07
4+
5+
### Enhancements:
6+
7+
* feat(repo): add legacy header files to maintain compatibility
8+
* feat(repo): update with esp-lib-utils v0.2.*
9+
310
## v1.0.1 - 2025-01-23
411

512
### Enhancements:

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,9 @@ idf_component_register(
1313
driver
1414
)
1515

16-
target_compile_options(${COMPONENT_LIB} PUBLIC -Wno-missing-field-initializers)
16+
target_compile_options(${COMPONENT_LIB}
17+
PUBLIC
18+
-Wno-missing-field-initializers
19+
PRIVATE
20+
$<$<COMPILE_LANGUAGE:CXX>:-std=gnu++17>
21+
)

idf_component.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
version: "1.0.1"
1+
version: "1.1.0"
22
description: ESP32_IO_Expander is a library designed for driving IO expander chips using ESP SoCs
33
url: https://github.com/esp-arduino-libs/ESP32_IO_Expander
44
repository: https://github.com/esp-arduino-libs/ESP32_IO_Expander.git
55
issues: https://github.com/esp-arduino-libs/ESP32_IO_Expander/issues
66
dependencies:
77
idf: ">=5.1"
88
espressif/esp-lib-utils:
9-
version: "0.1.*"
9+
version: "0.2.*"
1010
public: true

library.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=ESP32_IO_Expander
2-
version=1.0.1
2+
version=1.1.0
33
author=espressif
44
maintainer=espressif
55
sentence=ESP32_IO_Expander is a library designed for driving IO expander chips using ESP SoCs
@@ -8,4 +8,4 @@ category=Other
88
architectures=esp32
99
url=https://github.com/esp-arduino-libs/ESP32_IO_Expander
1010
includes=esp_io_expander.hpp
11-
depends=esp-lib-utils (>=0.1.0 && <0.2.0)
11+
depends=esp-lib-utils (>=0.2.0 && <0.3.0)

micropython.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ target_include_directories(usermod_esp_io_expander INTERFACE ${SRC_DIR})
1616
# Add compile options. Since the target is not created by `idf_component_register()`, we need to add the `ESP_PLATFORM` define manually.
1717
target_compile_options(usermod_esp_io_expander
1818
INTERFACE
19-
-Wno-missing-field-initializers -DESP_PLATFORM $<$<COMPILE_LANGUAGE:CXX>:-std=gnu++2b>
19+
-Wno-missing-field-initializers -DESP_PLATFORM $<$<COMPILE_LANGUAGE:CXX>:-std=gnu++17>
2020
)
2121

2222
# Link our INTERFACE library to the usermod target.

src/ESP_IOExpander.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
/*
3+
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
/**
9+
* 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.
10+
*/
11+
12+
#pragma once
13+
14+
#warning "This file is deprecated. Please use the file `chip/esp_expander_base.hpp` instead."
15+
16+
#include "chip/esp_expander_base.hpp"

src/base/esp_io_expander.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
/*
3+
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
/**
9+
* 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.
10+
*/
11+
12+
#pragma once
13+
14+
#warning "This file is deprecated. Please use the file `port/esp_io_expander.h` instead."
15+
16+
#include "port/esp_io_expander.h"

src/chip/esp_expander_base.cpp

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
#include "inttypes.h"
78
#include "driver/i2c.h"
89
#include "esp_expander_utils.h"
910
#include "esp_expander_base.hpp"
@@ -59,14 +60,14 @@ void Base::Config::printHostConfig(void) const
5960
"\t\t-> [scl_pullup_en]: %d\n"
6061
"\t\t-> [master.clk_speed]: %d\n"
6162
"\t\t-> [clk_flags]: %d"
62-
, host_id
63-
, config.mode
64-
, config.sda_io_num
65-
, config.scl_io_num
66-
, config.sda_pullup_en
67-
, config.scl_pullup_en
68-
, config.master.clk_speed
69-
, config.clk_flags
63+
, static_cast<int>(host_id)
64+
, static_cast<int>(config.mode)
65+
, static_cast<int>(config.sda_io_num)
66+
, static_cast<int>(config.scl_io_num)
67+
, static_cast<int>(config.sda_pullup_en)
68+
, static_cast<int>(config.scl_pullup_en)
69+
, static_cast<int>(config.master.clk_speed)
70+
, static_cast<int>(config.clk_flags)
7071
);
7172
} else {
7273
auto &config = std::get<HostPartialConfig>(host.value());
@@ -78,12 +79,12 @@ void Base::Config::printHostConfig(void) const
7879
"\t\t-> [sda_pullup_en]: %d\n"
7980
"\t\t-> [scl_pullup_en]: %d\n"
8081
"\t\t-> [clk_speed]: %d"
81-
, host_id
82-
, config.sda_io_num
83-
, config.scl_io_num
84-
, config.sda_pullup_en
85-
, config.scl_pullup_en
86-
, config.clk_speed
82+
, static_cast<int>(host_id)
83+
, static_cast<int>(config.sda_io_num)
84+
, static_cast<int>(config.scl_io_num)
85+
, static_cast<int>(config.sda_pullup_en)
86+
, static_cast<int>(config.scl_pullup_en)
87+
, static_cast<int>(config.clk_speed)
8788
);
8889
}
8990

@@ -99,8 +100,8 @@ void Base::Config::printDeviceConfig(void) const
99100
"\n\t{Device config}[partial]\n"
100101
"\t\t-> [host_id]: %d\n"
101102
"\t\t-> [address]: 0x%02X"
102-
, host_id
103-
, device.address
103+
, static_cast<int>(host_id)
104+
, static_cast<int>(device.address)
104105
);
105106

106107
ESP_UTILS_LOG_TRACE_EXIT_WITH_THIS();
@@ -248,7 +249,7 @@ bool Base::multiPinMode(uint32_t pin_mask, uint8_t mode)
248249

249250
ESP_UTILS_CHECK_FALSE_RETURN(isOverState(State::BEGIN), false, "Not begun");
250251

251-
ESP_UTILS_LOGD("Param: pin_mask(%0x), mode(%d)", pin_mask, mode);
252+
ESP_UTILS_LOGD("Param: pin_mask(0x%" PRIx32 "), mode(%d)", pin_mask, mode);
252253
ESP_UTILS_CHECK_FALSE_RETURN((mode == INPUT) || (mode == OUTPUT), false, "Invalid mode");
253254

254255
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)
265266

266267
ESP_UTILS_CHECK_FALSE_RETURN(isOverState(State::BEGIN), false, "Not begun");
267268

268-
ESP_UTILS_LOGD("Param: pin_mask(%0x), value(%d)", pin_mask, value);
269+
ESP_UTILS_LOGD("Param: pin_mask(0x%" PRIx32 "), value(%d)", pin_mask, value);
269270

270271
ESP_UTILS_CHECK_ERROR_RETURN(esp_io_expander_set_level(device_handle, pin_mask, value), false, "Set level failed");
271272

@@ -280,7 +281,7 @@ int64_t Base::multiDigitalRead(uint32_t pin_mask)
280281

281282
ESP_UTILS_CHECK_FALSE_RETURN(isOverState(State::BEGIN), false, "Not begun");
282283

283-
ESP_UTILS_LOGD("Param: pin_mask(%0x)", pin_mask);
284+
ESP_UTILS_LOGD("Param: pin_mask(0x%" PRIx32 ")", pin_mask);
284285

285286
uint32_t level = 0;
286287
ESP_UTILS_CHECK_ERROR_RETURN(esp_io_expander_get_level(device_handle, pin_mask, &level), false, "Get level failed");

0 commit comments

Comments
 (0)