arduino / arduino/ArduinoCore-avr

Wire.begin() enables pullups in libraries/Wire/utility/twi.c

Open
#437 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.5k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Using Wire.begin() causes the internal pullups to be enabled in [twi.c](https://github.com/arduino/ArduinoCore-avr/blob/6507dfef3ed9af8e83acd5f02496b0ac872f3cfd/libraries/Wire/src/utility/twi.c#L88-L89).

Pullups that are 5V on a genuine Arduino.

A surprise for me when I used an Arduino Uno on a 3.3V bus.
It luckily did not cause any apparent issues but i still believe that fact should be made more obvious.
Additionally I find it reasonable to add the option to keep those disabled.

I hence propose to move that functionality from utility/twi.c into Wire.c and to additionally
implement a method that can keep those disabled.
How about Wire.disablePullups()?

I don't think that it's generally advisable to just outright remove or disable the Pullups by default.
There likely are projects that rely on them being enabled.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with libraries/Wire/src/utility/twi.c at the linked lines and inspect the Wire.c implementation mentioned in the proposal. Determine how Wire.begin() currently enables the pullups and define the API behavior for preserving the default while allowing them to remain disabled. Done means the requested opt-out is implemented without changing existing default behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.