Browse Source

Make I2C pins configurable on ESP32

Thomas Buck 3 years ago
parent
commit
14242852ac
2 changed files with 8 additions and 0 deletions
  1. 3
    0
      include/config_pins.h
  2. 5
    0
      src/Functionality.cpp

+ 3
- 0
include/config_pins.h View File

@@ -69,6 +69,9 @@
69 69
 #define SWITCH_COUNT 2
70 70
 #define SWITCH_PINS 22, 23
71 71
 
72
+#define I2C_SDA_PIN 21
73
+#define I2C_SCL_PIN 22
74
+
72 75
 #endif // FUNCTION_CONTROL
73 76
 
74 77
 #endif // PLATFORM_ESP

+ 5
- 0
src/Functionality.cpp View File

@@ -436,7 +436,12 @@ void control_setup(void) {
436 436
     
437 437
     debug.println("Initializing I2C Master");
438 438
     Wire.setClock(I2C_BUS_SPEED);
439
+    
440
+#if defined(I2C_SDA_PIN) && defined(I2C_SCL_PIN)
441
+    Wire.begin(I2C_SDA_PIN, I2C_SCL_PIN);
442
+#else
439 443
     Wire.begin();
444
+#endif // defined(I2C_SDA_PIN) && defined(I2C_SCL_PIN)
440 445
     
441 446
 #ifdef DEBUG_WAIT_FOR_SERIAL_CONN
442 447
     debug.println("Wait for Serial");

Loading…
Cancel
Save