Sorry I asked this before with the solution I posted on what was not working?
But again, I did the changes directly using the Pololu version of the library. I have no idea what if anything you have that is different?
Quick look at your stuff:
bool init(I2CDriverWire& wire = Wire, deviceType device = device_auto, sa0State sa0 = sa0_auto);
So what is: I2CDriverWire ?
Is it some class that is defined in some Header file? That is the only usage of it in this header file. So it has no idea what it is?
Your .cpp file has:
Code:
#include <i2c_driver_wire.h>
...
bool LSM6::init(I2CDriverWire& wire, deviceType device, sa0State sa0)
{
Wire = wire;
...
So you include a different Wire library? Why?
If you really need to? You need to include it in your library header file.
Also: Wire = wire;
Will probably never work.
You are trying to assign the Main Wire object to something else? Not sure if that is defined. And if it did work would likely screw up anywhere
else that might try to use the real Wire object.
That is why in the version I did has a member variable: TwoWire *_pwire; // which wire object are we using.
Which I assign in the constructor. If instead you wish to do on the Init same difference:
However, for compatibility with current code, I would have added it at the end of the parameter list, as if there is any existing sketch that does something like:
myls6.init(device_DS33);
you're adding it as the first parameter would break this sketch.
But in either case, if I changed what I did to do on the init.
Then the init like:
bool init(deviceType device = device_auto, sa0State sa0 = sa0_auto, TwoWire &wire=Wire);
Code:
bool LSM6::init(deviceType device, sa0State sa0, TwoWire &wire)
{
// perform auto-detection unless device type and SA0 state were both specified
_pwire = &wire;
...
Note then everywhere in the code that was doing: Wire.xxx(...)
Would be changed to: _pwire->xxx(...)