Skip to content

Commit c1e9004

Browse files
committed
bus type method
1 parent a81aefa commit c1e9004

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

src/sfeTk/sfeTkIBus.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ class sfeTkIBus
230230
*
231231
*/
232232
virtual sfeTkError_t readRegister16Region16(uint16_t reg, uint16_t *data, size_t numBytes, size_t &readBytes) = 0;
233+
234+
virtual uint8_t type(void)
235+
{
236+
return 0;
237+
}
233238
};
234239

235240
//};

src/sfeTk/sfeTkII2C.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3434
* The I2C bus interface extends the IBus interface and adds the ability to set and get the I2C
3535
* address and stop flag.
3636
*/
37+
const uint8_t kBusTypeI2C = 0x01;
38+
3739
class sfeTkII2C : public sfeTkIBus
3840
{
3941
public:
@@ -109,6 +111,11 @@ class sfeTkII2C : public sfeTkIBus
109111
*/
110112
static constexpr uint8_t kNoAddress = 0;
111113

114+
virtual uint8_t type(void)
115+
{
116+
return kBusTypeI2C;
117+
}
118+
112119
private:
113120
uint8_t _address;
114121
bool _stop;

src/sfeTk/sfeTkISPI.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3434
*
3535
* The SPI bus interface extends the IBus interface and adds the ability to set and get the CS pin.
3636
*/
37+
38+
const uint8_t kBusTypeSPI = 0x02;
3739
class sfeTkISPI : public sfeTkIBus
3840
{
3941
public:
@@ -82,6 +84,11 @@ class sfeTkISPI : public sfeTkIBus
8284
*/
8385
static constexpr uint8_t kNoCSPin = 0;
8486

87+
virtual uint8_t type(void)
88+
{
89+
return kBusTypeSPI;
90+
}
91+
8592
private:
8693
/** The internal storage of the _cs value*/
8794
uint8_t _cs;

0 commit comments

Comments
 (0)