Skip to content

Commit 3624374

Browse files
author
Daniel Liebler
committed
[Wire] fix onReceiveEvent() not being triggered when a repeated start/no stop condition is sent in slave mode
1 parent 96e4e8c commit 3624374

File tree

1 file changed

+5
-0
lines changed
  • libraries/Wire/src/utility

1 file changed

+5
-0
lines changed

libraries/Wire/src/utility/twi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,11 @@ void i2c_attachSlaveTxEvent(i2c_t *obj, void (*function)(i2c_t *))
981981
void HAL_I2C_AddrCallback(I2C_HandleTypeDef *hi2c, uint8_t TransferDirection, uint16_t AddrMatchCode)
982982
{
983983
i2c_t *obj = get_i2c_obj(hi2c);
984+
if ((obj->slaveMode == SLAVE_MODE_RECEIVE) && (obj->slaveRxNbData != 0)) {
985+
obj->i2c_onSlaveReceive(obj);
986+
obj->slaveMode = SLAVE_MODE_LISTEN;
987+
obj->slaveRxNbData = 0;
988+
}
984989

985990
if (AddrMatchCode == hi2c->Init.OwnAddress1) {
986991
if (TransferDirection == I2C_DIRECTION_RECEIVE) {

0 commit comments

Comments
 (0)