sparkfun / Arduino_Boards

Board definitions for SparkFun-manufactured AVR, ARM, and ESP-based Arduino boards.
270 stars 125 forks source link

Wire.requestFrom() should not be followed by Wire.endTransmission() in Qduino.cpp #50

Closed Koepel closed 5 years ago

Koepel commented 5 years ago

In the files:

in the function "readFrom()", the Wire.requestFrom() is followed by a Wire.endTransmission(). That Wire.endTransmission() may be removed. It is at the moment at line 284 (for both files). Explanation: Common-mistakes#2

loricrotser commented 5 years ago

Reviewed and committed. If you get a chance to double check, it'd be appreciated. Thank you!

Koepel commented 5 years ago

It is okay.

When the sensor is not connected, the readFrom() does not fill the lsb and msb parameters. Thus those values will keep their default value which is set to zero before calling readFrom(). That is a good way to deal with a sensor that might not be connected.