sparkfun / SparkFun_Qwiic_TMF882X_Arduino_Library

Arduino Library for SparkFun's Qwiic TMF882X breakout boards
https://docs.sparkfun.com/SparkFun_Qwiic_TMF882X_Arduino_Library/
Other
9 stars 3 forks source link

Clash with ISM330DHCX Library (class QwI2C) #3

Closed PaulZC closed 2 years ago

PaulZC commented 2 years ago

The ISM330DHCX library also uses the QwI2C class. I'm seeing "multiple definition" errors on init, ping etc. when I try to include both libraries in a single project.

This library:

https://github.com/sparkfun/SparkFun_Qwiic_TMF882X_Arduino_Library/blob/31b27a7aebc23b79890b95642941b226371808a4/src/qwiic_i2c.h#L58

The ISM330 library:

https://github.com/sparkfun/SparkFun_6DoF_ISM330DHCX_Arduino_Library/blob/9cd720da935f2c9fc2c1ab1b4bc4d653a13d4b35/src/sfe_bus.h#L70

ghost commented 2 years ago

Maybe move this to use a namespace around the driver. Easy enough to do.

I use one here: https://github.com/sparkfun/SparkFun_Spark/blob/main/src/Spark/spUtils.h https://github.com/sparkfun/SparkFun_Spark/blob/main/src/Spark/spUtils.cpp

It's basically renaming the class, but in a very "c++" way. :)

I have some time after lunch and will update this library to do this.

ghost commented 2 years ago

Moved the I2C driver object into a namespace.

PaulZC commented 2 years ago

Excellent - thanks!