Skip to content

Fix I2C initialization #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix I2C initialization #2

wants to merge 1 commit into from

Conversation

Sl-Alex
Copy link

@Sl-Alex Sl-Alex commented Jun 21, 2022

There are two prototypes for Wire.begin():

   bool begin(int sda=-1, int scl=-1, uint32_t frequency=0); // returns true, if successful init of i2c bus
   bool begin(uint8_t slaveAddr, int sda=-1, int scl=-1, uint32_t frequency=0);

The problem is that if we call Wire.begin(m_sda, m_scl) then the second (I2C slave) constructor is called (at least this was my case).
If we set pins expicitly and then call Wire.begin() without parameters then there is no ambiguity, the first constructor will be called.

@geraballz
Copy link

geraballz commented Aug 21, 2022

This commit works very well

@domdfcoding
Copy link

I wish I'd seen this half an hour ago before going down the rabbit hole of figuring out why the touchscreen doesn't work. 🤦‍

@ltruelove
Copy link

This also fixed my issue with not registering touches and constant warnings from the Wire library in the serial monitor.

@iBobik
Copy link

iBobik commented Oct 27, 2024

Touches in the 3D cube demo works, but in the lvgl demo taps to the buttons do nothing.

I enabled TOUCHSCREEN_DEBUG and I see touches logged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants