mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00: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:
		| @@ -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_) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user