Skip to content

Make I²C initialisation (Wire.begin()) not slow #1449

@matthijskooijman

Description

@matthijskooijman

I'm running the Wire library on a G030 and noticed that initialization is super slow (Wire.begin() takes 800ms).

Digging into the code, I found i2c_computeTiming() that contains 5 (!) nested forloops and essentially seems to just bruteforce all possible timing combinations or something like that.

Note that I tested on an older version of the Wire library, but looking at the history of that file, I do not think this was fixed in the meanwhile.

Describe the solution you'd like

It seems like it should be possible to be smarter and also a lot faster about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions