1
0
mirror of https://github.com/esphome/esphome.git synced 2025-06-15 14:56:59 +02:00

use `encode_uintXX` (#8847)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Thomas Rupprecht 2025-06-11 07:06:45 +02:00 committed by GitHub
parent 0e27ac281f
commit 487e1f871f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
150 changed files with 201 additions and 181 deletions

View File

@ -1,6 +1,6 @@
#include "ade7953_i2c.h" #include "ade7953_i2c.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace ade7953_i2c { namespace ade7953_i2c {

View File

@ -1,6 +1,6 @@
#include "ade7953_spi.h" #include "ade7953_spi.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace ade7953_spi { namespace ade7953_spi {

View File

@ -1,4 +1,5 @@
#include "ads1118.h" #include "ads1118.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,4 +1,5 @@
#include "ags10.h" #include "ags10.h"
#include "esphome/core/helpers.h"
#include <cinttypes> #include <cinttypes>

View File

@ -13,9 +13,9 @@
// results making successive requests; the current implementation makes 3 attempts with a delay of 30ms each time. // results making successive requests; the current implementation makes 3 attempts with a delay of 30ms each time.
#include "aht10.h" #include "aht10.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace aht10 { namespace aht10 {

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace am43 { namespace am43 {

View File

@ -1,9 +1,9 @@
#include "api_frame_helper.h" #include "api_frame_helper.h"
#ifdef USE_API #ifdef USE_API
#include "esphome/core/log.h" #include "esphome/core/application.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/application.h" #include "esphome/core/log.h"
#include "proto.h" #include "proto.h"
#include "api_pb2_size.h" #include "api_pb2_size.h"
#include <cstring> #include <cstring>

View File

@ -3,8 +3,8 @@
#include "api_server.h" #include "api_server.h"
#ifdef USE_API #ifdef USE_API
#include "api_pb2.h" #include "api_pb2.h"
#include "esphome/core/helpers.h"
#include "esphome/core/automation.h" #include "esphome/core/automation.h"
#include "esphome/core/helpers.h"
#include <vector> #include <vector>
namespace esphome { namespace esphome {

View File

@ -1,5 +1,6 @@
#include "proto.h" #include "proto.h"
#include <cinttypes> #include <cinttypes>
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <vector> #include <vector>

View File

@ -1,7 +1,7 @@
#include "ble_sensor.h" #include "ble_sensor.h"
#include "esphome/core/log.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "esphome/components/esp32_ble_tracker/esp32_ble_tracker.h" #include "esphome/components/esp32_ble_tracker/esp32_ble_tracker.h"
#ifdef USE_ESP32 #ifdef USE_ESP32

View File

@ -1,6 +1,6 @@
#include "bme680_bsec.h" #include "bme680_bsec.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <string> #include <string>
namespace esphome { namespace esphome {

View File

@ -1,6 +1,7 @@
#include "ccs811.h" #include "ccs811.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace ccs811 { namespace ccs811 {

View File

@ -3,8 +3,8 @@
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/entity_base.h" #include "esphome/core/entity_base.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/preferences.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/preferences.h"
#include "climate_mode.h" #include "climate_mode.h"
#include "climate_traits.h" #include "climate_traits.h"

View File

@ -223,11 +223,6 @@ void CSE7766Component::parse_data_() {
#endif #endif
} }
uint32_t CSE7766Component::get_24_bit_uint_(uint8_t start_index) {
return (uint32_t(this->raw_data_[start_index]) << 16) | (uint32_t(this->raw_data_[start_index + 1]) << 8) |
uint32_t(this->raw_data_[start_index + 2]);
}
void CSE7766Component::dump_config() { void CSE7766Component::dump_config() {
ESP_LOGCONFIG(TAG, "CSE7766:"); ESP_LOGCONFIG(TAG, "CSE7766:");
LOG_SENSOR(" ", "Voltage", this->voltage_sensor_); LOG_SENSOR(" ", "Voltage", this->voltage_sensor_);

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/helpers.h"
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"
#include "esphome/components/uart/uart.h" #include "esphome/components/uart/uart.h"
@ -28,7 +29,10 @@ class CSE7766Component : public Component, public uart::UARTDevice {
protected: protected:
bool check_byte_(); bool check_byte_();
void parse_data_(); void parse_data_();
uint32_t get_24_bit_uint_(uint8_t start_index); uint32_t get_24_bit_uint_(uint8_t start_index) const {
return encode_uint24(this->raw_data_[start_index], this->raw_data_[start_index + 1],
this->raw_data_[start_index + 2]);
}
uint8_t raw_data_[24]; uint8_t raw_data_[24];
uint8_t raw_data_index_{0}; uint8_t raw_data_index_{0};

View File

@ -1,4 +1,5 @@
#include "cst816_touchscreen.h" #include "cst816_touchscreen.h"
#include "esphome/core/helpers.h"
namespace esphome { namespace esphome {
namespace cst816 { namespace cst816 {

View File

@ -1,7 +1,7 @@
#include "dac7678_output.h" #include "dac7678_output.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace dac7678 { namespace dac7678 {

View File

@ -1,7 +1,8 @@
#include "daly_bms.h" #include "daly_bms.h"
#include <vector> #include <vector>
#include "esphome/core/log.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace daly_bms { namespace daly_bms {

View File

@ -2,9 +2,9 @@
#include <algorithm> #include <algorithm>
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "esphome/core/version.h" #include "esphome/core/version.h"
#include <cinttypes> #include <cinttypes>
#include <climits> #include <climits>

View File

@ -2,8 +2,8 @@
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/defines.h" #include "esphome/core/defines.h"
#include "esphome/core/macros.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/macros.h"
#ifdef USE_SENSOR #ifdef USE_SENSOR
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"

View File

@ -1,6 +1,6 @@
#include "dht.h" #include "dht.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace dht { namespace dht {

View File

@ -1,6 +1,6 @@
#include "duty_cycle_sensor.h" #include "duty_cycle_sensor.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace duty_cycle { namespace duty_cycle {

View File

@ -1,6 +1,6 @@
#include "ee895.h" #include "ee895.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace ee895 { namespace ee895 {

View File

@ -1,8 +1,8 @@
#ifdef USE_ESP32 #ifdef USE_ESP32
#include "esphome/core/preferences.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/preferences.h"
#include <nvs_flash.h> #include <nvs_flash.h>
#include <cstring> #include <cstring>
#include <cinttypes> #include <cinttypes>

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#ifdef USE_ESP32 #ifdef USE_ESP32

View File

@ -2,6 +2,7 @@
#include "ble_server.h" #include "ble_server.h"
#include "ble_service.h" #include "ble_service.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#ifdef USE_ESP32 #ifdef USE_ESP32

View File

@ -1,6 +1,6 @@
#include "esp32_dac.h" #include "esp32_dac.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#ifdef USE_ESP32 #ifdef USE_ESP32

View File

@ -1,10 +1,10 @@
#ifdef USE_ESP8266 #ifdef USE_ESP8266
#include "esp8266_pwm.h" #include "esp8266_pwm.h"
#include "esphome/core/macros.h"
#include "esphome/core/defines.h" #include "esphome/core/defines.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "esphome/core/macros.h"
#include <core_esp8266_waveform.h> #include <core_esp8266_waveform.h>

View File

@ -1,6 +1,6 @@
#include "exposure_notifications.h" #include "exposure_notifications.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#ifdef USE_ESP32 #ifdef USE_ESP32

View File

@ -1,5 +1,6 @@
#include "ft5x06_touchscreen.h" #include "ft5x06_touchscreen.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -76,16 +76,6 @@ bool GCJA5Component::calculate_checksum_() {
return (crc == this->rx_message_[30]); return (crc == this->rx_message_[30]);
} }
uint32_t GCJA5Component::get_32_bit_uint_(uint8_t start_index) {
return (((uint32_t) this->rx_message_[start_index + 3]) << 24) |
(((uint32_t) this->rx_message_[start_index + 2]) << 16) |
(((uint32_t) this->rx_message_[start_index + 1]) << 8) | ((uint32_t) this->rx_message_[start_index]);
}
uint16_t GCJA5Component::get_16_bit_uint_(uint8_t start_index) {
return (((uint32_t) this->rx_message_[start_index + 1]) << 8) | ((uint32_t) this->rx_message_[start_index]);
}
void GCJA5Component::parse_data_() { void GCJA5Component::parse_data_() {
ESP_LOGVV(TAG, "GCJA5 Data: "); ESP_LOGVV(TAG, "GCJA5 Data: ");
for (uint8_t i = 0; i < 32; i++) { for (uint8_t i = 0; i < 32; i++) {

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/helpers.h"
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"
#include "esphome/components/uart/uart.h" #include "esphome/components/uart/uart.h"
@ -28,8 +29,13 @@ class GCJA5Component : public Component, public uart::UARTDevice {
void parse_data_(); void parse_data_();
bool calculate_checksum_(); bool calculate_checksum_();
uint32_t get_32_bit_uint_(uint8_t start_index); uint16_t get_16_bit_uint_(uint8_t start_index) const {
uint16_t get_16_bit_uint_(uint8_t start_index); return encode_uint16(this->rx_message_[start_index + 1], this->rx_message_[start_index]);
}
uint32_t get_32_bit_uint_(uint8_t start_index) const {
return encode_uint32(this->rx_message_[start_index + 3], this->rx_message_[start_index + 2],
this->rx_message_[start_index + 1], this->rx_message_[start_index]);
}
uint32_t last_transmission_{0}; uint32_t last_transmission_{0};
std::vector<uint8_t> rx_message_; std::vector<uint8_t> rx_message_;

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/component.h"
#include "esphome/core/automation.h" #include "esphome/core/automation.h"
#include "esphome/core/component.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include <cstring> #include <cstring>

View File

@ -1,6 +1,6 @@
#include "gpio_one_wire.h" #include "gpio_one_wire.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace gpio { namespace gpio {

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "esphome/components/i2c/i2c.h" #include "esphome/components/i2c/i2c.h"
#include "esphome/core/automation.h"
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/automation.h"
//#include "esphome/core/helpers.h" //#include "esphome/core/helpers.h"
/* /*

View File

@ -1,6 +1,7 @@
#include "growatt_solar.h" #include "growatt_solar.h"
#include "esphome/core/log.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace growatt_solar { namespace growatt_solar {

View File

@ -1,5 +1,6 @@
#include "havells_solar.h" #include "havells_solar.h"
#include "havells_solar_registers.h" #include "havells_solar_registers.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,6 +1,6 @@
#include "honeywellabp2.h" #include "honeywellabp2.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace honeywellabp2_i2c { namespace honeywellabp2_i2c {

View File

@ -1,4 +1,5 @@
#include "hte501.h" #include "hte501.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,6 +1,6 @@
#include "hx711.h" #include "hx711.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace hx711 { namespace hx711 {

View File

@ -1,9 +1,9 @@
#ifdef USE_ARDUINO #ifdef USE_ARDUINO
#include "i2c_bus_arduino.h" #include "i2c_bus_arduino.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <Arduino.h> #include <Arduino.h>
#include <cstring> #include <cstring>

View File

@ -3,8 +3,8 @@
#ifdef USE_ESP32 #ifdef USE_ESP32
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/helpers.h"
#include "esphome/core/defines.h" #include "esphome/core/defines.h"
#include "esphome/core/helpers.h"
#ifdef USE_I2S_LEGACY #ifdef USE_I2S_LEGACY
#include <driver/i2s.h> #include <driver/i2s.h>
#else #else

View File

@ -1,7 +1,7 @@
#include "iaqcore.h" #include "iaqcore.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace iaqcore { namespace iaqcore {

View File

@ -1,6 +1,7 @@
#include "image.h" #include "image.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
namespace esphome { namespace esphome {
namespace image { namespace image {

View File

@ -1,7 +1,7 @@
#include "ina2xx_base.h" #include "ina2xx_base.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <cinttypes> #include <cinttypes>
#include <cmath> #include <cmath>

View File

@ -1,7 +1,7 @@
#include "integration_sensor.h" #include "integration_sensor.h"
#include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/hal.h"
namespace esphome { namespace esphome {
namespace integration { namespace integration {

View File

@ -1,5 +1,6 @@
#include "kmeteriso.h" #include "kmeteriso.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,7 +1,7 @@
#include "lcd_display.h" #include "lcd_display.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace lcd_base { namespace lcd_base {

View File

@ -1,8 +1,8 @@
#ifdef USE_LIBRETINY #ifdef USE_LIBRETINY
#include "esphome/core/preferences.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/preferences.h"
#include <flashdb.h> #include <flashdb.h>
#include <cstring> #include <cstring>
#include <vector> #include <vector>

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/helpers.h"
#include "esphome/core/color.h" #include "esphome/core/color.h"
#include "esphome/core/helpers.h"
namespace esphome { namespace esphome {
namespace light { namespace light {

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "light_color_values.h" #include "light_color_values.h"
namespace esphome { namespace esphome {

View File

@ -8,8 +8,8 @@
#include "LwTx.h" #include "LwTx.h"
#include <cstring> #include <cstring>
#include <Arduino.h> #include <Arduino.h>
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace lightwaverf { namespace lightwaverf {

View File

@ -2,9 +2,9 @@
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/entity_base.h" #include "esphome/core/entity_base.h"
#include "esphome/core/preferences.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/preferences.h"
#include <set> #include <set>
namespace esphome { namespace esphome {

View File

@ -1,7 +1,7 @@
#include "ltr501.h" #include "ltr501.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
using esphome::i2c::ErrorCode; using esphome::i2c::ErrorCode;

View File

@ -1,7 +1,7 @@
#include "ltr_als_ps.h" #include "ltr_als_ps.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
using esphome::i2c::ErrorCode; using esphome::i2c::ErrorCode;

View File

@ -1,7 +1,7 @@
#include "esphome/core/defines.h" #include "esphome/core/defines.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "lvgl_hal.h" #include "lvgl_hal.h"
#include "lvgl_esphome.h" #include "lvgl_esphome.h"

View File

@ -1,5 +1,6 @@
#include "max31855.h" #include "max31855.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,7 +1,7 @@
#include "max7219.h" #include "max7219.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace max7219 { namespace max7219 {

View File

@ -1,8 +1,8 @@
#include "max7219digit.h" #include "max7219digit.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "max7219font.h" #include "max7219font.h"
#include <algorithm> #include <algorithm>

View File

@ -1,7 +1,7 @@
#include "mcp4461.h" #include "mcp4461.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
namespace esphome { namespace esphome {
namespace mcp4461 { namespace mcp4461 {

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include "esphome/core/component.h"
#include "esphome/components/uart/uart.h" #include "esphome/components/uart/uart.h"
#include "esphome/core/log.h" #include "esphome/core/component.h"
#include "esphome/core/defines.h" #include "esphome/core/defines.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <vector> #include <vector>

View File

@ -1,7 +1,7 @@
#ifdef USE_ARDUINO #ifdef USE_ARDUINO
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "air_conditioner.h" #include "air_conditioner.h"
#include "ac_adapter.h" #include "ac_adapter.h"
#include <cmath> #include <cmath>

View File

@ -1,7 +1,7 @@
#include "midea_ir.h" #include "midea_ir.h"
#include "midea_data.h" #include "midea_data.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "esphome/components/coolix/coolix.h" #include "esphome/components/coolix/coolix.h"
namespace esphome { namespace esphome {

View File

@ -1,6 +1,7 @@
#include "mlx90614.h" #include "mlx90614.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,7 +1,7 @@
#include "modbus.h" #include "modbus.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace modbus { namespace modbus {

View File

@ -1,5 +1,6 @@
#include "mpl3115a2.h" #include "mpl3115a2.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -4,8 +4,8 @@
#ifdef USE_ESP32 #ifdef USE_ESP32
#include <string> #include <string>
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace mqtt { namespace mqtt {

View File

@ -1,7 +1,7 @@
#include "msa3xx.h" #include "msa3xx.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace msa3xx { namespace msa3xx {

View File

@ -1,6 +1,6 @@
#include "my9231.h" #include "my9231.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace my9231 { namespace my9231 {

View File

@ -2,10 +2,10 @@
#ifdef USE_ARDUINO #ifdef USE_ARDUINO
#include "esphome/core/macros.h" #include "esphome/core/color.h"
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/color.h" #include "esphome/core/macros.h"
#include "esphome/components/light/light_output.h" #include "esphome/components/light/light_output.h"
#include "esphome/components/light/addressable_light.h" #include "esphome/components/light/addressable_light.h"

View File

@ -5,8 +5,8 @@
#include <string> #include <string>
#include <cstdio> #include <cstdio>
#include <array> #include <array>
#include "esphome/core/macros.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/macros.h"
#if defined(USE_ESP_IDF) || defined(USE_LIBRETINY) || USE_ARDUINO_VERSION_CODE > VERSION_CODE(3, 0, 0) #if defined(USE_ESP_IDF) || defined(USE_LIBRETINY) || USE_ARDUINO_VERSION_CODE > VERSION_CODE(3, 0, 0)
#include <lwip/ip_addr.h> #include <lwip/ip_addr.h>

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <vector> #include <vector>

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <vector> #include <vector>

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "ndef_record.h" #include "ndef_record.h"
#include <vector> #include <vector>

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "ndef_record.h" #include "ndef_record.h"
#include <vector> #include <vector>

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "ndef_record.h" #include "ndef_record.h"
#include "ndef_message.h" #include "ndef_message.h"
#include "nfc_tag.h" #include "nfc_tag.h"

View File

@ -3,8 +3,8 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "ndef_message.h" #include "ndef_message.h"
namespace esphome { namespace esphome {

View File

@ -1,6 +1,6 @@
#include "noblex.h" #include "noblex.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace noblex { namespace noblex {

View File

@ -1,7 +1,7 @@
#include "npi19.h" #include "npi19.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace npi19 { namespace npi19 {

View File

@ -9,8 +9,8 @@
#include <string> #include <string>
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#if defined(ESP32) || defined(USE_ESP_IDF) #if defined(ESP32) || defined(USE_ESP_IDF)
#include "driver/timer.h" #include "driver/timer.h"

View File

@ -1,6 +1,6 @@
#include "float_output.h" #include "float_output.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace output { namespace output {

View File

@ -1,7 +1,7 @@
#include "pca9685_output.h" #include "pca9685_output.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace pca9685 { namespace pca9685 {

View File

@ -1,7 +1,7 @@
#include "pcd_8544.h" #include "pcd_8544.h"
#include "esphome/core/log.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace pcd8544 { namespace pcd8544 {

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "esphome/core/automation.h"
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/automation.h"
#include "esphome/components/climate/climate.h" #include "esphome/components/climate/climate.h"
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"
#include "esphome/components/output/float_output.h" #include "esphome/components/output/float_output.h"

View File

@ -1,6 +1,6 @@
#include "pid_climate_sensor.h" #include "pid_climate_sensor.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace pid { namespace pid {

View File

@ -1,6 +1,6 @@
#include "pipsolar_output.h" #include "pipsolar_output.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace pipsolar { namespace pipsolar {

View File

@ -1,6 +1,6 @@
#include "pipsolar.h" #include "pipsolar.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace pipsolar { namespace pipsolar {

View File

@ -95,9 +95,5 @@ void PM1006Component::parse_data_() {
} }
} }
uint16_t PM1006Component::get_16_bit_uint_(uint8_t start_index) const {
return encode_uint16(this->data_[start_index], this->data_[start_index + 1]);
}
} // namespace pm1006 } // namespace pm1006
} // namespace esphome } // namespace esphome

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/helpers.h"
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"
#include "esphome/components/uart/uart.h" #include "esphome/components/uart/uart.h"
@ -22,8 +23,10 @@ class PM1006Component : public PollingComponent, public uart::UARTDevice {
protected: protected:
optional<bool> check_byte_() const; optional<bool> check_byte_() const;
void parse_data_(); void parse_data_();
uint16_t get_16_bit_uint_(uint8_t start_index) const;
uint8_t pm1006_checksum_(const uint8_t *command_data, uint8_t length) const; uint8_t pm1006_checksum_(const uint8_t *command_data, uint8_t length) const;
uint16_t get_16_bit_uint_(uint8_t start_index) const {
return encode_uint16(this->data_[start_index], this->data_[start_index + 1]);
}
sensor::Sensor *pm_2_5_sensor_{nullptr}; sensor::Sensor *pm_2_5_sensor_{nullptr};

View File

@ -1,6 +1,6 @@
#include "pmsa003i.h" #include "pmsa003i.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <cstring> #include <cstring>
namespace esphome { namespace esphome {

View File

@ -314,9 +314,5 @@ void PMSX003Component::parse_data_() {
this->status_clear_warning(); this->status_clear_warning();
} }
uint16_t PMSX003Component::get_16_bit_uint_(uint8_t start_index) {
return (uint16_t(this->data_[start_index]) << 8) | uint16_t(this->data_[start_index + 1]);
}
} // namespace pmsx003 } // namespace pmsx003
} // namespace esphome } // namespace esphome

View File

@ -1,8 +1,9 @@
#pragma once #pragma once
#include "esphome/core/component.h"
#include "esphome/core/helpers.h"
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"
#include "esphome/components/uart/uart.h" #include "esphome/components/uart/uart.h"
#include "esphome/core/component.h"
namespace esphome { namespace esphome {
namespace pmsx003 { namespace pmsx003 {
@ -77,7 +78,9 @@ class PMSX003Component : public uart::UARTDevice, public Component {
void parse_data_(); void parse_data_();
bool check_payload_length_(uint16_t payload_length); bool check_payload_length_(uint16_t payload_length);
void send_command_(PMSX0003Command cmd, uint16_t data); void send_command_(PMSX0003Command cmd, uint16_t data);
uint16_t get_16_bit_uint_(uint8_t start_index); uint16_t get_16_bit_uint_(uint8_t start_index) const {
return encode_uint16(this->data_[start_index], this->data_[start_index + 1]);
}
uint8_t data_[64]; uint8_t data_[64];
uint8_t data_index_{0}; uint8_t data_index_{0};

View File

@ -1,6 +1,6 @@
#include "pylontech.h" #include "pylontech.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace pylontech { namespace pylontech {

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "esphome/core/log.h"
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"
#include "esphome/components/i2c/i2c.h" #include "esphome/components/i2c/i2c.h"

View File

@ -1,4 +1,5 @@
#include "rdm6300.h" #include "rdm6300.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,7 +1,7 @@
#include "remote_receiver.h" #include "remote_receiver.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#ifdef USE_ESP8266 #ifdef USE_ESP8266

View File

@ -1,7 +1,7 @@
#include "remote_receiver.h" #include "remote_receiver.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#ifdef USE_LIBRETINY #ifdef USE_LIBRETINY

View File

@ -1,6 +1,6 @@
#include "rotary_encoder.h" #include "rotary_encoder.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace rotary_encoder { namespace rotary_encoder {

View File

@ -1,5 +1,6 @@
#include "sdm_meter.h" #include "sdm_meter.h"
#include "sdm_meter_registers.h" #include "sdm_meter_registers.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,7 +1,7 @@
#include "sdp3x.h" #include "sdp3x.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace sdp3x { namespace sdp3x {

View File

@ -182,9 +182,6 @@ void SDS011Component::parse_data_() {
} }
} }
uint16_t SDS011Component::get_16_bit_uint_(uint8_t start_index) const {
return (uint16_t(this->data_[start_index + 1]) << 8) | uint16_t(this->data_[start_index]);
}
void SDS011Component::set_update_interval_min(uint8_t update_interval_min) { void SDS011Component::set_update_interval_min(uint8_t update_interval_min) {
this->update_interval_min_ = update_interval_min; this->update_interval_min_ = update_interval_min;
} }

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/helpers.h"
#include "esphome/components/sensor/sensor.h" #include "esphome/components/sensor/sensor.h"
#include "esphome/components/uart/uart.h" #include "esphome/components/uart/uart.h"
@ -32,7 +33,9 @@ class SDS011Component : public Component, public uart::UARTDevice {
uint8_t sds011_checksum_(const uint8_t *command_data, uint8_t length) const; uint8_t sds011_checksum_(const uint8_t *command_data, uint8_t length) const;
optional<bool> check_byte_() const; optional<bool> check_byte_() const;
void parse_data_(); void parse_data_();
uint16_t get_16_bit_uint_(uint8_t start_index) const; uint16_t get_16_bit_uint_(uint8_t start_index) const {
return encode_uint16(this->data_[start_index + 1], this->data_[start_index]);
}
sensor::Sensor *pm_2_5_sensor_{nullptr}; sensor::Sensor *pm_2_5_sensor_{nullptr};
sensor::Sensor *pm_10_0_sensor_{nullptr}; sensor::Sensor *pm_10_0_sensor_{nullptr};

View File

@ -1,5 +1,6 @@
#include "seeed_mr24hpc1.h" #include "seeed_mr24hpc1.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include <utility> #include <utility>

View File

@ -1,4 +1,5 @@
#include "seeed_mr60bha2.h" #include "seeed_mr60bha2.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include <cinttypes> #include <cinttypes>

View File

@ -1,4 +1,5 @@
#include "seeed_mr60fda2.h" #include "seeed_mr60fda2.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include <cinttypes> #include <cinttypes>

View File

@ -1,5 +1,6 @@
#include "selec_meter.h" #include "selec_meter.h"
#include "selec_meter_registers.h" #include "selec_meter_registers.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,6 +1,7 @@
#include "i2c_sensirion.h" #include "i2c_sensirion.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <cinttypes> #include <cinttypes>
namespace esphome { namespace esphome {

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include "esphome/components/i2c/i2c.h" #include "esphome/components/i2c/i2c.h"
#include "esphome/core/helpers.h"
#include <vector> #include <vector>

View File

@ -3,9 +3,9 @@
#include <queue> #include <queue>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "esphome/core/automation.h"
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/automation.h"
namespace esphome { namespace esphome {
namespace sensor { namespace sensor {

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "esphome/core/log.h"
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/entity_base.h" #include "esphome/core/entity_base.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "esphome/components/sensor/filter.h" #include "esphome/components/sensor/filter.h"
#include <vector> #include <vector>

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "esphome/core/component.h"
#include "esphome/core/automation.h" #include "esphome/core/automation.h"
#include "esphome/core/component.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/preferences.h" #include "esphome/core/preferences.h"
#include "esphome/components/output/float_output.h" #include "esphome/components/output/float_output.h"

View File

@ -1,6 +1,6 @@
#include "sml.h" #include "sml.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "sml_parser.h" #include "sml_parser.h"
namespace esphome { namespace esphome {

View File

@ -31,9 +31,9 @@
----- -----
*/ */
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "esphome/components/uart/uart.h" #include "esphome/components/uart/uart.h"
#include "esphome/components/light/light_output.h" #include "esphome/components/light/light_output.h"
#include "esphome/components/light/light_state.h" #include "esphome/components/light/light_state.h"

View File

@ -1,6 +1,6 @@
#include "ssd1306_base.h" #include "ssd1306_base.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace ssd1306_base { namespace ssd1306_base {

View File

@ -1,6 +1,6 @@
#include "ssd1322_base.h" #include "ssd1322_base.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace ssd1322_base { namespace ssd1322_base {

View File

@ -1,6 +1,6 @@
#include "ssd1325_base.h" #include "ssd1325_base.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace ssd1325_base { namespace ssd1325_base {

View File

@ -1,6 +1,6 @@
#include "ssd1327_base.h" #include "ssd1327_base.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace ssd1327_base { namespace ssd1327_base {

View File

@ -1,6 +1,6 @@
#include "ssd1331_base.h" #include "ssd1331_base.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace ssd1331_base { namespace ssd1331_base {

View File

@ -1,6 +1,6 @@
#include "ssd1351_base.h" #include "ssd1351_base.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace ssd1351_base { namespace ssd1351_base {

View File

@ -1,6 +1,6 @@
#include "st7567_base.h" #include "st7567_base.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace st7567_base { namespace st7567_base {

View File

@ -1,7 +1,7 @@
#include "st7735.h" #include "st7735.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace st7735 { namespace st7735 {

View File

@ -2,8 +2,8 @@
#include "esphome/core/component.h" #include "esphome/core/component.h"
#include "esphome/core/entity_base.h" #include "esphome/core/entity_base.h"
#include "esphome/core/preferences.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/preferences.h"
namespace esphome { namespace esphome {
namespace switch_ { namespace switch_ {

View File

@ -1,4 +1,5 @@
#include "t6615.h" #include "t6615.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,8 +1,8 @@
#include "tcs34725.h" #include "tcs34725.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include <algorithm>
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <algorithm>
namespace esphome { namespace esphome {
namespace tcs34725 { namespace tcs34725 {

View File

@ -1,4 +1,5 @@
#include "tee501.h" #include "tee501.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
namespace esphome { namespace esphome {

View File

@ -1,7 +1,7 @@
#include "tem3200.h" #include "tem3200.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace tem3200 { namespace tem3200 {

View File

@ -1,7 +1,7 @@
#include "tlc59208f_output.h" #include "tlc59208f_output.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace tlc59208f { namespace tlc59208f {

View File

@ -1,7 +1,7 @@
#include "tm1621.h" #include "tm1621.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace tm1621 { namespace tm1621 {

View File

@ -1,7 +1,7 @@
#include "tm1637.h" #include "tm1637.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace tm1637 { namespace tm1637 {

View File

@ -1,8 +1,8 @@
#include "tm1638.h" #include "tm1638.h"
#include "sevenseg.h" #include "sevenseg.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace tm1638 { namespace tm1638 {

View File

@ -1,8 +1,8 @@
#ifdef USE_ARDUINO #ifdef USE_ARDUINO
#include "tm1651.h" #include "tm1651.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace tm1651 { namespace tm1651 {

View File

@ -1,6 +1,6 @@
#include "tx20.h" #include "tx20.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <vector> #include <vector>

View File

@ -1,8 +1,8 @@
#include "uart.h" #include "uart.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/defines.h" #include "esphome/core/defines.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <cinttypes> #include <cinttypes>
namespace esphome { namespace esphome {

View File

@ -1,7 +1,7 @@
#include "uponor_smatrix_climate.h" #include "uponor_smatrix_climate.h"
#include "esphome/core/application.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/application.h"
namespace esphome { namespace esphome {
namespace uponor_smatrix { namespace uponor_smatrix {

View File

@ -1,6 +1,7 @@
#include "uponor_smatrix.h" #include "uponor_smatrix.h"
#include "esphome/core/log.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace uponor_smatrix { namespace uponor_smatrix {

View File

@ -1,7 +1,7 @@
#include "waveshare_epaper.h" #include "waveshare_epaper.h"
#include "esphome/core/log.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <cinttypes> #include <cinttypes>
#include <bitset> #include <bitset>

View File

@ -1,8 +1,8 @@
#include "web_server_base.h" #include "web_server_base.h"
#ifdef USE_NETWORK #ifdef USE_NETWORK
#include "esphome/core/log.h"
#include "esphome/core/application.h" #include "esphome/core/application.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#ifdef USE_ARDUINO #ifdef USE_ARDUINO
#include <StreamString.h> #include <StreamString.h>

View File

@ -1,7 +1,7 @@
#ifdef USE_ESP_IDF #ifdef USE_ESP_IDF
#include <memory> #include <memory>
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "http_parser.h" #include "http_parser.h"
#include "utils.h" #include "utils.h"

View File

@ -2,8 +2,8 @@
#include <cstdarg> #include <cstdarg>
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "esp_tls_crypto.h" #include "esp_tls_crypto.h"

View File

@ -1,6 +1,6 @@
#include "wiegand.h" #include "wiegand.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome { namespace esphome {
namespace wiegand { namespace wiegand {

View File

@ -32,11 +32,11 @@ extern "C" {
#endif #endif
} }
#include "esphome/core/application.h"
#include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/hal.h"
#include "esphome/core/util.h" #include "esphome/core/util.h"
#include "esphome/core/application.h"
namespace esphome { namespace esphome {
namespace wifi { namespace wifi {

View File

@ -9,10 +9,10 @@
#include "lwip/err.h" #include "lwip/err.h"
#include "lwip/dns.h" #include "lwip/dns.h"
#include "esphome/core/application.h"
#include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/hal.h"
#include "esphome/core/application.h"
#include "esphome/core/util.h" #include "esphome/core/util.h"
namespace esphome { namespace esphome {

View File

@ -1,8 +1,8 @@
#ifdef USE_ARDUINO #ifdef USE_ARDUINO
#include "wled_light_effect.h" #include "wled_light_effect.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#ifdef USE_ESP32 #ifdef USE_ESP32
#include <WiFi.h> #include <WiFi.h>

View File

@ -1,7 +1,7 @@
#include "xgzp68xx.h" #include "xgzp68xx.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include "esphome/components/i2c/i2c.h" #include "esphome/components/i2c/i2c.h"
#include <cinttypes> #include <cinttypes>

View File

@ -1,6 +1,6 @@
#include "xiaomi_hhccjcy10.h" #include "xiaomi_hhccjcy10.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#ifdef USE_ESP32 #ifdef USE_ESP32

View File

@ -1,6 +1,6 @@
#include "xpt2046.h" #include "xpt2046.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <algorithm> #include <algorithm>

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "esphome/core/component.h"
#include "esphome/core/automation.h"
#include "esphome/components/spi/spi.h" #include "esphome/components/spi/spi.h"
#include "esphome/components/touchscreen/touchscreen.h" #include "esphome/components/touchscreen/touchscreen.h"
#include "esphome/core/automation.h"
#include "esphome/core/component.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"

View File

@ -192,15 +192,15 @@ bool random_bytes(uint8_t *data, size_t len);
constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb) { constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb) {
return (static_cast<uint16_t>(msb) << 8) | (static_cast<uint16_t>(lsb)); return (static_cast<uint16_t>(msb) << 8) | (static_cast<uint16_t>(lsb));
} }
/// Encode a 24-bit value given three bytes in most to least significant byte order.
constexpr uint32_t encode_uint24(uint8_t byte1, uint8_t byte2, uint8_t byte3) {
return (static_cast<uint32_t>(byte1) << 16) | (static_cast<uint32_t>(byte2) << 8) | (static_cast<uint32_t>(byte3));
}
/// Encode a 32-bit value given four bytes in most to least significant byte order. /// Encode a 32-bit value given four bytes in most to least significant byte order.
constexpr uint32_t encode_uint32(uint8_t byte1, uint8_t byte2, uint8_t byte3, uint8_t byte4) { constexpr uint32_t encode_uint32(uint8_t byte1, uint8_t byte2, uint8_t byte3, uint8_t byte4) {
return (static_cast<uint32_t>(byte1) << 24) | (static_cast<uint32_t>(byte2) << 16) | return (static_cast<uint32_t>(byte1) << 24) | (static_cast<uint32_t>(byte2) << 16) |
(static_cast<uint32_t>(byte3) << 8) | (static_cast<uint32_t>(byte4)); (static_cast<uint32_t>(byte3) << 8) | (static_cast<uint32_t>(byte4));
} }
/// Encode a 24-bit value given three bytes in most to least significant byte order.
constexpr uint32_t encode_uint24(uint8_t byte1, uint8_t byte2, uint8_t byte3) {
return ((static_cast<uint32_t>(byte1) << 16) | (static_cast<uint32_t>(byte2) << 8) | (static_cast<uint32_t>(byte3)));
}
/// Encode a value from its constituent bytes (from most to least significant) in an array with length sizeof(T). /// Encode a value from its constituent bytes (from most to least significant) in an array with length sizeof(T).
template<typename T, enable_if_t<std::is_unsigned<T>::value, int> = 0> template<typename T, enable_if_t<std::is_unsigned<T>::value, int> = 0>

View File

@ -2,9 +2,9 @@
#include "application.h" #include "application.h"
#include "esphome/core/defines.h" #include "esphome/core/defines.h"
#include "esphome/core/log.h"
#include "esphome/core/helpers.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
#include <algorithm> #include <algorithm>
#include <cinttypes> #include <cinttypes>