Skip to content
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

Allow I2C pins to be configurable #5

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

Conversation

eb3nezer
Copy link

This change allows the pins to be used for I2C to be configured. When using a real Arduino you don't want to do this, but if using the CAP1188 with something like an ESP8266 it is useful to be able to configure the pins.

As the constructor is already overloaded, I added a method setI2CPins(int i2cclock, int i2cdata). If you don't call this method, then it uses the default for Wire (SCL and SDA). If you do call this method, then it uses the pins you specified when configuring Wire.

@eb3nezer
Copy link
Author

Any thoughts on this PR? This change lets you connect a CAP1188 board to pins other than SCL and SDA on MCUs that support this. Existing projects for Arduino are unaffected of course.

@ladyada
Copy link
Member

ladyada commented Oct 14, 2018

hiya, didn't see this before!
only ESP8266 does it this way - so other boards don't benefit. instead - it would be way better if you just passed in the Wire device you want, after you've created it. see this library for example:
https://github.com/adafruit/Adafruit_LIS3DH/blob/master/Adafruit_LIS3DH.cpp#L35

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.

2 participants