extmod/machine_i2c: Only use WRITE1 option if transfer supports it.
When MICROPY_PY_MACHINE_I2C_TRANSFER_WRITE1 is enabled the port's hardware I2C transfer functions should support the MP_MACHINE_I2C_FLAG_WRITE1 option, but software I2C will not. So add a flag to the I2C protocol struct so each individual protocol can indicate whether it supports this option or not. Fixes issue #8765. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -188,6 +188,7 @@ mp_obj_t machine_hw_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_
|
||||
}
|
||||
|
||||
STATIC const mp_machine_i2c_p_t machine_hw_i2c_p = {
|
||||
.transfer_supports_write1 = true,
|
||||
.transfer = machine_hw_i2c_transfer,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user