diff options
| author | Chris Liechti | 2019-09-19 21:30:24 +0200 |
|---|---|---|
| committer | Damien George | 2019-09-23 15:08:24 +1000 |
| commit | 6f7e774d12a1725e05ed8644ebe1712663d93a82 (patch) | |
| tree | 5b362b943c68e63c9608871c9378623f5c7d68d5 /ports | |
| parent | c33a4cc21363b11f70c673fa3547aad6f9c1a705 (diff) | |
stm32/machine_i2c: Add ability to specify I2C(4) by name.
Diffstat (limited to 'ports')
| -rw-r--r-- | ports/stm32/machine_i2c.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ports/stm32/machine_i2c.c b/ports/stm32/machine_i2c.c index b423ec1c8..5c7474559 100644 --- a/ports/stm32/machine_i2c.c +++ b/ports/stm32/machine_i2c.c @@ -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) { i2c_id = 3; #endif + #ifdef MICROPY_HW_I2C4_NAME + } else if (strcmp(port, MICROPY_HW_I2C4_NAME) == 0) { + i2c_id = 4; + #endif } else { nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "I2C(%s) doesn't exist", port)); |
