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:
Stefan Agner 2022-01-03 16:37:21 +01:00 committed by GitHub
parent 72fa68849f
commit a02d2e2e11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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_) {