diff options
| author | Damien George <damien@micropython.org> | 2022-06-17 11:57:57 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-06-17 11:57:57 +1000 |
| commit | 5233fb3a3d3245bd4c5dfb781e3fcbc8a3fbfd6a (patch) | |
| tree | d688042af2db862d0cf9b11256f5d051208adecf /extmod/machine_i2c.h | |
| parent | d7919ea71e7b7cc203ca984cc2f4a55019634835 (diff) | |
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>
Diffstat (limited to 'extmod/machine_i2c.h')
| -rw-r--r-- | extmod/machine_i2c.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/extmod/machine_i2c.h b/extmod/machine_i2c.h index a211aef52..a3363d4c3 100644 --- a/extmod/machine_i2c.h +++ b/extmod/machine_i2c.h @@ -61,6 +61,9 @@ typedef struct _mp_machine_i2c_buf_t { // - transfer must be non-NULL // - transfer_single only needs to be set if transfer=mp_machine_i2c_transfer_adaptor typedef struct _mp_machine_i2c_p_t { + #if MICROPY_PY_MACHINE_I2C_TRANSFER_WRITE1 + bool transfer_supports_write1; + #endif void (*init)(mp_obj_base_t *obj, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args); int (*start)(mp_obj_base_t *obj); int (*stop)(mp_obj_base_t *obj); |
