-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Deprecate init() in favor of setup(), removing inherent i2c configuration: adxl345, am2320, bme280, bmp085, hmc5883l, l3g4200d #1887
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
Conversation
|
Can you apply these changes to #1880 as well (can be done even before we merge it)? |
|
Aha, now I understand why I had to fiddle with the timing on initialization
to make it work...
I always blamed it on the sensor...
Thanks!
I will test...
|
|
Can I help with testing? |
|
Sure, we appreciated your support. Let us know if you need help building your custom firmware from https://github.com/devsaurus/nodemcu-firmware/tree/refactor_i2c_init. |
|
Note to am2320: failed. But is OK. |
am2320 is working. |
|
Thanks a lot for testing! Just noticed that I did port the i2c.setup(0, sda, scl, i2c.SLOW)
am2320.setup()should be equivalent to am2320.init(sda, scl)I start to wonder how the latter could ever have worked. |
|
Also, is OK. I'm really confused. |
|
Everything ready, isn't it? |
|
Kind of, could be merged with certain risk for untested changes in the other modules. |
|
Can we merge? Risk of the untested changes are low. |
I'd support that but I'd like to hear from other collaborators as well. |
Fixes #1845.
devbranch rather than formaster.docs/en/*.Having the I2C configuration included in the modules' init functions is an issue for a shared bus. In worst case it prevents coexistence with other I2C slaves on the same bus:
This PR introduces a
setup()function for each listed module which performs the core hardware initialization and avoids any (re) configuration of the I2C bus. The existinginit()function is kept and tagged as deprecated with planned removal in (one of) the next master drop.I don't have any of the sensors on my desk - my verification is therefore restricted to compilation and basic call tests. Tagged the related originators / maintainers of the modules, please double check the changes on real hardware.