Skip to content

Commit 67f83c0

Browse files
ports/esp32: Make legacy SoftI2C construction conditional.
Signed-off-by: Malcolm McKellips <[email protected]>
1 parent be53d89 commit 67f83c0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ports/esp32/machine_i2c.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ static void machine_hw_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_p
146146
}
147147

148148
mp_obj_t machine_hw_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
149+
// Create a SoftI2C instance if no id is specified (or is -1) but other arguments are given
150+
if (n_args != 0) {
151+
MP_MACHINE_I2C_CHECK_FOR_LEGACY_SOFTI2C_CONSTRUCTION(n_args, n_kw, all_args);
152+
}
149153

150154
// Parse args
151155
enum { ARG_id, ARG_scl, ARG_sda, ARG_freq, ARG_timeout };

0 commit comments

Comments
 (0)