diff --git a/library.json b/library.json index 9543ae2..24b2522 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "SoftI2CMaster", - "version": "2.1.8", + "version": "2.1.9", "keywords": "i2c", "description": "Software I2C Arduino library", "repository": { diff --git a/library.properties b/library.properties index 8f5c2fb..2b979f1 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=SoftI2CMaster -version=2.1.8 +version=2.1.9 author=Bernhard Nebel, Peter Fleury maintainer=Bernhard Nebel sentence=I2C lib that supports bit banging and hardware support diff --git a/src/SoftWire.h b/src/SoftWire.h index bdf244b..5f42b2b 100644 --- a/src/SoftWire.h +++ b/src/SoftWire.h @@ -159,6 +159,7 @@ extern SoftWire Wire; uint8_t SoftWire::requestFrom(uint8_t address, uint8_t quantity, uint32_t iaddress, uint8_t isize, uint8_t sendStop) { + error = 0; uint8_t localerror = 0; if (isize > 0) { // send internal address; this mode allows sending a repeated start to access @@ -191,12 +192,12 @@ extern SoftWire Wire; } // set rx buffer iterator vars rxBufferIndex = 0; - rxBufferLength = quantity; + rxBufferLength = error ? 0 : quantity; if (sendStop) { transmitting = 0; i2c_stop(); } - return quantity; + return rxBufferLength; } uint8_t SoftWire::requestFrom(uint8_t address, uint8_t quantity, uint8_t sendStop) {