mirror of
https://github.com/esphome/esphome.git
synced 2025-10-29 22:24:26 +00:00
[i2c] Expose internal i2c bus port number (#9136)
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
#ifdef USE_ESP_IDF
|
||||
|
||||
#include "i2c_bus.h"
|
||||
#include "esphome/core/component.h"
|
||||
#include <driver/i2c.h>
|
||||
#include "esphome/core/component.h"
|
||||
#include "i2c_bus.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace i2c {
|
||||
@@ -15,7 +15,7 @@ enum RecoveryCode {
|
||||
RECOVERY_COMPLETED,
|
||||
};
|
||||
|
||||
class IDFI2CBus : public I2CBus, public Component {
|
||||
class IDFI2CBus : public InternalI2CBus, public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
@@ -31,6 +31,8 @@ class IDFI2CBus : public I2CBus, public Component {
|
||||
void set_frequency(uint32_t frequency) { frequency_ = frequency; }
|
||||
void set_timeout(uint32_t timeout) { timeout_ = timeout; }
|
||||
|
||||
int get_port() const override { return static_cast<int>(this->port_); }
|
||||
|
||||
private:
|
||||
void recover_();
|
||||
RecoveryCode recovery_result_;
|
||||
|
||||
Reference in New Issue
Block a user