stm32/machine_i2c: Add ability to specify I2C(4) by name.
This commit is contained in:
parent
c33a4cc213
commit
6f7e774d12
|
@ -226,6 +226,10 @@ mp_obj_t machine_hard_i2c_make_new(const mp_obj_type_t *type, size_t n_args, siz
|
||||||
} else if (strcmp(port, MICROPY_HW_I2C3_NAME) == 0) {
|
} else if (strcmp(port, MICROPY_HW_I2C3_NAME) == 0) {
|
||||||
i2c_id = 3;
|
i2c_id = 3;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef MICROPY_HW_I2C4_NAME
|
||||||
|
} else if (strcmp(port, MICROPY_HW_I2C4_NAME) == 0) {
|
||||||
|
i2c_id = 4;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError,
|
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError,
|
||||||
"I2C(%s) doesn't exist", port));
|
"I2C(%s) doesn't exist", port));
|
||||||
|
|
Loading…
Reference in New Issue