File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -77,8 +77,13 @@ class SparkFun_TMF882X : public QwDevTMF882X {
7777 // wirePort optional. The Wire port. If not provided, the default port is used
7878 // address optional. I2C Address. If not provided, the default address is used.
7979 // retval true on success, false on startup failure
80+ //
81+ // Two versions - the methods is overridden
82+ //
83+ // Version 1:
84+ // User passes in an aready setup wirePort
8085
81- bool begin (TwoWire& wirePort = Wire , uint8_t deviceAddress = kDefaultTMF882XAddress )
86+ bool begin (TwoWire& wirePort, uint8_t deviceAddress = kDefaultTMF882XAddress )
8287 {
8388 // Setup I2C object and pass into the superclass
8489 _i2cBus.init (wirePort);
@@ -88,6 +93,18 @@ class SparkFun_TMF882X : public QwDevTMF882X {
8893 return this ->QwDevTMF882X ::init ();
8994 };
9095
96+ // /////////////////////////////////////////////////////////////////////
97+ // begin()
98+ //
99+ // Version 2:
100+ //
101+ // User doesn't provide a wireport
102+ bool begin (uint8_t deviceAddress = kDefaultTMF882XAddress ){
103+
104+ _i2cBus.init ();
105+ setCommunicationBus (_i2cBus, deviceAddress);
106+ return this ->QwDevTMF882X ::init ();
107+ }
91108 // /////////////////////////////////////////////////////////////////////
92109 // setOutputDevice()
93110 //
You can’t perform that action at this time.
0 commit comments