Atlas-Scientific / Ezo_I2c_lib

Library for using Atlas Scientific EZO devices in I2C mode
MIT License
65 stars 39 forks source link

Allow providing custom I2C bus #20

Open gaaf opened 1 year ago

gaaf commented 1 year ago

Hi,

I need to use an other I2C bus than the default, but the library is hardcoded to use Wire(). Please provide a constructor or method to set the I2C bus (TwoWire object) to use.

Something like this: https://github.com/RobTillaart/PCF8575/blob/701bdbe40d7204a3a263a0b2fb99cf06802c9291/PCF8575.h#L31

moritz89 commented 1 year ago

I created a fork for this reason :sweat_smile:

Might be of help...

gaaf commented 1 year ago

Thanks. I already adapted it myself. It looks eeringly similar though...

Atlas-Scientific commented 1 year ago

If you already wrote it and it's simple, can you just do a pull request with the changes? Or are there some issues with your implementation?

moritz89 commented 1 year ago

Created an MR here: #21

Atlas-Scientific commented 1 year ago

Alright I added it with some tweaks, feel free to test it and let me know if it works for you

moritz89 commented 1 year ago

I'm not using the sensors ATM, but it should work. I had tested the code on my fork, but a confirmation would be great!

Atlas-Scientific commented 1 year ago

I tested it with hardware to some extent so that's fine, I just mean if you or anyone else needs other things in this API