@@ -54,9 +54,9 @@ uint8_t err =Wire.endTransmission(false); // don't send a STOP, just Pause I2C o
5454if(err==7){ // Prior Operation has been queued, it is NOT guaranteed that it will
5555// successfully occur!
5656 err=Wire.requestFrom(addr,len);
57- if(err!=len ){ // complete/partial read failure
58- Serial.print ("Bad Stuff!! Read Failed lastError=");
59- Serial.print( Wire.lastError(),DEC );
57+ if(Wire.lastError()!=0 ){ // complete/partial read failure
58+ Serial.printf ("Bad Stuff!!\nRead of (%d) bytes read %d bytes\nFailed lastError=%d,"
59+ " text=%s\n",len,err,Wire.lastError(), Wire.getErrorText(Wire. lastError()) );
6060 }
6161 // some of the read may have executed
6262 while(Wire.avaiable()){
@@ -70,13 +70,8 @@ Additionally I have expanded the ability of `Wire()` to handle larger Reads and
7070
7171I have create a few new methods for Wire:
7272``` c++
73- uint8_t oldEndTransmission (uint8_t); //released implementation
74- size_t oldRequestFrom(uint8_t address, size_t size, bool sendStop); //released implementation
75- //@stickBreaker for big blocks and ISR model
7673 uint8_t writeTransaction (uint8_t address, uint8_t* buff, size_t size, bool sendStop);// big block handling
77- size_t requestFrom(uint8_t address, size_t size, bool sendStop);
7874 size_t requestFrom(uint8_t address, uint8_t* buf, size_t size, bool sendStop);
79- size_t polledRequestFrom(uint8_t address, uint8_t* buf, size_t size, bool sendStop);//a BigBlock test case Not USING ISR
8075 size_t transact(size_t readLen); // replacement for endTransmission(false),requestFrom(ID,readLen,true);
8176 size_t transact(uint8_t* readBuff, size_t readLen);// bigger Block read
8277 i2c_err_t lastError(); // Expose complete error
@@ -91,10 +86,9 @@ Wire.beginTransmission(ID);
9186Wire.write(highByte(addr));
9287Wire.write(lowByte(addr));
9388
94- uint8_t err=Wire.transact(len);
95- if(err!=len){ // complete/partial read failure
96- Serial.print("Bad Stuff!! Read Failed lastError=");
97- Serial.print(Wire.lastError(),DEC);
89+ uint8_t err=Wire.transact(len); // transact() does both Wire.endTransmission(false); and Wire.requestFrom(ID,len,true);
90+ if(Wire.lastError != 0){ // complete/partial read failure
91+ Serial.printf("Bad Stuff!! Read Failed lastError=%d\n",Wire.lastError());
9892 }
9993 // some of the read may have executed
10094while(Wire.avaiable()){
@@ -110,5 +104,4 @@ Set the "core debug level" to 'error'
110104There is MINIMAL to NO ERROR detection, BUS, BUSY. because I have not encounter any of them!
111105
112106
113-
114107Chuck.
0 commit comments