Skip to content

Commit 835387e

Browse files
committed
Fix I2C slave issue: return correct size
Fix stm32duino#212 Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 86e0bbc commit 835387e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: cores/arduino/stm32/twi.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ void HAL_I2C_ListenCpltCallback(I2C_HandleTypeDef *hi2c)
539539

540540
if((obj->i2c_onSlaveReceive != NULL) &&
541541
(obj->slaveMode == SLAVE_MODE_RECEIVE)) {
542-
nbData = I2C_TXRX_BUFFER_SIZE - obj->handle.XferCount;
542+
nbData = I2C_TXRX_BUFFER_SIZE - obj->handle.XferSize;
543543
if(nbData != 0) {
544544
obj->i2c_onSlaveReceive(obj->i2cTxRxBuffer, nbData);
545545
}

0 commit comments

Comments
 (0)