1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 06:33:51 +00:00

[i2c] Use `i2c_master_probe` to scan i2c bus (#9831)

This commit is contained in:
Jesse Hills
2025-07-23 23:31:13 +12:00
committed by GitHub
parent bb6f8aeb94
commit babaa1db3f
4 changed files with 18 additions and 6 deletions

View File

@@ -2,9 +2,9 @@
#ifdef USE_ESP_IDF
#include "esp_idf_version.h"
#include "esphome/core/component.h"
#include "i2c_bus.h"
#include "esp_idf_version.h"
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 2)
#include <driver/i2c_master.h>
#else
@@ -46,6 +46,7 @@ class IDFI2CBus : public InternalI2CBus, public Component {
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 2)
i2c_master_dev_handle_t dev_;
i2c_master_bus_handle_t bus_;
void i2c_scan() override;
#endif
i2c_port_t port_;
uint8_t sda_pin_;