Work with asm2320 on already initialized I²C bus with another slave devices.
I want to connect asm2320 and I²C display over one bus
Just comment i2c setup in asm2320.c
Agreed, the inherent i2c setup potentially conflicts with multiple slaves on the bus.
I also agree, but keep in mind that to keep consistency, all other i2c slaves (ADXL345, BME280, etc.) also need similar modifications.
I think, we need to split setup function into two: new begin, that initializes sensor on exiting bus and old setup, that setups new I²C bus and just runs begin (only for compatibility).
As @FrankX0 pointed out, a grep for platform_i2c_setup lists the following modules. IMO all of them need the same change to remove global I2C bus initialization:
adxl345.init()am2320.init()bme280.init()bmp085.init()hmc5883l.init()l3g4200d.init()Picking up @v1993's proposal, I see a two-step approach.
xyz.init() into I2C bus setup and xyz.setup() for the bare module hardware. Has the same overall behavior as before, but emits a deprecation warning via #1538.xyz.setup() but can keep their scripts untouched for the time being.xyz.init() after next drop.xyz.setup() is the only initialization / setup function remaining.Is this the right way to go?
Sounds good to me!
Let's not forget to modify the new Hdc1080 module from initial implementation.
Most helpful comment
I also agree, but keep in mind that to keep consistency, all other i2c slaves (ADXL345, BME280, etc.) also need similar modifications.