Skip to content

Commit aaed338

Browse files
committed
extmod/machine_i2c: Remove "id" arg in SoftI2C constructor.
The SoftI2C constructor is now used soley to create SoftI2C instances, it can no longer delegate to create a hardware-based I2C instance. Signed-off-by: Damien George <[email protected]>
1 parent c35deb2 commit aaed338

File tree

5 files changed

+0
-21
lines changed

5 files changed

+0
-21
lines changed

extmod/machine_i2c.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -325,21 +325,6 @@ STATIC void machine_i2c_obj_init_helper(machine_i2c_obj_t *self, size_t n_args,
325325
}
326326

327327
STATIC mp_obj_t mp_machine_soft_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
328-
// check the id argument, if given
329-
if (n_args > 0) {
330-
if (args[0] != MP_OBJ_NEW_SMALL_INT(-1)) {
331-
#if defined(MICROPY_PY_MACHINE_I2C_MAKE_NEW)
332-
// dispatch to port-specific constructor
333-
extern mp_obj_t MICROPY_PY_MACHINE_I2C_MAKE_NEW(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args);
334-
return MICROPY_PY_MACHINE_I2C_MAKE_NEW(type, n_args, n_kw, args);
335-
#else
336-
mp_raise_ValueError(MP_ERROR_TEXT("invalid I2C peripheral"));
337-
#endif
338-
}
339-
--n_args;
340-
++args;
341-
}
342-
343328
// create new soft I2C object
344329
machine_i2c_obj_t *self = m_new_obj(machine_i2c_obj_t);
345330
self->base.type = &mp_machine_soft_i2c_type;

ports/esp32/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@
145145
#define MICROPY_PY_MACHINE_PIN_MAKE_NEW mp_pin_make_new
146146
#define MICROPY_PY_MACHINE_PULSE (1)
147147
#define MICROPY_PY_MACHINE_I2C (1)
148-
#define MICROPY_PY_MACHINE_I2C_MAKE_NEW machine_hw_i2c_make_new
149148
#define MICROPY_PY_MACHINE_SPI (1)
150149
#define MICROPY_PY_MACHINE_SPI_MSB (0)
151150
#define MICROPY_PY_MACHINE_SPI_LSB (1)

ports/nrf/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@
135135
#define MICROPY_PY_UTIME_MP_HAL (1)
136136
#define MICROPY_PY_MACHINE (1)
137137
#define MICROPY_PY_MACHINE_PULSE (0)
138-
#define MICROPY_PY_MACHINE_I2C_MAKE_NEW machine_hard_i2c_make_new
139138
#define MICROPY_PY_MACHINE_SPI (0)
140139
#define MICROPY_PY_MACHINE_SPI_MIN_DELAY (0)
141140
#define MICROPY_PY_FRAMEBUF (0)

ports/stm32/mpconfigport.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,6 @@
183183
#define MICROPY_PY_MACHINE_PULSE (1)
184184
#define MICROPY_PY_MACHINE_PIN_MAKE_NEW mp_pin_make_new
185185
#define MICROPY_PY_MACHINE_I2C (1)
186-
#if MICROPY_HW_ENABLE_HW_I2C
187-
#define MICROPY_PY_MACHINE_I2C_MAKE_NEW machine_hard_i2c_make_new
188-
#endif
189186
#define MICROPY_PY_MACHINE_SPI (1)
190187
#define MICROPY_PY_MACHINE_SPI_MSB (SPI_FIRSTBIT_MSB)
191188
#define MICROPY_PY_MACHINE_SPI_LSB (SPI_FIRSTBIT_LSB)

ports/zephyr/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
6262
#define MICROPY_PY_MACHINE (1)
6363
#define MICROPY_PY_MACHINE_I2C (1)
64-
#define MICROPY_PY_MACHINE_I2C_MAKE_NEW machine_hard_i2c_make_new
6564
#define MICROPY_PY_MACHINE_PIN_MAKE_NEW mp_pin_make_new
6665
#define MICROPY_MODULE_WEAK_LINKS (1)
6766
#define MICROPY_PY_STRUCT (0)

0 commit comments

Comments
 (0)