1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-06 21:32:21 +01:00

Run clang-tidy against ESP32 (#2147)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Co-authored-by: Otto winter <otto@otto-winter.com>
This commit is contained in:
Oxan van Leeuwen
2021-09-13 18:11:27 +02:00
committed by GitHub
parent a2d2863c72
commit 40c474cd83
74 changed files with 291 additions and 364 deletions

View File

@@ -10,11 +10,12 @@ static const char *const TAG = "i2c";
I2CComponent::I2CComponent() {
#ifdef ARDUINO_ARCH_ESP32
if (next_i2c_bus_num_ == 0)
static uint8_t next_i2c_bus_num = 0;
if (next_i2c_bus_num == 0)
this->wire_ = &Wire;
else
this->wire_ = new TwoWire(next_i2c_bus_num_);
next_i2c_bus_num_++;
this->wire_ = new TwoWire(next_i2c_bus_num); // NOLINT(cppcoreguidelines-owning-memory)
next_i2c_bus_num++;
#else
this->wire_ = &Wire; // NOLINT(cppcoreguidelines-prefer-member-initializer)
#endif
@@ -273,10 +274,6 @@ bool I2CDevice::write_byte_16(uint8_t a_register, uint16_t data) { // NOLINT
}
void I2CDevice::set_i2c_parent(I2CComponent *parent) { this->parent_ = parent; }
#ifdef ARDUINO_ARCH_ESP32
uint8_t next_i2c_bus_num_ = 0;
#endif
I2CRegister &I2CRegister::operator=(uint8_t value) {
this->parent_->write_byte(this->register_, value);
return *this;

View File

@@ -131,10 +131,6 @@ class I2CComponent : public Component {
bool scan_;
};
#ifdef ARDUINO_ARCH_ESP32
extern uint8_t next_i2c_bus_num_;
#endif
class I2CDevice;
class I2CMultiplexer;
class I2CRegister {