Skip to content

Commit 973f215

Browse files
committed
target_esp32: allow to specify I2C port
1 parent 48fbb6f commit 973f215

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

components/ocs_io/i2c/target_esp32/master_bus.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ MasterBus::MasterBus(MasterBus::Params params) {
2929
memset(&config, 0, sizeof(config));
3030

3131
config.clk_source = I2C_CLK_SRC_DEFAULT;
32-
config.i2c_port = I2C_NUM_0;
32+
config.i2c_port = params.port;
3333
config.sda_io_num = params.sda;
3434
config.scl_io_num = params.scl;
3535
config.glitch_ignore_cnt = 7;

components/ocs_io/i2c/target_esp32/master_bus.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class MasterBus : public IBus, private core::NonCopyable<> {
2424

2525
//! Clock line.
2626
gpio_num_t scl { GPIO_NUM_NC };
27+
28+
//! I2C port.
29+
i2c_port_t port { I2C_NUM_0 };
2730
};
2831

2932
//! Initialize.

0 commit comments

Comments
 (0)