Skip to content

Commit b6f6e07

Browse files
committed
Adds namespace to differentiate bus drivers from other libraries
using the same implementation * Rolls version for release
1 parent 9cd720d commit b6f6e07

File tree

6 files changed

+14
-8
lines changed

6 files changed

+14
-8
lines changed

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SparkFun 6DoF ISM330DHCX
2-
version=1.0.3
2+
version=1.0.4
33
author=SparkFun Electronics <[email protected]>
44
maintainer=SparkFun Electronics <sparkfun.com>
55
sentence=This library is for the SparkFun Qwiic and Qwiic Micro, 6DoF ISM330DHCX breakout board.

src/SparkFun_ISM330DHCX.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class SparkFun_ISM330DHCX : public QwDevISM330DHCX
6060
private:
6161

6262
//I2C bus class
63-
QwI2C _i2cBus;
63+
sfe_ISM330DHCX::QwI2C _i2cBus;
6464

6565
};
6666

@@ -121,6 +121,6 @@ class SparkFun_ISM330DHCX_SPI : public QwDevISM330DHCX
121121
private:
122122

123123
// SPI bus class
124-
SfeSPI _spiBus;
124+
sfe_ISM330DHCX::SfeSPI _spiBus;
125125

126126
};

src/sfe_bus.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const static uint16_t kChunkSize = kMaxTransferBuffer;
5656
// Constructor
5757
//
5858

59+
namespace sfe_ISM330DHCX {
5960

6061
QwI2C::QwI2C(void) : _i2cPort{nullptr}
6162
{
@@ -361,3 +362,5 @@ int SfeSPI::readRegisterRegion(uint8_t addr, uint8_t reg, uint8_t *data, uint16_
361362
return 0;
362363

363364
}
365+
366+
}

src/sfe_bus.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@
4646
#pragma once
4747

4848

49+
4950
#include <Wire.h>
5051
#include <SPI.h>
5152

53+
namespace sfe_ISM330DHCX {
5254

5355
// The following abstract class is used an interface for upstream implementation.
5456
class QwIDeviceBus
@@ -120,3 +122,4 @@ class SfeSPI : public QwIDeviceBus
120122
uint8_t _cs;
121123
};
122124

125+
};

src/sfe_ism330dhcx.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ bool QwDevISM330DHCX::isConnected()
5555
// theBus The communication bus object
5656
// i2cAddress I2C address for the 6DoF
5757

58-
void QwDevISM330DHCX::setCommunicationBus(QwIDeviceBus &theBus, uint8_t i2cAddress)
58+
void QwDevISM330DHCX::setCommunicationBus(sfe_ISM330DHCX::QwIDeviceBus &theBus, uint8_t i2cAddress)
5959
{
6060
_sfeBus = &theBus;
6161
_i2cAddress = i2cAddress;
@@ -71,7 +71,7 @@ void QwDevISM330DHCX::setCommunicationBus(QwIDeviceBus &theBus, uint8_t i2cAddre
7171
// theBus The communication bus object
7272
//
7373

74-
void QwDevISM330DHCX::setCommunicationBus(QwIDeviceBus &theBus)
74+
void QwDevISM330DHCX::setCommunicationBus(sfe_ISM330DHCX::QwIDeviceBus &theBus)
7575
{
7676
_sfeBus = &theBus;
7777
}

src/sfe_ism330dhcx.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ class QwDevISM330DHCX
8080
// idBus The bus ID for the target device.
8181
//
8282

83-
void setCommunicationBus(QwIDeviceBus &theBus, uint8_t i2cAddress);
84-
void setCommunicationBus(QwIDeviceBus &theBus);
83+
void setCommunicationBus(sfe_ISM330DHCX::QwIDeviceBus &theBus, uint8_t i2cAddress);
84+
void setCommunicationBus(sfe_ISM330DHCX::QwIDeviceBus &theBus);
8585

8686
bool setAccelFullScale(uint8_t val);
8787
bool setGyroFullScale(uint8_t val);
@@ -170,7 +170,7 @@ class QwDevISM330DHCX
170170
private:
171171

172172

173-
QwIDeviceBus *_sfeBus;
173+
sfe_ISM330DHCX::QwIDeviceBus *_sfeBus;
174174
uint8_t _i2cAddress;
175175
uint8_t _cs;
176176
stmdev_ctx_t sfe_dev;

0 commit comments

Comments
 (0)