summaryrefslogtreecommitdiff
path: root/ports/stm32/machine_i2c.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2020-09-25 14:47:34 +1000
committerDamien George <damien@micropython.org>2020-10-01 12:57:10 +1000
commit71f3ade770fa7f2637d94f5ba5840b64a16a95db (patch)
tree4781c54bcfb9238d7e2fb5035ecc44ae9572a173 /ports/stm32/machine_i2c.c
parent39d50d129ce428858332523548f0594503d0f45b (diff)
ports: Support legacy soft I2C/SPI construction via id=-1 arg.
With a warning that this way of constructing software I2C/SPI is deprecated. The check and warning will be removed in a future release. This should help existing code to migrate to the new SoftI2C/SoftSPI types. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'ports/stm32/machine_i2c.c')
-rw-r--r--ports/stm32/machine_i2c.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ports/stm32/machine_i2c.c b/ports/stm32/machine_i2c.c
index 31defcb17..e0c408c6d 100644
--- a/ports/stm32/machine_i2c.c
+++ b/ports/stm32/machine_i2c.c
@@ -193,6 +193,8 @@ STATIC void machine_hard_i2c_init(machine_hard_i2c_obj_t *self, uint32_t freq, u
#endif
mp_obj_t machine_hard_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
+ MP_MACHINE_I2C_CHECK_FOR_LEGACY_SOFTI2C_CONSTRUCTION(n_args, n_kw, all_args);
+
// parse args
enum { ARG_id, ARG_scl, ARG_sda, ARG_freq, ARG_timeout, ARG_timingr };
static const mp_arg_t allowed_args[] = {