Closed specialcircumstances closed 4 years ago
hiya - thanks for the PR. we wont merge as is, we only permit passing in an i2c Wire object - that's the standard procedure :) your board support package will have to allow creating Wire and then passing in the reference
hiya - thanks for the PR. we wont merge as is, we only permit passing in an i2c Wire object - that's the standard procedure :) your board support package will have to allow creating Wire and then passing in the reference
Ah - that's what I tried first - BUT - because your library calls the "begin" on the wire again, it overrides any SCL and SDA set on the original wire reverting to the compiler defaults. e.g. if I create a wire and Wire.begin(SCL, SDA) then pass that &Wire to your lib, init calls Wire.begin() which loses the SDA and SCL and reverts to default. I tested this Wire behaviour.
e.g. in Wire
void TwoWire::begin(void){ begin(default_sda_pin, default_scl_pin); }
please tell the BSP supporters to add a function called, like, setPins()
to Wire, because the official arduino Wire lirbary does not allow what they have added
A couple of additional overloads to the bme.begin function to allow specification of SDA and SCL pins. I needed this for the library to work on my Digistump Oaks (ESP8266) with a Pimoroni BME280
Scope of change Fairly simple really, so should be pretty safe (I fink...) added properties _scl and _sda to .h file. In .cpp file these should default to compiler definitions for the pins (which are already required for the library to compile) added two new overloads to the BME begin function, to allow specification of SCL and SDA pins. added _scl and _sda configuration to all I2C begin overloads updated I2C begin method in init to specify SCL and SDA pins.
Describe any known limitations with your change. Limited testing across platforms, but it should be pretty safe I think. I used this on a Digistump Oak (ESP 8266 based) with the Arduino ESP libs (in native ESP mode, not the lapsed Oak-Particle integration).
Please run any tests or examples that can exercise your modified code. Tests of the various I2C begins appear to work OK, but would recommend some alternative platform checks to be on the safe side.