From 5461f87ff016cbb31a1ffe6876062dfee3f0ee63 Mon Sep 17 00:00:00 2001 From: Martin <25747549+martgras@users.noreply.github.com> Date: Thu, 7 Oct 2021 21:18:00 +0200 Subject: [PATCH] I2c fix (#2460) --- esphome/components/i2c/i2c.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/i2c/i2c.cpp b/esphome/components/i2c/i2c.cpp index 035c483344..82ab7bd09a 100644 --- a/esphome/components/i2c/i2c.cpp +++ b/esphome/components/i2c/i2c.cpp @@ -12,7 +12,7 @@ bool I2CDevice::write_bytes_16(uint8_t a_register, const uint16_t *data, uint8_t std::unique_ptr temp{new uint16_t[len]}; for (size_t i = 0; i < len; i++) temp[i] = htoi2cs(data[i]); - return write_register(a_register, reinterpret_cast(data), len * 2) == ERROR_OK; + return write_register(a_register, reinterpret_cast(temp.get()), len * 2) == ERROR_OK; } I2CRegister &I2CRegister::operator=(uint8_t value) {