Skip to content

Commit 884edf3

Browse files
committed
Merge branch 'feat/i2c_bus_support_soft_i2c' into 'master'
feat(i2c_bus): support software i2c Closes AEGHB-955 See merge request ae_group/esp-iot-solution!1207
2 parents e5990e8 + 92b68d5 commit 884edf3

File tree

14 files changed

+963
-156
lines changed

14 files changed

+963
-156
lines changed

.gitlab/ci/rules.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,8 @@
10811081
changes: *patterns-components_motor_esp_simplefoc
10821082
- <<: *if-dev-push
10831083
changes: *patterns-example_motor_foc_openloop_control
1084+
- <<: *if-dev-push
1085+
changes: *patterns-components_i2c_bus
10841086

10851087
.rules:build:example_motor_foc_velocity_control:
10861088
rules:
@@ -2056,6 +2058,8 @@
20562058
changes: *patterns-build_system
20572059
- <<: *if-dev-push
20582060
changes: *patterns-components_sensors_gesture_apds9960
2061+
- <<: *if-dev-push
2062+
changes: *patterns-components_i2c_bus
20592063

20602064
.rules:build:components_sensors_humiture_hdc2010_test_apps:
20612065
rules:
@@ -2067,6 +2071,8 @@
20672071
changes: *patterns-build_system
20682072
- <<: *if-dev-push
20692073
changes: *patterns-components_sensors_humiture_hdc2010
2074+
- <<: *if-dev-push
2075+
changes: *patterns-components_i2c_bus
20702076

20712077
.rules:build:components_sensors_humiture_hts221_test:
20722078
rules:
@@ -2089,6 +2095,8 @@
20892095
changes: *patterns-build_system
20902096
- <<: *if-dev-push
20912097
changes: *patterns-components_sensors_humiture_mvh3004d
2098+
- <<: *if-dev-push
2099+
changes: *patterns-components_i2c_bus
20922100

20932101
.rules:build:components_sensors_humiture_sht3x_test_apps:
20942102
rules:
@@ -2100,6 +2108,8 @@
21002108
changes: *patterns-build_system
21012109
- <<: *if-dev-push
21022110
changes: *patterns-components_sensors_humiture_sht3x
2111+
- <<: *if-dev-push
2112+
changes: *patterns-components_i2c_bus
21032113

21042114
.rules:build:components_sensors_imu_lis2dh12_test_apps:
21052115
rules:
@@ -2111,6 +2121,8 @@
21112121
changes: *patterns-build_system
21122122
- <<: *if-dev-push
21132123
changes: *patterns-components_sensors_imu_lis2dh12
2124+
- <<: *if-dev-push
2125+
changes: *patterns-components_i2c_bus
21142126

21152127
.rules:build:components_sensors_imu_mpu6050_test:
21162128
rules:
@@ -2144,6 +2156,8 @@
21442156
changes: *patterns-build_system
21452157
- <<: *if-dev-push
21462158
changes: *patterns-components_sensors_light_sensor_veml6040
2159+
- <<: *if-dev-push
2160+
changes: *patterns-components_i2c_bus
21472161

21482162
.rules:build:components_sensors_light_sensor_veml6075_test_apps:
21492163
rules:
@@ -2155,6 +2169,8 @@
21552169
changes: *patterns-build_system
21562170
- <<: *if-dev-push
21572171
changes: *patterns-components_sensors_light_sensor_veml6075
2172+
- <<: *if-dev-push
2173+
changes: *patterns-components_i2c_bus
21582174

21592175
.rules:build:components_sensors_pressure_bme280_test_apps:
21602176
rules:
@@ -2166,6 +2182,8 @@
21662182
changes: *patterns-build_system
21672183
- <<: *if-dev-push
21682184
changes: *patterns-components_sensors_pressure_bme280
2185+
- <<: *if-dev-push
2186+
changes: *patterns-components_i2c_bus
21692187

21702188
.rules:build:components_sensors_sensor_hub_test_apps:
21712189
rules:
@@ -2177,6 +2195,8 @@
21772195
changes: *patterns-build_system
21782196
- <<: *if-dev-push
21792197
changes: *patterns-components_sensors_sensor_hub
2198+
- <<: *if-dev-push
2199+
changes: *patterns-components_i2c_bus
21802200

21812201
.rules:build:components_spi_bus_test_apps:
21822202
rules:
@@ -2335,6 +2355,8 @@
23352355
changes: *patterns-components_sensors_power_monitor_ina236
23362356
- <<: *if-dev-push
23372357
changes: *patterns-components_bus
2358+
- <<: *if-dev-push
2359+
changes: *patterns-components_i2c_bus
23382360

23392361
.rules:build:components_i2c_bus_test_apps:
23402362
rules:

components/i2c_bus/CHANGELOG.md

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

3+
## v1.2.0 - 2025-1-14
4+
5+
### Enhancements:
6+
7+
- Support enabling software I2C to extend the number of I2C ports.
8+
39
## v1.1.0 - 2024-11-22
410

511
### Enhancements:

components/i2c_bus/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ else()
66
set(REQ esp_driver_i2c driver)
77
endif()
88

9+
if (CONFIG_I2C_BUS_SUPPORT_SOFTWARE)
10+
list(APPEND SRC_FILE "i2c_bus_soft.c")
11+
endif()
12+
913
idf_component_register(SRCS ${SRC_FILE}
1014
INCLUDE_DIRS "include"
15+
PRIV_INCLUDE_DIRS "private_include"
1116
REQUIRES ${REQ})
17+
1218
include(package_manager)
1319
cu_pkg_define_version(${CMAKE_CURRENT_LIST_DIR})

components/i2c_bus/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ menu "Bus Options"
2525
depends on ESP_IDF_VERSION >= 5.3
2626
help
2727
Enable this option for backward compatibility with the old I2C driver
28+
29+
config I2C_BUS_SUPPORT_SOFTWARE
30+
bool "Enable software I2C support"
31+
default n
32+
help
33+
Enable this option to use a software-implemented I2C driver. This can be useful for scenarios where
34+
hardware I2C is unavailable or additional I2C buses are needed beyond the hardware support.
35+
36+
config I2C_BUS_SOFTWARE_MAX_PORT
37+
int "Maximum number of software I2C ports"
38+
default 2
39+
range 1 5
40+
depends on I2C_BUS_SUPPORT_SOFTWARE
41+
help
42+
Set the maximum number of software I2C ports that can be used. This option is only applicable when
43+
software I2C support is enabled.
2844
endmenu
2945

3046
endmenu

components/i2c_bus/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The I2C bus component (Bus) is a set of application-layer code built on top of t
66
1. Simplified peripheral initialization processes
77
2. Thread-safe device operations
88
3. Simple and flexible RW operations
9+
4. Compatible with `driver/i2c` and `esp_driver_i2c`
10+
5. Supports additional software I2C
911

1012
This component abstracts the following concepts:
1113

0 commit comments

Comments
 (0)