@@ -151,13 +151,14 @@ PinsSPI ESP32PinsSD{PinFunction::SD, 14, 2, 15, 13, SPI};
151
151
struct PinsI2C {
152
152
PinsI2C () = default ;
153
153
PinsI2C (PinFunction function, GpioPin scl, GpioPin sda, int port = -1 ,
154
- uint32_t frequency = 100000 , TwoWire &wire = Wire) {
154
+ uint32_t frequency = 100000 , TwoWire &wire = Wire, bool active= true ) {
155
155
this ->function = function;
156
156
this ->scl = scl;
157
157
this ->sda = sda;
158
158
this ->port = port;
159
159
this ->frequency = frequency;
160
160
this ->p_wire = &wire;
161
+ this ->set_active = active;
161
162
}
162
163
163
164
PinFunction function;
@@ -272,8 +273,14 @@ class DriverPins {
272
273
}
273
274
274
275
bool addI2C (PinFunction function, GpioPin scl, GpioPin sda, int port = -1 ,
275
- uint32_t frequency = 100000 , TwoWire &wire = Wire) {
276
- PinsI2C pin (function, scl, sda, port, frequency, wire);
276
+ uint32_t frequency = 100000 , TwoWire &wire = Wire, bool active = true ) {
277
+ PinsI2C pin (function, scl, sda, port, frequency, wire, active);
278
+ return addI2C (pin);
279
+ }
280
+
281
+ // / Just define your initialzed wire object
282
+ bool addI2C (PinFunction function, TwoWire &wire, bool setActive = false ) {
283
+ PinsI2C pin (function, -1 , -1 , -1 , -1 , wire, setActive);
277
284
return addI2C (pin);
278
285
}
279
286
0 commit comments