adafruit / Adafruit_STMPE610

Arduino library for STMPE610/811 resistive touch screen controllers
MIT License
38 stars 32 forks source link

Wire.endTransmission after Wire.requestFrom is not needed. #4

Closed Koepel closed 5 years ago

Koepel commented 9 years ago

In the file "Adafruit_STMPE610.cpp", the Wire.requestFrom() should not be followed by Wire.endTransmission(). The Wire.requestFrom() is a complete I2C transmission on its own. The Wire.endTransmission() is only used after a Wire.write() when data in the buffer needs to be transmitted.

There is an other call to Wire.requestFrom() which is encapsulated by both Wire.beginTransmission() and Wire.endTransmission(). Those should both be removed, Wire.requestFrom() stands on its own.

Explanation: Common-mistakes, number 2 and 3. See also my alternative explanation of the functions of the Wire library.

hoffmannjan commented 5 years ago

Thanks @Koepel 👍 , this is now in PR#15 and is waiting to be merged!