[i2c] Use C++17 nested namespace syntax

This commit is contained in:
J. Nick Koston
2026-02-23 18:32:00 -06:00
parent 869678953d
commit aff94c6502
7 changed files with 14 additions and 28 deletions

View File

@@ -5,8 +5,7 @@
#include "esphome/core/log.h"
#include <memory>
namespace esphome {
namespace i2c {
namespace esphome::i2c {
static const char *const TAG = "i2c";
@@ -109,5 +108,4 @@ uint8_t I2CRegister16::get() const {
return value;
}
} // namespace i2c
} // namespace esphome
} // namespace esphome::i2c

View File

@@ -6,8 +6,7 @@
#include "esphome/core/optional.h"
#include "i2c_bus.h"
namespace esphome {
namespace i2c {
namespace esphome::i2c {
#define LOG_I2C_DEVICE(this) ESP_LOGCONFIG(TAG, " Address: 0x%02X", this->address_);
@@ -272,5 +271,4 @@ class I2CDevice {
I2CBus *bus_{nullptr}; ///< pointer to I2CBus instance
};
} // namespace i2c
} // namespace esphome
} // namespace esphome::i2c

View File

@@ -6,8 +6,7 @@
#include "esphome/core/helpers.h"
namespace esphome {
namespace i2c {
namespace esphome::i2c {
/// @brief Error codes returned by I2CBus and I2CDevice methods
enum ErrorCode {
@@ -69,5 +68,4 @@ class InternalI2CBus : public I2CBus {
virtual int get_port() const = 0;
};
} // namespace i2c
} // namespace esphome
} // namespace esphome::i2c

View File

@@ -7,8 +7,7 @@
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome {
namespace i2c {
namespace esphome::i2c {
static const char *const TAG = "i2c.arduino";
@@ -262,7 +261,6 @@ void ArduinoI2CBus::recover_() {
recovery_result_ = RECOVERY_COMPLETED;
}
} // namespace i2c
} // namespace esphome
} // namespace esphome::i2c
#endif // defined(USE_ARDUINO) && !defined(USE_ESP32)

View File

@@ -6,8 +6,7 @@
#include "esphome/core/component.h"
#include "i2c_bus.h"
namespace esphome {
namespace i2c {
namespace esphome::i2c {
enum RecoveryCode {
RECOVERY_FAILED_SCL_LOW,
@@ -45,7 +44,6 @@ class ArduinoI2CBus : public InternalI2CBus, public Component {
bool initialized_ = false;
};
} // namespace i2c
} // namespace esphome
} // namespace esphome::i2c
#endif // defined(USE_ARDUINO) && !defined(USE_ESP32)

View File

@@ -10,8 +10,7 @@
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome {
namespace i2c {
namespace esphome::i2c {
static const char *const TAG = "i2c.idf";
@@ -312,6 +311,5 @@ void IDFI2CBus::recover_() {
recovery_result_ = RECOVERY_COMPLETED;
}
} // namespace i2c
} // namespace esphome
} // namespace esphome::i2c
#endif // USE_ESP32

View File

@@ -6,8 +6,7 @@
#include "i2c_bus.h"
#include <driver/i2c_master.h>
namespace esphome {
namespace i2c {
namespace esphome::i2c {
enum RecoveryCode {
RECOVERY_FAILED_SCL_LOW,
@@ -56,7 +55,6 @@ class IDFI2CBus : public InternalI2CBus, public Component {
#endif
};
} // namespace i2c
} // namespace esphome
} // namespace esphome::i2c
#endif // USE_ESP32