Skip to content

Commit 7e05830

Browse files
committed
moved qwiic I2C driver into a namespace to prevent symbol conflicts with other libraries that use the same driver implementation/pattern
1 parent 31b27a7 commit 7e05830

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

src/SparkFun_TMF882X_Library.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,5 @@ class SparkFun_TMF882X : public QwDevTMF882X
126126
}
127127

128128
private:
129-
QwI2C _i2cBus;
129+
sfe_TMF882X::QwI2C _i2cBus;
130130
};

src/qwiic_i2c.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868

6969
const static uint16_t kChunkSize = kMaxTransferBuffer - 2;
7070

71+
namespace sfe_TMF882X {
7172
//////////////////////////////////////////////////////////////////////////////////////////////////
7273
// Constructor
7374

@@ -230,4 +231,6 @@ int QwI2C::readRegisterRegion(uint8_t addr, uint8_t reg, uint8_t *data, uint16_t
230231
} // end while
231232

232233
return 0; // Success
234+
}
235+
233236
}

src/qwiic_i2c.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555

5656
#include <Wire.h>
5757

58+
namespace sfe_TMF882X {
59+
60+
5861
class QwI2C {
5962

6063
public:
@@ -75,4 +78,6 @@ class QwI2C {
7578

7679
private:
7780
TwoWire* _i2cPort;
81+
};
82+
7883
};

src/qwiic_tmf882x.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ bool QwDevTMF882X::setSPADConfig(struct tmf882x_mode_app_spad_config &spadConfig
833833
// theBus The communication bus object
834834
// idBus The id/address of the device on the bus
835835

836-
void QwDevTMF882X::setCommunicationBus(QwI2C &theBus, uint8_t idBus)
836+
void QwDevTMF882X::setCommunicationBus(sfe_TMF882X::QwI2C &theBus, uint8_t idBus)
837837
{
838838
_i2cBus = &theBus;
839839
_i2cAddress = idBus;

src/qwiic_tmf882x.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ class QwDevTMF882X
667667
// idBus The bus ID for the target device.
668668
//
669669

670-
void setCommunicationBus(QwI2C &theBus, uint8_t idBus);
670+
void setCommunicationBus(sfe_TMF882X::QwI2C &theBus, uint8_t idBus);
671671

672672
private:
673673
// The internal method to initialize the device
@@ -694,7 +694,7 @@ class QwDevTMF882X
694694
TMF882XMessageHandler _messageHandlerCB;
695695

696696
// I2C things
697-
QwI2C *_i2cBus; // pointer to our i2c bus object
697+
sfe_TMF882X::QwI2C *_i2cBus; // pointer to our i2c bus object
698698
uint8_t _i2cAddress; // address of the device
699699

700700
// Structure/state for the underlying TOF SDK

0 commit comments

Comments
 (0)