Skip to content

The Wire.requestFrom does not need a Wire.beginTransmission, no Wire.endTransmission and no waiting. #4

@Koepel

Description

@Koepel

In the file MPU6050.cpp the use of Wire.requestFrom can be improved.

The Wire.beginTransmission and Wire.endTransmission are only needed when writing data. They should not be used with Wire.requestFrom and can be removed. In two places there is Wire.beginTransmission, and in three places both the Wire.beginTransmission and Wire.endTransmission with the Wire.requestFrom. They can all be removed.

The Wire.requestFrom is a complete I2C transaction on its own. It stores the received data in a buffer in the Wire library and returns when the I2C transaction completely has finished. It is therefor not needed to wait for something. In four places there is a while-loop after Wire.requestFrom. Those while-loops can be removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions