Skip to content

Commit 65335d8

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 169f42d commit 65335d8

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
@@ -980,6 +980,11 @@ void i2c_attachSlaveTxEvent(i2c_t *obj, void (*function)(i2c_t *))
980980
void HAL_I2C_AddrCallback(I2C_HandleTypeDef *hi2c, uint8_t TransferDirection, uint16_t AddrMatchCode)
981981
{
982982
i2c_t *obj = get_i2c_obj(hi2c);
983+
if ((obj->slaveMode == SLAVE_MODE_RECEIVE) && (obj->slaveRxNbData != 0)) {
984+
obj->i2c_onSlaveReceive(obj);
985+
obj->slaveMode = SLAVE_MODE_LISTEN;
986+
obj->slaveRxNbData = 0;
987+
}
983988

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

0 commit comments

Comments
 (0)