Make I2C_SlaveTransferHandleIRQ() call handle->callback() upon every kI2C_SlaveReceiveEvent and pass the received byte as handle->userData. Given the variable-length protocol design of the UHK, this allows for vastly supreme robustness.

This commit is contained in:
László Monda
2017-10-09 04:13:50 +02:00
parent ac55fc28ee
commit 49e20a5798

View File

@@ -1518,8 +1518,11 @@ void I2C_SlaveTransferHandleIRQ(I2C_Type *base, void *i2cHandle)
}
else
{
/* Slave receive, master writing to slave. */
uint8_t data = *(uint8_t*)handle->userData = base->D;
/* If we're out of data, invoke callback to get more. */
if ((!xfer->data) || (!xfer->dataSize))
if (true || (!xfer->data) || (!xfer->dataSize))
{
xfer->event = kI2C_SlaveReceiveEvent;
@@ -1532,9 +1535,6 @@ void I2C_SlaveTransferHandleIRQ(I2C_Type *base, void *i2cHandle)
xfer->transferredCount = 0;
}
/* Slave receive, master writing to slave. */
uint8_t data = base->D;
if (handle->transfer.dataSize)
{
/* Receive data. */