Skip to content

Commit

Permalink
Add last_abort_reason
Browse files Browse the repository at this point in the history
Fixes #1049
  • Loading branch information
peterharperuk committed May 11, 2023
1 parent 62201a8 commit 30f37a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/rp2_common/hardware_i2c/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions src/rp2_common/hardware_i2c/include/hardware/i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 30f37a6

Please sign in to comment.