From d14cbdeaa19effc546d9269bdc9a8512384046a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Poczkodi?= Date: Sat, 19 Oct 2024 17:45:02 +0200 Subject: [PATCH] moved components into a single file --- .../si4713_i2c/number/acomp_gain_number.cpp | 12 -- .../si4713_i2c/number/acomp_gain_number.h | 18 -- .../number/acomp_threshold_number.cpp | 12 -- .../number/acomp_threshold_number.h | 18 -- .../si4713_i2c/number/analog_level_number.cpp | 12 -- .../si4713_i2c/number/analog_level_number.h | 18 -- .../number/asq_duration_high_number.cpp | 12 -- .../number/asq_duration_high_number.h | 18 -- .../number/asq_duration_low_number.cpp | 12 -- .../number/asq_duration_low_number.h | 18 -- .../number/asq_level_high_number.cpp | 12 -- .../si4713_i2c/number/asq_level_high_number.h | 18 -- .../number/asq_level_low_number.cpp | 12 -- .../si4713_i2c/number/asq_level_low_number.h | 18 -- .../number/digital_sample_rate_number.cpp | 12 -- .../number/digital_sample_rate_number.h | 18 -- .../number/limiter_release_time_number.cpp | 12 -- .../number/limiter_release_time_number.h | 18 -- esphome/components/si4713_i2c/number/number.h | 154 ++++++++++++++++++ .../number/pilot_deviation_number.cpp | 12 -- .../number/pilot_deviation_number.h | 18 -- .../number/pilot_frequency_number.cpp | 12 -- .../number/pilot_frequency_number.h | 18 -- .../number/rds_deviation_number.cpp | 12 -- .../si4713_i2c/number/rds_deviation_number.h | 18 -- .../number/refclk_frequency_number.cpp | 12 -- .../number/refclk_frequency_number.h | 18 -- .../number/refclk_prescaler_number.cpp | 12 -- .../number/refclk_prescaler_number.h | 18 -- .../si4713_i2c/number/tuner_antcap_number.cpp | 12 -- .../si4713_i2c/number/tuner_antcap_number.h | 18 -- .../number/tuner_deviation_number.cpp | 12 -- .../number/tuner_deviation_number.h | 18 -- .../number/tuner_frequency_number.cpp | 12 -- .../number/tuner_frequency_number.h | 18 -- .../si4713_i2c/number/tuner_power_number.cpp | 12 -- .../si4713_i2c/number/tuner_power_number.h | 18 -- .../si4713_i2c/output/binary_output.cpp | 25 --- .../output/{binary_output.h => output.h} | 6 +- .../si4713_i2c/select/acomp_attack_select.cpp | 14 -- .../si4713_i2c/select/acomp_attack_select.h | 18 -- .../si4713_i2c/select/acomp_preset_select.cpp | 14 -- .../si4713_i2c/select/acomp_preset_select.h | 18 -- .../select/acomp_release_select.cpp | 14 -- .../si4713_i2c/select/acomp_release_select.h | 18 -- .../select/analog_attenuation_select.cpp | 14 -- .../select/analog_attenuation_select.h | 18 -- .../select/digital_channels_select.cpp | 14 -- .../select/digital_channels_select.h | 18 -- .../select/digital_clock_edge_select.cpp | 14 -- .../select/digital_clock_edge_select.h | 18 -- .../si4713_i2c/select/digital_mode_select.cpp | 14 -- .../si4713_i2c/select/digital_mode_select.h | 18 -- .../select/digital_sample_bits_select.cpp | 14 -- .../select/digital_sample_bits_select.h | 18 -- .../si4713_i2c/select/pre_emphasis_select.cpp | 14 -- .../si4713_i2c/select/pre_emphasis_select.h | 18 -- .../select/refclk_source_select.cpp | 14 -- .../si4713_i2c/select/refclk_source_select.h | 18 -- esphome/components/si4713_i2c/select/select.h | 111 +++++++++++++ esphome/components/si4713_i2c/si4713.cpp | 6 +- esphome/components/si4713_i2c/si4713defs.h | 2 - .../components/si4713_i2c/switch/__init__.py | 36 ++-- .../si4713_i2c/switch/acomp_enable_switch.cpp | 12 -- .../si4713_i2c/switch/acomp_enable_switch.h | 18 -- .../si4713_i2c/switch/asq_ialh_switch.cpp | 12 -- .../si4713_i2c/switch/asq_ialh_switch.h | 18 -- .../si4713_i2c/switch/asq_iall_switch.cpp | 12 -- .../si4713_i2c/switch/asq_iall_switch.h | 18 -- .../si4713_i2c/switch/asq_overmod_switch.cpp | 12 -- .../si4713_i2c/switch/asq_overmod_switch.h | 18 -- .../switch/limiter_enable_switch.cpp | 12 -- .../si4713_i2c/switch/limiter_enable_switch.h | 18 -- .../si4713_i2c/switch/mono_switch.cpp | 12 -- .../si4713_i2c/switch/mono_switch.h | 18 -- .../si4713_i2c/switch/mute_switch.cpp | 12 -- .../si4713_i2c/switch/mute_switch.h | 18 -- .../si4713_i2c/switch/output_gpio_switch.cpp | 12 -- .../si4713_i2c/switch/output_gpio_switch.h | 22 --- .../si4713_i2c/switch/pilot_enable_switch.cpp | 12 -- .../si4713_i2c/switch/pilot_enable_switch.h | 18 -- .../si4713_i2c/switch/rds_enable_switch.cpp | 12 -- .../si4713_i2c/switch/rds_enable_switch.h | 18 -- esphome/components/si4713_i2c/switch/switch.h | 103 ++++++++++++ .../si4713_i2c/switch/tuner_enable_switch.cpp | 12 -- .../si4713_i2c/switch/tuner_enable_switch.h | 18 -- .../si4713_i2c/text/rds_station_text.cpp | 12 -- .../si4713_i2c/text/rds_station_text.h | 18 -- .../si4713_i2c/text/rds_text_text.cpp | 12 -- .../si4713_i2c/text/rds_text_text.h | 18 -- esphome/components/si4713_i2c/text/text.h | 26 +++ 91 files changed, 420 insertions(+), 1303 deletions(-) delete mode 100644 esphome/components/si4713_i2c/number/acomp_gain_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/acomp_gain_number.h delete mode 100644 esphome/components/si4713_i2c/number/acomp_threshold_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/acomp_threshold_number.h delete mode 100644 esphome/components/si4713_i2c/number/analog_level_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/analog_level_number.h delete mode 100644 esphome/components/si4713_i2c/number/asq_duration_high_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/asq_duration_high_number.h delete mode 100644 esphome/components/si4713_i2c/number/asq_duration_low_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/asq_duration_low_number.h delete mode 100644 esphome/components/si4713_i2c/number/asq_level_high_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/asq_level_high_number.h delete mode 100644 esphome/components/si4713_i2c/number/asq_level_low_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/asq_level_low_number.h delete mode 100644 esphome/components/si4713_i2c/number/digital_sample_rate_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/digital_sample_rate_number.h delete mode 100644 esphome/components/si4713_i2c/number/limiter_release_time_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/limiter_release_time_number.h create mode 100644 esphome/components/si4713_i2c/number/number.h delete mode 100644 esphome/components/si4713_i2c/number/pilot_deviation_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/pilot_deviation_number.h delete mode 100644 esphome/components/si4713_i2c/number/pilot_frequency_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/pilot_frequency_number.h delete mode 100644 esphome/components/si4713_i2c/number/rds_deviation_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/rds_deviation_number.h delete mode 100644 esphome/components/si4713_i2c/number/refclk_frequency_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/refclk_frequency_number.h delete mode 100644 esphome/components/si4713_i2c/number/refclk_prescaler_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/refclk_prescaler_number.h delete mode 100644 esphome/components/si4713_i2c/number/tuner_antcap_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/tuner_antcap_number.h delete mode 100644 esphome/components/si4713_i2c/number/tuner_deviation_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/tuner_deviation_number.h delete mode 100644 esphome/components/si4713_i2c/number/tuner_frequency_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/tuner_frequency_number.h delete mode 100644 esphome/components/si4713_i2c/number/tuner_power_number.cpp delete mode 100644 esphome/components/si4713_i2c/number/tuner_power_number.h delete mode 100644 esphome/components/si4713_i2c/output/binary_output.cpp rename esphome/components/si4713_i2c/output/{binary_output.h => output.h} (80%) delete mode 100644 esphome/components/si4713_i2c/select/acomp_attack_select.cpp delete mode 100644 esphome/components/si4713_i2c/select/acomp_attack_select.h delete mode 100644 esphome/components/si4713_i2c/select/acomp_preset_select.cpp delete mode 100644 esphome/components/si4713_i2c/select/acomp_preset_select.h delete mode 100644 esphome/components/si4713_i2c/select/acomp_release_select.cpp delete mode 100644 esphome/components/si4713_i2c/select/acomp_release_select.h delete mode 100644 esphome/components/si4713_i2c/select/analog_attenuation_select.cpp delete mode 100644 esphome/components/si4713_i2c/select/analog_attenuation_select.h delete mode 100644 esphome/components/si4713_i2c/select/digital_channels_select.cpp delete mode 100644 esphome/components/si4713_i2c/select/digital_channels_select.h delete mode 100644 esphome/components/si4713_i2c/select/digital_clock_edge_select.cpp delete mode 100644 esphome/components/si4713_i2c/select/digital_clock_edge_select.h delete mode 100644 esphome/components/si4713_i2c/select/digital_mode_select.cpp delete mode 100644 esphome/components/si4713_i2c/select/digital_mode_select.h delete mode 100644 esphome/components/si4713_i2c/select/digital_sample_bits_select.cpp delete mode 100644 esphome/components/si4713_i2c/select/digital_sample_bits_select.h delete mode 100644 esphome/components/si4713_i2c/select/pre_emphasis_select.cpp delete mode 100644 esphome/components/si4713_i2c/select/pre_emphasis_select.h delete mode 100644 esphome/components/si4713_i2c/select/refclk_source_select.cpp delete mode 100644 esphome/components/si4713_i2c/select/refclk_source_select.h create mode 100644 esphome/components/si4713_i2c/select/select.h delete mode 100644 esphome/components/si4713_i2c/switch/acomp_enable_switch.cpp delete mode 100644 esphome/components/si4713_i2c/switch/acomp_enable_switch.h delete mode 100644 esphome/components/si4713_i2c/switch/asq_ialh_switch.cpp delete mode 100644 esphome/components/si4713_i2c/switch/asq_ialh_switch.h delete mode 100644 esphome/components/si4713_i2c/switch/asq_iall_switch.cpp delete mode 100644 esphome/components/si4713_i2c/switch/asq_iall_switch.h delete mode 100644 esphome/components/si4713_i2c/switch/asq_overmod_switch.cpp delete mode 100644 esphome/components/si4713_i2c/switch/asq_overmod_switch.h delete mode 100644 esphome/components/si4713_i2c/switch/limiter_enable_switch.cpp delete mode 100644 esphome/components/si4713_i2c/switch/limiter_enable_switch.h delete mode 100644 esphome/components/si4713_i2c/switch/mono_switch.cpp delete mode 100644 esphome/components/si4713_i2c/switch/mono_switch.h delete mode 100644 esphome/components/si4713_i2c/switch/mute_switch.cpp delete mode 100644 esphome/components/si4713_i2c/switch/mute_switch.h delete mode 100644 esphome/components/si4713_i2c/switch/output_gpio_switch.cpp delete mode 100644 esphome/components/si4713_i2c/switch/output_gpio_switch.h delete mode 100644 esphome/components/si4713_i2c/switch/pilot_enable_switch.cpp delete mode 100644 esphome/components/si4713_i2c/switch/pilot_enable_switch.h delete mode 100644 esphome/components/si4713_i2c/switch/rds_enable_switch.cpp delete mode 100644 esphome/components/si4713_i2c/switch/rds_enable_switch.h create mode 100644 esphome/components/si4713_i2c/switch/switch.h delete mode 100644 esphome/components/si4713_i2c/switch/tuner_enable_switch.cpp delete mode 100644 esphome/components/si4713_i2c/switch/tuner_enable_switch.h delete mode 100644 esphome/components/si4713_i2c/text/rds_station_text.cpp delete mode 100644 esphome/components/si4713_i2c/text/rds_station_text.h delete mode 100644 esphome/components/si4713_i2c/text/rds_text_text.cpp delete mode 100644 esphome/components/si4713_i2c/text/rds_text_text.h create mode 100644 esphome/components/si4713_i2c/text/text.h diff --git a/esphome/components/si4713_i2c/number/acomp_gain_number.cpp b/esphome/components/si4713_i2c/number/acomp_gain_number.cpp deleted file mode 100644 index fa3baf4e82..0000000000 --- a/esphome/components/si4713_i2c/number/acomp_gain_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "acomp_gain_number.h" - -namespace esphome { -namespace si4713 { - -void AcompGainNumber::control(float value) { - this->publish_state(value); - this->parent_->set_acomp_gain(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/acomp_gain_number.h b/esphome/components/si4713_i2c/number/acomp_gain_number.h deleted file mode 100644 index 4aa639ce0b..0000000000 --- a/esphome/components/si4713_i2c/number/acomp_gain_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class AcompGainNumber : public number::Number, public Parented { - public: - AcompGainNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/acomp_threshold_number.cpp b/esphome/components/si4713_i2c/number/acomp_threshold_number.cpp deleted file mode 100644 index 6c8603ed79..0000000000 --- a/esphome/components/si4713_i2c/number/acomp_threshold_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "acomp_threshold_number.h" - -namespace esphome { -namespace si4713 { - -void AcompThresholdNumber::control(float value) { - this->publish_state(value); - this->parent_->set_acomp_threshold(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/acomp_threshold_number.h b/esphome/components/si4713_i2c/number/acomp_threshold_number.h deleted file mode 100644 index 0c76e86bc5..0000000000 --- a/esphome/components/si4713_i2c/number/acomp_threshold_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class AcompThresholdNumber : public number::Number, public Parented { - public: - AcompThresholdNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/analog_level_number.cpp b/esphome/components/si4713_i2c/number/analog_level_number.cpp deleted file mode 100644 index b7ec0d1071..0000000000 --- a/esphome/components/si4713_i2c/number/analog_level_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "analog_level_number.h" - -namespace esphome { -namespace si4713 { - -void AnalogLevelNumber::control(float value) { - this->publish_state(value); - this->parent_->set_analog_level(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/analog_level_number.h b/esphome/components/si4713_i2c/number/analog_level_number.h deleted file mode 100644 index 12376f99e3..0000000000 --- a/esphome/components/si4713_i2c/number/analog_level_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class AnalogLevelNumber : public number::Number, public Parented { - public: - AnalogLevelNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/asq_duration_high_number.cpp b/esphome/components/si4713_i2c/number/asq_duration_high_number.cpp deleted file mode 100644 index 0d8832ba46..0000000000 --- a/esphome/components/si4713_i2c/number/asq_duration_high_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "asq_duration_high_number.h" - -namespace esphome { -namespace si4713 { - -void AsqDurationHighNumber::control(float value) { - this->publish_state(value); - this->parent_->set_asq_duration_high(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/asq_duration_high_number.h b/esphome/components/si4713_i2c/number/asq_duration_high_number.h deleted file mode 100644 index 6219a5021d..0000000000 --- a/esphome/components/si4713_i2c/number/asq_duration_high_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class AsqDurationHighNumber : public number::Number, public Parented { - public: - AsqDurationHighNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/asq_duration_low_number.cpp b/esphome/components/si4713_i2c/number/asq_duration_low_number.cpp deleted file mode 100644 index a8b352f92c..0000000000 --- a/esphome/components/si4713_i2c/number/asq_duration_low_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "asq_duration_low_number.h" - -namespace esphome { -namespace si4713 { - -void AsqDurationLowNumber::control(float value) { - this->publish_state(value); - this->parent_->set_asq_duration_low(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/asq_duration_low_number.h b/esphome/components/si4713_i2c/number/asq_duration_low_number.h deleted file mode 100644 index cea1d527b6..0000000000 --- a/esphome/components/si4713_i2c/number/asq_duration_low_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class AsqDurationLowNumber : public number::Number, public Parented { - public: - AsqDurationLowNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/asq_level_high_number.cpp b/esphome/components/si4713_i2c/number/asq_level_high_number.cpp deleted file mode 100644 index ddc01cda99..0000000000 --- a/esphome/components/si4713_i2c/number/asq_level_high_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "asq_level_high_number.h" - -namespace esphome { -namespace si4713 { - -void AsqLevelHighNumber::control(float value) { - this->publish_state(value); - this->parent_->set_asq_level_high(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/asq_level_high_number.h b/esphome/components/si4713_i2c/number/asq_level_high_number.h deleted file mode 100644 index 8db5dcb160..0000000000 --- a/esphome/components/si4713_i2c/number/asq_level_high_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class AsqLevelHighNumber : public number::Number, public Parented { - public: - AsqLevelHighNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/asq_level_low_number.cpp b/esphome/components/si4713_i2c/number/asq_level_low_number.cpp deleted file mode 100644 index de73a1036e..0000000000 --- a/esphome/components/si4713_i2c/number/asq_level_low_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "asq_level_low_number.h" - -namespace esphome { -namespace si4713 { - -void AsqLevelLowNumber::control(float value) { - this->publish_state(value); - this->parent_->set_asq_level_low(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/asq_level_low_number.h b/esphome/components/si4713_i2c/number/asq_level_low_number.h deleted file mode 100644 index ffdf97b114..0000000000 --- a/esphome/components/si4713_i2c/number/asq_level_low_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class AsqLevelLowNumber : public number::Number, public Parented { - public: - AsqLevelLowNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/digital_sample_rate_number.cpp b/esphome/components/si4713_i2c/number/digital_sample_rate_number.cpp deleted file mode 100644 index 484772a2a7..0000000000 --- a/esphome/components/si4713_i2c/number/digital_sample_rate_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "digital_sample_rate_number.h" - -namespace esphome { -namespace si4713 { - -void DigitalSampleRateNumber::control(float value) { - this->publish_state(value); - this->parent_->set_digital_sample_rate(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/digital_sample_rate_number.h b/esphome/components/si4713_i2c/number/digital_sample_rate_number.h deleted file mode 100644 index 2bf72453a3..0000000000 --- a/esphome/components/si4713_i2c/number/digital_sample_rate_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class DigitalSampleRateNumber : public number::Number, public Parented { - public: - DigitalSampleRateNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/limiter_release_time_number.cpp b/esphome/components/si4713_i2c/number/limiter_release_time_number.cpp deleted file mode 100644 index aa294c7454..0000000000 --- a/esphome/components/si4713_i2c/number/limiter_release_time_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "limiter_release_time_number.h" - -namespace esphome { -namespace si4713 { - -void LimiterReleaseTimeNumber::control(float value) { - this->publish_state(value); - this->parent_->set_limiter_release_time(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/limiter_release_time_number.h b/esphome/components/si4713_i2c/number/limiter_release_time_number.h deleted file mode 100644 index b56790635a..0000000000 --- a/esphome/components/si4713_i2c/number/limiter_release_time_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class LimiterReleaseTimeNumber : public number::Number, public Parented { - public: - LimiterReleaseTimeNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/number.h b/esphome/components/si4713_i2c/number/number.h new file mode 100644 index 0000000000..db4fb16cdb --- /dev/null +++ b/esphome/components/si4713_i2c/number/number.h @@ -0,0 +1,154 @@ +#pragma once + +#include "esphome/components/number/number.h" +#include "../si4713.h" + +namespace esphome { +namespace si4713 { + +class AcompGainNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_acomp_gain(value); + } +}; + +class AcompThresholdNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_acomp_threshold(value); + } +}; + +class AnalogLevelNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_analog_level(value); + } +}; + +class AsqDurationHighNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_asq_duration_high(value); + } +}; + +class AsqDurationLowNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_asq_duration_low(value); + } +}; + +class AsqLevelHighNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_asq_level_high(value); + } +}; + +class AsqLevelLowNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_asq_level_low(value); + } +}; + +class DigitalSampleRateNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_digital_sample_rate(value); + } +}; + +class LimiterReleaseTimeNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_limiter_release_time(value); + } +}; + +class PilotDeviationNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_pilot_deviation(value); + } +}; + +class PilotFrequencyNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_pilot_frequency(value); + } +}; + +class RdsDeviationNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_rds_deviation(value); + } +}; + +class RefClkFrequencyNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_refclk_frequency(value); + } +}; + +class RefClkPrescalerNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_refclk_prescaler(value); + } +}; + +class TunerAntcapNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_tuner_antcap(value); + } +}; + +class TunerDeviationNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_tuner_deviation(value); + } +}; + +class TunerFrequencyNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_tuner_frequency(value); + } +}; + +class TunerPowerNumber : public number::Number, public Parented { + protected: + void control(float value) override { + this->publish_state(value); + this->parent_->set_tuner_power(value); + } +}; + +} // namespace si4713 +} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/pilot_deviation_number.cpp b/esphome/components/si4713_i2c/number/pilot_deviation_number.cpp deleted file mode 100644 index a4d4457860..0000000000 --- a/esphome/components/si4713_i2c/number/pilot_deviation_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "pilot_deviation_number.h" - -namespace esphome { -namespace si4713 { - -void PilotDeviationNumber::control(float value) { - this->publish_state(value); - this->parent_->set_pilot_deviation(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/pilot_deviation_number.h b/esphome/components/si4713_i2c/number/pilot_deviation_number.h deleted file mode 100644 index b7529c5bef..0000000000 --- a/esphome/components/si4713_i2c/number/pilot_deviation_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class PilotDeviationNumber : public number::Number, public Parented { - public: - PilotDeviationNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/pilot_frequency_number.cpp b/esphome/components/si4713_i2c/number/pilot_frequency_number.cpp deleted file mode 100644 index 954902b060..0000000000 --- a/esphome/components/si4713_i2c/number/pilot_frequency_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "pilot_frequency_number.h" - -namespace esphome { -namespace si4713 { - -void PilotFrequencyNumber::control(float value) { - this->publish_state(value); - this->parent_->set_pilot_frequency(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/pilot_frequency_number.h b/esphome/components/si4713_i2c/number/pilot_frequency_number.h deleted file mode 100644 index 413e6473de..0000000000 --- a/esphome/components/si4713_i2c/number/pilot_frequency_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class PilotFrequencyNumber : public number::Number, public Parented { - public: - PilotFrequencyNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/rds_deviation_number.cpp b/esphome/components/si4713_i2c/number/rds_deviation_number.cpp deleted file mode 100644 index d5a96f06a9..0000000000 --- a/esphome/components/si4713_i2c/number/rds_deviation_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "rds_deviation_number.h" - -namespace esphome { -namespace si4713 { - -void RdsDeviationNumber::control(float value) { - this->publish_state(value); - this->parent_->set_rds_deviation(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/rds_deviation_number.h b/esphome/components/si4713_i2c/number/rds_deviation_number.h deleted file mode 100644 index cf916249af..0000000000 --- a/esphome/components/si4713_i2c/number/rds_deviation_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class RdsDeviationNumber : public number::Number, public Parented { - public: - RdsDeviationNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/refclk_frequency_number.cpp b/esphome/components/si4713_i2c/number/refclk_frequency_number.cpp deleted file mode 100644 index 10c8b23a55..0000000000 --- a/esphome/components/si4713_i2c/number/refclk_frequency_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "refclk_frequency_number.h" - -namespace esphome { -namespace si4713 { - -void RefClkFrequencyNumber::control(float value) { - this->publish_state(value); - this->parent_->set_refclk_frequency(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/refclk_frequency_number.h b/esphome/components/si4713_i2c/number/refclk_frequency_number.h deleted file mode 100644 index f6fa8c1753..0000000000 --- a/esphome/components/si4713_i2c/number/refclk_frequency_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class RefClkFrequencyNumber : public number::Number, public Parented { - public: - RefClkFrequencyNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/refclk_prescaler_number.cpp b/esphome/components/si4713_i2c/number/refclk_prescaler_number.cpp deleted file mode 100644 index 244889add9..0000000000 --- a/esphome/components/si4713_i2c/number/refclk_prescaler_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "refclk_prescaler_number.h" - -namespace esphome { -namespace si4713 { - -void RefClkPrescalerNumber::control(float value) { - this->publish_state(value); - this->parent_->set_refclk_prescaler(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/refclk_prescaler_number.h b/esphome/components/si4713_i2c/number/refclk_prescaler_number.h deleted file mode 100644 index ec449563b5..0000000000 --- a/esphome/components/si4713_i2c/number/refclk_prescaler_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class RefClkPrescalerNumber : public number::Number, public Parented { - public: - RefClkPrescalerNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/tuner_antcap_number.cpp b/esphome/components/si4713_i2c/number/tuner_antcap_number.cpp deleted file mode 100644 index 009dfc52a3..0000000000 --- a/esphome/components/si4713_i2c/number/tuner_antcap_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "tuner_antcap_number.h" - -namespace esphome { -namespace si4713 { - -void TunerAntcapNumber::control(float value) { - this->publish_state(value); - this->parent_->set_tuner_antcap(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/tuner_antcap_number.h b/esphome/components/si4713_i2c/number/tuner_antcap_number.h deleted file mode 100644 index 935e38e1c7..0000000000 --- a/esphome/components/si4713_i2c/number/tuner_antcap_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class TunerAntcapNumber : public number::Number, public Parented { - public: - TunerAntcapNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/tuner_deviation_number.cpp b/esphome/components/si4713_i2c/number/tuner_deviation_number.cpp deleted file mode 100644 index 5160f97074..0000000000 --- a/esphome/components/si4713_i2c/number/tuner_deviation_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "tuner_deviation_number.h" - -namespace esphome { -namespace si4713 { - -void TunerDeviationNumber::control(float value) { - this->publish_state(value); - this->parent_->set_tuner_deviation(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/tuner_deviation_number.h b/esphome/components/si4713_i2c/number/tuner_deviation_number.h deleted file mode 100644 index 788f69bf53..0000000000 --- a/esphome/components/si4713_i2c/number/tuner_deviation_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class TunerDeviationNumber : public number::Number, public Parented { - public: - TunerDeviationNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/tuner_frequency_number.cpp b/esphome/components/si4713_i2c/number/tuner_frequency_number.cpp deleted file mode 100644 index ebbd5febf0..0000000000 --- a/esphome/components/si4713_i2c/number/tuner_frequency_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "tuner_frequency_number.h" - -namespace esphome { -namespace si4713 { - -void TunerFrequencyNumber::control(float value) { - this->publish_state(value); - this->parent_->set_tuner_frequency(value); -} - -} // namespace si4713 -} // namespace esphome diff --git a/esphome/components/si4713_i2c/number/tuner_frequency_number.h b/esphome/components/si4713_i2c/number/tuner_frequency_number.h deleted file mode 100644 index 8992d61177..0000000000 --- a/esphome/components/si4713_i2c/number/tuner_frequency_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class TunerFrequencyNumber : public number::Number, public Parented { - public: - TunerFrequencyNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome diff --git a/esphome/components/si4713_i2c/number/tuner_power_number.cpp b/esphome/components/si4713_i2c/number/tuner_power_number.cpp deleted file mode 100644 index 3d16a2dbca..0000000000 --- a/esphome/components/si4713_i2c/number/tuner_power_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "tuner_power_number.h" - -namespace esphome { -namespace si4713 { - -void TunerPowerNumber::control(float value) { - this->publish_state(value); - this->parent_->set_tuner_power(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/number/tuner_power_number.h b/esphome/components/si4713_i2c/number/tuner_power_number.h deleted file mode 100644 index f23403f7c6..0000000000 --- a/esphome/components/si4713_i2c/number/tuner_power_number.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/number/number.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class TunerPowerNumber : public number::Number, public Parented { - public: - TunerPowerNumber() = default; - - protected: - void control(float value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/output/binary_output.cpp b/esphome/components/si4713_i2c/output/binary_output.cpp deleted file mode 100644 index fcfed6505c..0000000000 --- a/esphome/components/si4713_i2c/output/binary_output.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "binary_output.h" -#include "esphome/core/log.h" - -namespace esphome { -namespace si4713 { - -static const char *const TAG = "si4713"; - -void BinaryOutput::dump_config() { - ESP_LOGCONFIG(TAG, "Si4713 Output:"); - LOG_BINARY_OUTPUT(this); - ESP_LOGCONFIG(TAG, " Pin: %d", this->pin_); -} - -void BinaryOutput::write_state(bool state) { - this->parent_->set_output_gpio(this->pin_, state); -} - -} // namespace si4713 -} // namespace esphome - - - - - diff --git a/esphome/components/si4713_i2c/output/binary_output.h b/esphome/components/si4713_i2c/output/output.h similarity index 80% rename from esphome/components/si4713_i2c/output/binary_output.h rename to esphome/components/si4713_i2c/output/output.h index d97fff656b..40790a3200 100644 --- a/esphome/components/si4713_i2c/output/binary_output.h +++ b/esphome/components/si4713_i2c/output/output.h @@ -9,12 +9,12 @@ namespace si4713 { class BinaryOutput : public output::BinaryOutput, public Component, public Parented { public: - void dump_config() override; - void set_pin(uint8_t pin) { this->pin_ = pin - 1; } protected: - void write_state(bool state) override; + void write_state(bool state) override { + this->parent_->set_output_gpio(this->pin_, state); + } uint8_t pin_{0}; }; diff --git a/esphome/components/si4713_i2c/select/acomp_attack_select.cpp b/esphome/components/si4713_i2c/select/acomp_attack_select.cpp deleted file mode 100644 index 97ede8c835..0000000000 --- a/esphome/components/si4713_i2c/select/acomp_attack_select.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "acomp_attack_select.h" - -namespace esphome { -namespace si4713 { - -void AcompAttackSelect::control(const std::string &value) { - this->publish_state(value); - if (auto index = this->active_index()) { - this->parent_->set_acomp_attack((AcompAttack) *index); - } -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/acomp_attack_select.h b/esphome/components/si4713_i2c/select/acomp_attack_select.h deleted file mode 100644 index 77c74eac08..0000000000 --- a/esphome/components/si4713_i2c/select/acomp_attack_select.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/select/select.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class AcompAttackSelect : public select::Select, public Parented { - public: - AcompAttackSelect() = default; - - protected: - void control(const std::string &value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/acomp_preset_select.cpp b/esphome/components/si4713_i2c/select/acomp_preset_select.cpp deleted file mode 100644 index fa13abfbbb..0000000000 --- a/esphome/components/si4713_i2c/select/acomp_preset_select.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "acomp_preset_select.h" - -namespace esphome { -namespace si4713 { - -void AcompPresetSelect::control(const std::string &value) { - this->publish_state(value); - if (auto index = this->active_index()) { - this->parent_->set_acomp_preset((AcompPreset) *index); - } -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/acomp_preset_select.h b/esphome/components/si4713_i2c/select/acomp_preset_select.h deleted file mode 100644 index 5991c49c88..0000000000 --- a/esphome/components/si4713_i2c/select/acomp_preset_select.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/select/select.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class AcompPresetSelect : public select::Select, public Parented { - public: - AcompPresetSelect() = default; - - protected: - void control(const std::string &value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/acomp_release_select.cpp b/esphome/components/si4713_i2c/select/acomp_release_select.cpp deleted file mode 100644 index 789286c7e6..0000000000 --- a/esphome/components/si4713_i2c/select/acomp_release_select.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "acomp_release_select.h" - -namespace esphome { -namespace si4713 { - -void AcompReleaseSelect::control(const std::string &value) { - this->publish_state(value); - if (auto index = this->active_index()) { - this->parent_->set_acomp_release((AcompRelease) *index); - } -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/acomp_release_select.h b/esphome/components/si4713_i2c/select/acomp_release_select.h deleted file mode 100644 index 8c98d233a7..0000000000 --- a/esphome/components/si4713_i2c/select/acomp_release_select.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/select/select.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class AcompReleaseSelect : public select::Select, public Parented { - public: - AcompReleaseSelect() = default; - - protected: - void control(const std::string &value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/analog_attenuation_select.cpp b/esphome/components/si4713_i2c/select/analog_attenuation_select.cpp deleted file mode 100644 index 9fd406e09a..0000000000 --- a/esphome/components/si4713_i2c/select/analog_attenuation_select.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "analog_attenuation_select.h" - -namespace esphome { -namespace si4713 { - -void AnalogAttenuationSelect::control(const std::string &value) { - this->publish_state(value); - if (auto index = this->active_index()) { - this->parent_->set_analog_attenuation((LineAttenuation) *index); - } -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/analog_attenuation_select.h b/esphome/components/si4713_i2c/select/analog_attenuation_select.h deleted file mode 100644 index 77b8f14e7f..0000000000 --- a/esphome/components/si4713_i2c/select/analog_attenuation_select.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/select/select.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class AnalogAttenuationSelect : public select::Select, public Parented { - public: - AnalogAttenuationSelect() = default; - - protected: - void control(const std::string &value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/digital_channels_select.cpp b/esphome/components/si4713_i2c/select/digital_channels_select.cpp deleted file mode 100644 index 180399c81e..0000000000 --- a/esphome/components/si4713_i2c/select/digital_channels_select.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "digital_channels_select.h" - -namespace esphome { -namespace si4713 { - -void DigitalChannelsSelect::control(const std::string &value) { - this->publish_state(value); - if (auto index = this->active_index()) { - this->parent_->set_digital_channels((SampleChannels) *index); - } -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/digital_channels_select.h b/esphome/components/si4713_i2c/select/digital_channels_select.h deleted file mode 100644 index a7570f473f..0000000000 --- a/esphome/components/si4713_i2c/select/digital_channels_select.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/select/select.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class DigitalChannelsSelect : public select::Select, public Parented { - public: - DigitalChannelsSelect() = default; - - protected: - void control(const std::string &value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/digital_clock_edge_select.cpp b/esphome/components/si4713_i2c/select/digital_clock_edge_select.cpp deleted file mode 100644 index d9f01966b8..0000000000 --- a/esphome/components/si4713_i2c/select/digital_clock_edge_select.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "digital_clock_edge_select.h" - -namespace esphome { -namespace si4713 { - -void DigitalClockEdgeSelect::control(const std::string &value) { - this->publish_state(value); - if (auto index = this->active_index()) { - this->parent_->set_digital_clock_edge((DigitalClockEdge) *index); - } -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/digital_clock_edge_select.h b/esphome/components/si4713_i2c/select/digital_clock_edge_select.h deleted file mode 100644 index e6b013985b..0000000000 --- a/esphome/components/si4713_i2c/select/digital_clock_edge_select.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/select/select.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class DigitalClockEdgeSelect : public select::Select, public Parented { - public: - DigitalClockEdgeSelect() = default; - - protected: - void control(const std::string &value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/digital_mode_select.cpp b/esphome/components/si4713_i2c/select/digital_mode_select.cpp deleted file mode 100644 index 89ba5efe2b..0000000000 --- a/esphome/components/si4713_i2c/select/digital_mode_select.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "digital_mode_select.h" - -namespace esphome { -namespace si4713 { - -void DigitalModeSelect::control(const std::string &value) { - this->publish_state(value); - if (auto index = this->active_index()) { - this->parent_->set_digital_mode((DigitalMode) *index); - } -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/digital_mode_select.h b/esphome/components/si4713_i2c/select/digital_mode_select.h deleted file mode 100644 index c4ad7258fd..0000000000 --- a/esphome/components/si4713_i2c/select/digital_mode_select.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/select/select.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class DigitalModeSelect : public select::Select, public Parented { - public: - DigitalModeSelect() = default; - - protected: - void control(const std::string &value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/digital_sample_bits_select.cpp b/esphome/components/si4713_i2c/select/digital_sample_bits_select.cpp deleted file mode 100644 index 58a0491a74..0000000000 --- a/esphome/components/si4713_i2c/select/digital_sample_bits_select.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "digital_sample_bits_select.h" - -namespace esphome { -namespace si4713 { - -void DigitalSampleBitsSelect::control(const std::string &value) { - this->publish_state(value); - if (auto index = this->active_index()) { - this->parent_->set_digital_sample_bits((SampleBits) *index); - } -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/digital_sample_bits_select.h b/esphome/components/si4713_i2c/select/digital_sample_bits_select.h deleted file mode 100644 index 133d7b4e35..0000000000 --- a/esphome/components/si4713_i2c/select/digital_sample_bits_select.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/select/select.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class DigitalSampleBitsSelect : public select::Select, public Parented { - public: - DigitalSampleBitsSelect() = default; - - protected: - void control(const std::string &value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/pre_emphasis_select.cpp b/esphome/components/si4713_i2c/select/pre_emphasis_select.cpp deleted file mode 100644 index 6f9f58164d..0000000000 --- a/esphome/components/si4713_i2c/select/pre_emphasis_select.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "pre_emphasis_select.h" - -namespace esphome { -namespace si4713 { - -void PreEmphasisSelect::control(const std::string &value) { - this->publish_state(value); - if (auto index = this->active_index()) { - this->parent_->set_pre_emphasis((PreEmphasis) *index); - } -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/pre_emphasis_select.h b/esphome/components/si4713_i2c/select/pre_emphasis_select.h deleted file mode 100644 index 19ea13b656..0000000000 --- a/esphome/components/si4713_i2c/select/pre_emphasis_select.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/select/select.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class PreEmphasisSelect : public select::Select, public Parented { - public: - PreEmphasisSelect() = default; - - protected: - void control(const std::string &value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/refclk_source_select.cpp b/esphome/components/si4713_i2c/select/refclk_source_select.cpp deleted file mode 100644 index ba317290ed..0000000000 --- a/esphome/components/si4713_i2c/select/refclk_source_select.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "refclk_source_select.h" - -namespace esphome { -namespace si4713 { - -void RefClkSourceSelect::control(const std::string &value) { - this->publish_state(value); - if (auto index = this->active_index()) { - this->parent_->set_refclk_source((RefClkSource) *index); - } -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/refclk_source_select.h b/esphome/components/si4713_i2c/select/refclk_source_select.h deleted file mode 100644 index 2f8d48d133..0000000000 --- a/esphome/components/si4713_i2c/select/refclk_source_select.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/select/select.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class RefClkSourceSelect : public select::Select, public Parented { - public: - RefClkSourceSelect() = default; - - protected: - void control(const std::string &value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/select/select.h b/esphome/components/si4713_i2c/select/select.h new file mode 100644 index 0000000000..94e6e1fcfb --- /dev/null +++ b/esphome/components/si4713_i2c/select/select.h @@ -0,0 +1,111 @@ +#pragma once + +#include "esphome/components/select/select.h" +#include "../si4713.h" + +namespace esphome { +namespace si4713 { + +class AcompAttackSelect : public select::Select, public Parented { + protected: + void control(const std::string &value) override { + this->publish_state(value); + if (auto index = this->active_index()) { + this->parent_->set_acomp_attack((AcompAttack) *index); + } + } +}; + +class AcompPresetSelect : public select::Select, public Parented { + protected: + void control(const std::string &value) override { + this->publish_state(value); + if (auto index = this->active_index()) { + this->parent_->set_acomp_preset((AcompPreset) *index); + } + } +}; + +class AcompReleaseSelect : public select::Select, public Parented { + protected: + void control(const std::string &value) override { + this->publish_state(value); + if (auto index = this->active_index()) { + this->parent_->set_acomp_release((AcompRelease) *index); + } + } +}; + +class AnalogAttenuationSelect : public select::Select, public Parented { + protected: + void control(const std::string &value) override { + this->publish_state(value); + if (auto index = this->active_index()) { + this->parent_->set_analog_attenuation((LineAttenuation) *index); + } + } +}; + +class DigitalChannelsSelect : public select::Select, public Parented { + protected: + void control(const std::string &value) override { + this->publish_state(value); + if (auto index = this->active_index()) { + this->parent_->set_digital_channels((SampleChannels) *index); + } + } +}; + + +class DigitalClockEdgeSelect : public select::Select, public Parented { + protected: + void control(const std::string &value) override { + this->publish_state(value); + if (auto index = this->active_index()) { + this->parent_->set_digital_clock_edge((DigitalClockEdge) *index); + } + } +}; + +class DigitalModeSelect : public select::Select, public Parented { + protected: + void control(const std::string &value) override { + this->publish_state(value); + if (auto index = this->active_index()) { + this->parent_->set_digital_mode((DigitalMode) *index); + } + } +}; + +class DigitalSampleBitsSelect : public select::Select, public Parented { + protected: + void control(const std::string &value) override { + this->publish_state(value); + if (auto index = this->active_index()) { + this->parent_->set_digital_sample_bits((SampleBits) *index); + } + } +}; + +class PreEmphasisSelect : public select::Select, public Parented { + protected: + void control(const std::string &value) override { + this->publish_state(value); + if (auto index = this->active_index()) { + this->parent_->set_pre_emphasis((PreEmphasis) *index); + } + } +}; + +class RefClkSourceSelect : public select::Select, public Parented { + protected: + void control(const std::string &value) override { + this->publish_state(value); + if (auto index = this->active_index()) { + this->parent_->set_refclk_source((RefClkSource) *index); + } + } +}; + +} // namespace si4713 +} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/si4713.cpp b/esphome/components/si4713_i2c/si4713.cpp index e5a4ad0727..948431ef77 100644 --- a/esphome/components/si4713_i2c/si4713.cpp +++ b/esphome/components/si4713_i2c/si4713.cpp @@ -45,9 +45,9 @@ bool Si4713Component::send_cmd(const void *cmd, size_t cmd_size, void *res, size return false; } - uint8_t status = 0; - while (!(status & SI4710_STATUS_CTS)) { - err = this->read(&status, 1); // TODO: read res_size into res here? + ResBase status; + while(status.CTS == 0) { + err = this->read((uint8_t*) &status, 1); // TODO: read res_size into res here? if (err != i2c::ERROR_OK) { ESP_LOGE(TAG, "send_cmd(0x%02X, %d) read status error", buff[0], cmd_size); // this->mark_failed(); diff --git a/esphome/components/si4713_i2c/si4713defs.h b/esphome/components/si4713_i2c/si4713defs.h index b640fd9bc7..7bb4171351 100644 --- a/esphome/components/si4713_i2c/si4713defs.h +++ b/esphome/components/si4713_i2c/si4713defs.h @@ -3,8 +3,6 @@ namespace esphome { namespace si4713 { -static const uint8_t SI4710_STATUS_CTS = 0x80; - static const float FREQ_MIN = 76; static const float FREQ_MAX = 108; static const int FREQ_RAW_MIN = 7600; diff --git a/esphome/components/si4713_i2c/switch/__init__.py b/esphome/components/si4713_i2c/switch/__init__.py index cda9f66c5a..2f88057f56 100644 --- a/esphome/components/si4713_i2c/switch/__init__.py +++ b/esphome/components/si4713_i2c/switch/__init__.py @@ -174,33 +174,33 @@ CONFIG_SCHEMA = cv.Schema( VARIABLES = { None: [ - [CONF_MUTE, None], - [CONF_MONO, None], + [CONF_MUTE], + [CONF_MONO], ], CONF_TUNER: [ - [CONF_ENABLE, None], + [CONF_ENABLE], ], CONF_PILOT: [ - [CONF_ENABLE, None], + [CONF_ENABLE], ], CONF_ACOMP: [ - [CONF_ENABLE, None], + [CONF_ENABLE], ], CONF_LIMITER: [ - [CONF_ENABLE, None], + [CONF_ENABLE], ], CONF_ASQ: [ - [CONF_IALL, None], - [CONF_IALH, None], - [CONF_OVERMOD, None], + [CONF_IALL], + [CONF_IALH], + [CONF_OVERMOD], ], CONF_RDS: [ - [CONF_ENABLE, None], + [CONF_ENABLE], ], CONF_OUTPUT: [ - [CONF_GPIO1, lambda sw: sw.set_pin(1)], - [CONF_GPIO2, lambda sw: sw.set_pin(2)], - [CONF_GPIO3, lambda sw: sw.set_pin(3)], + [CONF_GPIO1], + [CONF_GPIO2], + [CONF_GPIO3], ], } @@ -211,8 +211,12 @@ async def to_code(config): async def new_switch(c, args, setter): s = await switch.new_switch(c) await cg.register_parented(s, parent) - sw = cg.add(getattr(parent, setter + "_switch")(s)) - if cb := s[1]: - cb(sw) + cg.add(getattr(parent, setter + "_switch")(s)) + if args[0] == CONF_GPIO1: + cg.add(s.set_pin(1)) + elif args[0] == CONF_GPIO2: + cg.add(s.set_pin(2)) + elif args[0] == CONF_GPIO3: + cg.add(s.set_pin(3)) await for_each_conf(config, VARIABLES, new_switch) diff --git a/esphome/components/si4713_i2c/switch/acomp_enable_switch.cpp b/esphome/components/si4713_i2c/switch/acomp_enable_switch.cpp deleted file mode 100644 index 132be0ad0a..0000000000 --- a/esphome/components/si4713_i2c/switch/acomp_enable_switch.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "acomp_enable_switch.h" - -namespace esphome { -namespace si4713 { - -void AcompEnableSwitch::write_state(bool value) { - this->publish_state(value); - this->parent_->set_acomp_enable(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/switch/acomp_enable_switch.h b/esphome/components/si4713_i2c/switch/acomp_enable_switch.h deleted file mode 100644 index f91ebe5f1c..0000000000 --- a/esphome/components/si4713_i2c/switch/acomp_enable_switch.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/switch/switch.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class AcompEnableSwitch : public switch_::Switch, public Parented { - public: - AcompEnableSwitch() = default; - - protected: - void write_state(bool value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/switch/asq_ialh_switch.cpp b/esphome/components/si4713_i2c/switch/asq_ialh_switch.cpp deleted file mode 100644 index 0c7e3643e0..0000000000 --- a/esphome/components/si4713_i2c/switch/asq_ialh_switch.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "asq_ialh_switch.h" - -namespace esphome { -namespace si4713 { - -void AsqIalhSwitch::write_state(bool value) { - this->publish_state(value); - this->parent_->set_asq_ialh(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/switch/asq_ialh_switch.h b/esphome/components/si4713_i2c/switch/asq_ialh_switch.h deleted file mode 100644 index 90e81179a6..0000000000 --- a/esphome/components/si4713_i2c/switch/asq_ialh_switch.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/switch/switch.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class AsqIalhSwitch : public switch_::Switch, public Parented { - public: - AsqIalhSwitch() = default; - - protected: - void write_state(bool value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/switch/asq_iall_switch.cpp b/esphome/components/si4713_i2c/switch/asq_iall_switch.cpp deleted file mode 100644 index 8e6068061a..0000000000 --- a/esphome/components/si4713_i2c/switch/asq_iall_switch.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "asq_iall_switch.h" - -namespace esphome { -namespace si4713 { - -void AsqIallSwitch::write_state(bool value) { - this->publish_state(value); - this->parent_->set_asq_iall(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/switch/asq_iall_switch.h b/esphome/components/si4713_i2c/switch/asq_iall_switch.h deleted file mode 100644 index 543b781baf..0000000000 --- a/esphome/components/si4713_i2c/switch/asq_iall_switch.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/switch/switch.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class AsqIallSwitch : public switch_::Switch, public Parented { - public: - AsqIallSwitch() = default; - - protected: - void write_state(bool value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/switch/asq_overmod_switch.cpp b/esphome/components/si4713_i2c/switch/asq_overmod_switch.cpp deleted file mode 100644 index 6e836844d2..0000000000 --- a/esphome/components/si4713_i2c/switch/asq_overmod_switch.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "asq_overmod_switch.h" - -namespace esphome { -namespace si4713 { - -void AsqOvermodSwitch::write_state(bool value) { - this->publish_state(value); - this->parent_->set_asq_overmod(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/switch/asq_overmod_switch.h b/esphome/components/si4713_i2c/switch/asq_overmod_switch.h deleted file mode 100644 index 98ff5fd7c2..0000000000 --- a/esphome/components/si4713_i2c/switch/asq_overmod_switch.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/switch/switch.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class AsqOvermodSwitch : public switch_::Switch, public Parented { - public: - AsqOvermodSwitch() = default; - - protected: - void write_state(bool value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/switch/limiter_enable_switch.cpp b/esphome/components/si4713_i2c/switch/limiter_enable_switch.cpp deleted file mode 100644 index f1530fb2c3..0000000000 --- a/esphome/components/si4713_i2c/switch/limiter_enable_switch.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "limiter_enable_switch.h" - -namespace esphome { -namespace si4713 { - -void LimiterEnableSwitch::write_state(bool value) { - this->publish_state(value); - this->parent_->set_limiter_enable(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/switch/limiter_enable_switch.h b/esphome/components/si4713_i2c/switch/limiter_enable_switch.h deleted file mode 100644 index 6a445a4197..0000000000 --- a/esphome/components/si4713_i2c/switch/limiter_enable_switch.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/switch/switch.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class LimiterEnableSwitch : public switch_::Switch, public Parented { - public: - LimiterEnableSwitch() = default; - - protected: - void write_state(bool value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/switch/mono_switch.cpp b/esphome/components/si4713_i2c/switch/mono_switch.cpp deleted file mode 100644 index f6d9068669..0000000000 --- a/esphome/components/si4713_i2c/switch/mono_switch.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "mono_switch.h" - -namespace esphome { -namespace si4713 { - -void MonoSwitch::write_state(bool value) { - this->publish_state(value); - this->parent_->set_mono(value); -} - -} // namespace si4713 -} // namespace esphome diff --git a/esphome/components/si4713_i2c/switch/mono_switch.h b/esphome/components/si4713_i2c/switch/mono_switch.h deleted file mode 100644 index 450131e037..0000000000 --- a/esphome/components/si4713_i2c/switch/mono_switch.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/switch/switch.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class MonoSwitch : public switch_::Switch, public Parented { - public: - MonoSwitch() = default; - - protected: - void write_state(bool value) override; -}; - -} // namespace si4713 -} // namespace esphome diff --git a/esphome/components/si4713_i2c/switch/mute_switch.cpp b/esphome/components/si4713_i2c/switch/mute_switch.cpp deleted file mode 100644 index 425b0f3fcf..0000000000 --- a/esphome/components/si4713_i2c/switch/mute_switch.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "mute_switch.h" - -namespace esphome { -namespace si4713 { - -void MuteSwitch::write_state(bool value) { - this->publish_state(value); - this->parent_->set_mute(value); -} - -} // namespace si4713 -} // namespace esphome diff --git a/esphome/components/si4713_i2c/switch/mute_switch.h b/esphome/components/si4713_i2c/switch/mute_switch.h deleted file mode 100644 index a4f69a4d57..0000000000 --- a/esphome/components/si4713_i2c/switch/mute_switch.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/switch/switch.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class MuteSwitch : public switch_::Switch, public Parented { - public: - MuteSwitch() = default; - - protected: - void write_state(bool value) override; -}; - -} // namespace si4713 -} // namespace esphome diff --git a/esphome/components/si4713_i2c/switch/output_gpio_switch.cpp b/esphome/components/si4713_i2c/switch/output_gpio_switch.cpp deleted file mode 100644 index 39342eb2c0..0000000000 --- a/esphome/components/si4713_i2c/switch/output_gpio_switch.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "output_gpio_switch.h" - -namespace esphome { -namespace si4713 { - -void OutputGpioSwitch::write_state(bool value) { - this->publish_state(value); - this->parent_->set_output_gpio(this->pin_, value); -} - -} // namespace si4713 -} // namespace esphome diff --git a/esphome/components/si4713_i2c/switch/output_gpio_switch.h b/esphome/components/si4713_i2c/switch/output_gpio_switch.h deleted file mode 100644 index 568299b297..0000000000 --- a/esphome/components/si4713_i2c/switch/output_gpio_switch.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include "esphome/components/switch/switch.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class OutputGpioSwitch : public switch_::Switch, public Parented { - public: - OutputGpioSwitch() = default; - - void set_pin(uint8_t pin) { this->pin_ = pin - 1; } - - protected: - void write_state(bool value) override; - - uint8_t pin_{0}; -}; - -} // namespace si4713 -} // namespace esphome diff --git a/esphome/components/si4713_i2c/switch/pilot_enable_switch.cpp b/esphome/components/si4713_i2c/switch/pilot_enable_switch.cpp deleted file mode 100644 index ea6c26ce09..0000000000 --- a/esphome/components/si4713_i2c/switch/pilot_enable_switch.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "pilot_enable_switch.h" - -namespace esphome { -namespace si4713 { - -void PilotEnableSwitch::write_state(bool value) { - this->publish_state(value); - this->parent_->set_pilot_enable(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/switch/pilot_enable_switch.h b/esphome/components/si4713_i2c/switch/pilot_enable_switch.h deleted file mode 100644 index 271bbbfab9..0000000000 --- a/esphome/components/si4713_i2c/switch/pilot_enable_switch.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/switch/switch.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class PilotEnableSwitch : public switch_::Switch, public Parented { - public: - PilotEnableSwitch() = default; - - protected: - void write_state(bool value) override; -}; - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/switch/rds_enable_switch.cpp b/esphome/components/si4713_i2c/switch/rds_enable_switch.cpp deleted file mode 100644 index a42b20e0b5..0000000000 --- a/esphome/components/si4713_i2c/switch/rds_enable_switch.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "rds_enable_switch.h" - -namespace esphome { -namespace si4713 { - -void RDSEnableSwitch::write_state(bool value) { - this->publish_state(value); - this->parent_->set_rds_enable(value); -} - -} // namespace si4713 -} // namespace esphome diff --git a/esphome/components/si4713_i2c/switch/rds_enable_switch.h b/esphome/components/si4713_i2c/switch/rds_enable_switch.h deleted file mode 100644 index 5622af1662..0000000000 --- a/esphome/components/si4713_i2c/switch/rds_enable_switch.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/switch/switch.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class RDSEnableSwitch : public switch_::Switch, public Parented { - public: - RDSEnableSwitch() = default; - - protected: - void write_state(bool value) override; -}; - -} // namespace si4713 -} // namespace esphome diff --git a/esphome/components/si4713_i2c/switch/switch.h b/esphome/components/si4713_i2c/switch/switch.h new file mode 100644 index 0000000000..68921b30d5 --- /dev/null +++ b/esphome/components/si4713_i2c/switch/switch.h @@ -0,0 +1,103 @@ +#pragma once + +#include "esphome/components/switch/switch.h" +#include "../si4713.h" + +namespace esphome { +namespace si4713 { + +class AcompEnableSwitch : public switch_::Switch, public Parented { + protected: + void write_state(bool value) override { + this->publish_state(value); + this->parent_->set_acomp_enable(value); + } +}; + +class AsqIalhSwitch : public switch_::Switch, public Parented { + protected: + void write_state(bool value) override { + this->publish_state(value); + this->parent_->set_asq_ialh(value); + } +}; + +class AsqIallSwitch : public switch_::Switch, public Parented { + protected: + void write_state(bool value) override { + this->publish_state(value); + this->parent_->set_asq_iall(value); + } +}; + +class AsqOvermodSwitch : public switch_::Switch, public Parented { + protected: + void write_state(bool value) override { + this->publish_state(value); + this->parent_->set_asq_overmod(value); + } +}; + +class LimiterEnableSwitch : public switch_::Switch, public Parented { + protected: + void write_state(bool value) override { + this->publish_state(value); + this->parent_->set_limiter_enable(value); + } +}; + +class MonoSwitch : public switch_::Switch, public Parented { + protected: + void write_state(bool value) override { + this->publish_state(value); + this->parent_->set_mono(value); + } +}; + +class MuteSwitch : public switch_::Switch, public Parented { + protected: + void write_state(bool value) override { + this->publish_state(value); + this->parent_->set_mute(value); + } +}; + +class OutputGpioSwitch : public switch_::Switch, public Parented { + public: + void set_pin(uint8_t pin) { this->pin_ = pin - 1; } + + protected: + void write_state(bool value) override { + this->publish_state(value); + this->parent_->set_output_gpio(this->pin_, value); + } + + uint8_t pin_{0}; +}; + +class PilotEnableSwitch : public switch_::Switch, public Parented { + protected: + void write_state(bool value) override { + this->publish_state(value); + this->parent_->set_pilot_enable(value); + } +}; + +class RDSEnableSwitch : public switch_::Switch, public Parented { + protected: + void write_state(bool value) override { + this->publish_state(value); + this->parent_->set_rds_enable(value); + } +}; + +class TunerEnableSwitch : public switch_::Switch, public Parented { + protected: + void write_state(bool value) override { + this->publish_state(value); + this->parent_->set_tuner_enable(value); + } +}; + +} // namespace si4713 +} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/switch/tuner_enable_switch.cpp b/esphome/components/si4713_i2c/switch/tuner_enable_switch.cpp deleted file mode 100644 index 3dd90cb572..0000000000 --- a/esphome/components/si4713_i2c/switch/tuner_enable_switch.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "tuner_enable_switch.h" - -namespace esphome { -namespace si4713 { - -void TunerEnableSwitch::write_state(bool value) { - this->publish_state(value); - this->parent_->set_tuner_enable(value); -} - -} // namespace si4713 -} // namespace esphome \ No newline at end of file diff --git a/esphome/components/si4713_i2c/switch/tuner_enable_switch.h b/esphome/components/si4713_i2c/switch/tuner_enable_switch.h deleted file mode 100644 index b781cb89be..0000000000 --- a/esphome/components/si4713_i2c/switch/tuner_enable_switch.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/switch/switch.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class TunerEnableSwitch : public switch_::Switch, public Parented { - public: - TunerEnableSwitch() = default; - - protected: - void write_state(bool value) override; -}; - -} // namespace si4713 -} // namespace esphome diff --git a/esphome/components/si4713_i2c/text/rds_station_text.cpp b/esphome/components/si4713_i2c/text/rds_station_text.cpp deleted file mode 100644 index 5049443b82..0000000000 --- a/esphome/components/si4713_i2c/text/rds_station_text.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "rds_station_text.h" - -namespace esphome { -namespace si4713 { - -void RDSStationText::control(const std::string &value) { - this->publish_state(value); - this->parent_->set_rds_station(value); -} - -} // namespace si4713 -} // namespace esphome diff --git a/esphome/components/si4713_i2c/text/rds_station_text.h b/esphome/components/si4713_i2c/text/rds_station_text.h deleted file mode 100644 index d49a23c66f..0000000000 --- a/esphome/components/si4713_i2c/text/rds_station_text.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/text/text.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class RDSStationText : public text::Text, public Parented { - public: - RDSStationText() = default; - - protected: - void control(const std::string &value) override; -}; - -} // namespace si4713 -} // namespace esphome diff --git a/esphome/components/si4713_i2c/text/rds_text_text.cpp b/esphome/components/si4713_i2c/text/rds_text_text.cpp deleted file mode 100644 index b4e94102f6..0000000000 --- a/esphome/components/si4713_i2c/text/rds_text_text.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "rds_text_text.h" - -namespace esphome { -namespace si4713 { - -void RDSTextText::control(const std::string &value) { - this->publish_state(value); - this->parent_->set_rds_text(value); -} - -} // namespace si4713 -} // namespace esphome diff --git a/esphome/components/si4713_i2c/text/rds_text_text.h b/esphome/components/si4713_i2c/text/rds_text_text.h deleted file mode 100644 index fd9ba83e8b..0000000000 --- a/esphome/components/si4713_i2c/text/rds_text_text.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "esphome/components/text/text.h" -#include "../si4713.h" - -namespace esphome { -namespace si4713 { - -class RDSTextText : public text::Text, public Parented { - public: - RDSTextText() = default; - - protected: - void control(const std::string &value) override; -}; - -} // namespace si4713 -} // namespace esphome diff --git a/esphome/components/si4713_i2c/text/text.h b/esphome/components/si4713_i2c/text/text.h new file mode 100644 index 0000000000..2136ad0b5d --- /dev/null +++ b/esphome/components/si4713_i2c/text/text.h @@ -0,0 +1,26 @@ +#pragma once + +#include "esphome/components/text/text.h" +#include "../si4713.h" + +namespace esphome { +namespace si4713 { + +class RDSStationText : public text::Text, public Parented { + protected: + void control(const std::string &value) override { + this->publish_state(value); + this->parent_->set_rds_station(value); + } +}; + +class RDSTextText : public text::Text, public Parented { + protected: + void control(const std::string &value) override { + this->publish_state(value); + this->parent_->set_rds_text(value); + } +}; + +} // namespace si4713 +} // namespace esphome