8000 Fix params passed to i2c.init() to include DEVICE_ADDRESS in the firs… · heepdog/esp32-snippets@f8d3438 · GitHub
[go: up one dir, main page]

Skip to content

Commit f8d3438

Browse files
committed
Fix params passed to i2c.init() to include DEVICE_ADDRESS in the first position. Otherwise SDA becomes SCL_PIN and SCL becomes Default.
1 parent 297db2c commit f8d3438

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cpp_utils/tests/task_i2c_scanner.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "sdkconfig.h"
88

9+
#define DEVICE_ADDRESS 0
910
#define SDA_PIN 25
1011
#define SCL_PIN 26< 6D1B /span>
1112

@@ -14,7 +15,7 @@
1415
class I2CScanner: public Task {
1516
void run(void *data) override {
1617
I2C i2c;
17-
i2c.init((gpio_num_t)SDA_PIN, (gpio_num_t)SCL_PIN);
18+
i2c.init((uint8_t)DEVICE_ADDRESS, (gpio_num_t)SDA_PIN, (gpio_num_t)SCL_PIN);
1819
i2c.scan();
1920
} // End run
2021
};

0 commit comments

Comments
 (0)
0