diff --git a/src/rp2_common/hardware_i2c/i2c.c b/src/rp2_common/hardware_i2c/i2c.c index c5cdbec3a..211ead295 100644 --- a/src/rp2_common/hardware_i2c/i2c.c +++ b/src/rp2_common/hardware_i2c/i2c.c @@ -235,6 +235,7 @@ static int i2c_write_blocking_internal(i2c_inst_t *i2c, uint8_t addr, const uint // nostop means we are now at the end of a *message* but not the end of a *transfer* i2c->restart_on_next = nostop; + i2c->last_abort_reason = abort_reason; return rval; } @@ -315,6 +316,7 @@ static int i2c_read_blocking_internal(i2c_inst_t *i2c, uint8_t addr, uint8_t *ds } i2c->restart_on_next = nostop; + i2c->last_abort_reason = abort_reason; return rval; } diff --git a/src/rp2_common/hardware_i2c/include/hardware/i2c.h b/src/rp2_common/hardware_i2c/include/hardware/i2c.h index 33454f02a..58caa8292 100644 --- a/src/rp2_common/hardware_i2c/include/hardware/i2c.h +++ b/src/rp2_common/hardware_i2c/include/hardware/i2c.h @@ -135,6 +135,7 @@ void i2c_set_slave_mode(i2c_inst_t *i2c, bool slave, uint8_t addr); struct i2c_inst { i2c_hw_t *hw; bool restart_on_next; + uint32_t last_abort_reason; }; /*! \brief Convert I2C instance to hardware instance number