mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 15:08:10 +01:00
Explicitly use overloaded begin() for I2C master initialization (#2978)
Arduino 2.0.1 and newer support slave and master mode. The two modes have a begin() method with different signature: ``` // Slave Begin bool TwoWire::begin(uint8_t addr, int sdaPin, int sclPin, uint32_t frequency) // Master Begin bool TwoWire::begin(int sdaPin, int sclPin, uint32_t frequency) ``` Use type casting to make sure that overloaded method for master mode is used.
This commit is contained in:
parent
72fa68849f
commit
a02d2e2e11
1 changed files with 1 additions and 1 deletions
|
@ -25,7 +25,7 @@ void ArduinoI2CBus::setup() {
|
|||
wire_ = &Wire; // NOLINT(cppcoreguidelines-prefer-member-initializer)
|
||||
#endif
|
||||
|
||||
wire_->begin(sda_pin_, scl_pin_);
|
||||
wire_->begin(static_cast<int>(sda_pin_), static_cast<int>(scl_pin_));
|
||||
wire_->setClock(frequency_);
|
||||
initialized_ = true;
|
||||
if (this->scan_) {
|
||||
|
|
Loading…
Reference in a new issue