Closed bperrybap closed 6 years ago
Not really. It is better and nicer if it is an unsigned long, but it does not need to be unsigned long.
The substraction with millis() en previousMillis has to be with done with unsigned long. But the resulting compare can be done to a long or a integer as well. The 'long' means that the timeout for the Slave stretching the clock pulse is 25 days instead of 50 days. Since a normal number would be 100ms, I don't worry about it. The goal is to be compatible with the Arduino libraries, and they have a 'long' : https://www.arduino.cc/en/Serial/setTimeout , https://www.arduino.cc/en/Reference/StreamSetTimeout
If you don't mind, I keep the 'long' for now.
The overall goal is to eliminate the warning created by comparing signed vs unsigned values in the SoftwareWire.cpp code. You can do that by either
I like that. I have applied two small fixes. The internal _timeout is now unsigned long, but the parameter timeout is still 'long', and a cast is added when copying to the internal _timeout. Thank you.
The _timeout variable needs to be unsigned long rather than long which is signed.