File tree 2 files changed +5
-6
lines changed
2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -539,7 +539,7 @@ void HAL_I2C_ListenCpltCallback(I2C_HandleTypeDef *hi2c)
539
539
540
540
if ((obj -> i2c_onSlaveReceive != NULL ) &&
541
541
(obj -> slaveMode == SLAVE_MODE_RECEIVE )) {
542
- nbData = I2C_TXRX_BUFFER_SIZE - obj -> handle .XferCount ;
542
+ nbData = I2C_TXRX_BUFFER_SIZE - obj -> handle .XferSize ;
543
543
if (nbData != 0 ) {
544
544
obj -> i2c_onSlaveReceive (obj -> i2cTxRxBuffer , nbData );
545
545
}
Original file line number Diff line number Diff line change @@ -381,13 +381,12 @@ void TwoWire::onReceiveService(uint8_t* inBytes, int numBytes)
381
381
return ;
382
382
}
383
383
384
+ allocateRxBuffer (numBytes);
385
+ // error if no memory block available to allocate the buffer
384
386
if (rxBuffer == nullptr ){
385
- allocateRxBuffer (numBytes);
386
- // error if no memory block available to allocate the buffer
387
- if (rxBuffer == nullptr ){
388
- Error_Handler ();
389
- }
387
+ Error_Handler ();
390
388
}
389
+
391
390
// copy twi rx buffer into local read buffer
392
391
// this enables new reads to happen in parallel
393
392
memcpy (rxBuffer, inBytes, numBytes);
You can’t perform that action at this time.
0 commit comments