Hi, I have not tested your SWire library yet, but I noticed a few things.
The Wire.available() should return the number of valid bytes in the rxBuffer.
Writing a 16-bit value is not according to the Arduino Wire library. Please don't add that. It is very confusing and might result into different functionality between the Arduino Wire library and your SWire library. I will guaranteed cause a lot of trouble.
You mix HIGH and LOW with 1 and 0. They are the same, but from a programmers viewpoint they are different things. Perhaps you can make it more obvious what is used in the code.
The buffer length is only 8 bytes ? The Arduino Wire library for AVR chips has 32 bytes.
Is it possible to do a Wire.beginTransmission() followed by a Wire.endTransmission() to test the ACK of a sensor ? That is used in i2c scanner sketches. I did not test it, and I can not tell from the source if that will work.
What about making it more compatible ? Perhaps a (dummy) setClock(), a peek(), a end() and a flush(), en perhaps some functions from the Stream class.
Hi, I have not tested your SWire library yet, but I noticed a few things.
The Wire.available() should return the number of valid bytes in the rxBuffer.
Writing a 16-bit value is not according to the Arduino Wire library. Please don't add that. It is very confusing and might result into different functionality between the Arduino Wire library and your SWire library. I will guaranteed cause a lot of trouble.
You mix HIGH and LOW with 1 and 0. They are the same, but from a programmers viewpoint they are different things. Perhaps you can make it more obvious what is used in the code.
The buffer length is only 8 bytes ? The Arduino Wire library for AVR chips has 32 bytes.
Is it possible to do a Wire.beginTransmission() followed by a Wire.endTransmission() to test the ACK of a sensor ? That is used in i2c scanner sketches. I did not test it, and I can not tell from the source if that will work.
What about making it more compatible ? Perhaps a (dummy) setClock(), a peek(), a end() and a flush(), en perhaps some functions from the Stream class.