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

Refactoring for SoftwareWire and other features ... #14

Open
Humancell opened this issue Feb 11, 2019 · 1 comment
Open

Refactoring for SoftwareWire and other features ... #14

Humancell opened this issue Feb 11, 2019 · 1 comment

Comments

@Humancell
Copy link

I wanted to touch base with you about some refactoring that I"m about to do, and also adding support for SoftwareWire functionality that I need.

Here are some of the changes that I intend to make, and I wanted your input and thoughts in case you might think about accepting a pull request back.

  1. Adding SoftwareWire support: I need to use SoftwareWire to change the pins that I am using for I2C. I found a "nice" way that Sparkfun implemented this in their BME280 library, and I've now implemented it a few times. It adds a few new constructors that allow the Wire or SoftwareWire object to be passed in, along with the I2C address.

  2. Adding a "isPresent()" method to test for the chip being present on the I2C bus at the current I2C address.

  3. Adding a "setI2CAddress()" method to allow the I2C Address to be changed on the fly. Support for multiple chips.

  4. Getting rid of the "#if ARDUINO >= 100" options as it seems that we are well past the time of needing this? It makes the support of hard and soft I2C select logic that much more complex. I could be convinced differently on this, and will see as I get going on the refactoring.

I'll be working on all of this today in the next few hours ... but wanted to get any feedback and ideas from you to make a future pull request cleaner.

@Humancell
Copy link
Author

Just an update on my progress:

  1. I completed the SoftwareWire integration. I've been testing and running it and it seems to be working.

  2. I added the isPresent() method, and it also appears to be working.

  3. I added the setI2CAddress() method and it also appears to be working.

  4. I left all of the "#if ARDUINO >= 100" options ... it wasn't too hard to just leave it there. I have not tested with a version of the environment that old though.

I committed to my repo (https://github.com/Wovyn/Adafruit_ADS1X15) but haven't created a pull request yet ... I wanted to do more testing.

I'm open to any feedback or thoughts. I do know there are a few places the code is not as optimized as I'd like ... yet.

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

No branches or pull requests

1 participant