mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 11:25:35 +00:00
Mark user-configurable classes as final (part 17/21)
Add the C++ `final` specifier to leaf, user-configurable component classes and automation action/trigger/condition primitives so that classes meant to be terminal cannot be subclassed by external components. Only classes never used as a base anywhere in the tree are marked. Part 17 of 21, split alphabetically by component (ssd1351_spi .. tem3200).
This commit is contained in:
@@ -6,9 +6,9 @@
|
||||
|
||||
namespace esphome::ssd1351_spi {
|
||||
|
||||
class SPISSD1351 : public ssd1351_base::SSD1351,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
|
||||
spi::DATA_RATE_8MHZ> {
|
||||
class SPISSD1351 final : public ssd1351_base::SSD1351,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_8MHZ> {
|
||||
public:
|
||||
void set_dc_pin(GPIOPin *dc_pin) { dc_pin_ = dc_pin; }
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::st7567_i2c {
|
||||
|
||||
class I2CST7567 : public st7567_base::ST7567, public i2c::I2CDevice {
|
||||
class I2CST7567 final : public st7567_base::ST7567, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
namespace esphome::st7567_spi {
|
||||
|
||||
class SPIST7567 : public st7567_base::ST7567,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
|
||||
spi::DATA_RATE_8MHZ> {
|
||||
class SPIST7567 final : public st7567_base::ST7567,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_8MHZ> {
|
||||
public:
|
||||
void set_dc_pin(GPIOPin *dc_pin) { dc_pin_ = dc_pin; }
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ const uint8_t CMD2_BKSEL = 0xFF;
|
||||
const uint8_t CMD2_BK0[5] = {0x77, 0x01, 0x00, 0x00, 0x10};
|
||||
const uint8_t ST7701S_DELAY_FLAG = 0xFF;
|
||||
|
||||
class ST7701S : public display::Display,
|
||||
class ST7701S final : public display::Display,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
|
||||
spi::DATA_RATE_1MHZ> {
|
||||
public:
|
||||
|
||||
@@ -31,7 +31,7 @@ enum ST7735Model {
|
||||
ST7735_INITR_18REDTAB = INITR_18REDTAB
|
||||
};
|
||||
|
||||
class ST7735 : public display::DisplayBuffer,
|
||||
class ST7735 final : public display::DisplayBuffer,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
|
||||
spi::DATA_RATE_8MHZ> {
|
||||
public:
|
||||
|
||||
@@ -106,7 +106,7 @@ static const uint8_t ST7789_MADCTL_GS = 0x01;
|
||||
|
||||
static const uint8_t ST7789_MADCTL_COLOR_ORDER = ST7789_MADCTL_BGR;
|
||||
|
||||
class ST7789V : public display::DisplayBuffer,
|
||||
class ST7789V final : public display::DisplayBuffer,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
|
||||
spi::DATA_RATE_20MHZ> {
|
||||
public:
|
||||
|
||||
@@ -10,9 +10,9 @@ class ST7920;
|
||||
|
||||
using st7920_writer_t = display::DisplayWriter<ST7920>;
|
||||
|
||||
class ST7920 : public display::DisplayBuffer,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
|
||||
spi::DATA_RATE_200KHZ> {
|
||||
class ST7920 final : public display::DisplayBuffer,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_200KHZ> {
|
||||
public:
|
||||
void set_writer(st7920_writer_t &&writer) { this->writer_local_ = writer; }
|
||||
void set_height(uint16_t height) { this->height_ = height; }
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
namespace esphome::statsd {
|
||||
|
||||
class StatsdComponent : public PollingComponent {
|
||||
class StatsdComponent final : public PollingComponent {
|
||||
public:
|
||||
~StatsdComponent();
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::status {
|
||||
|
||||
class StatusBinarySensor : public binary_sensor::BinarySensor, public PollingComponent {
|
||||
class StatusBinarySensor final : public binary_sensor::BinarySensor, public PollingComponent {
|
||||
public:
|
||||
void update() override;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::status_led {
|
||||
|
||||
class StatusLEDLightOutput : public light::LightOutput, public Component {
|
||||
class StatusLEDLightOutput final : public light::LightOutput, public Component {
|
||||
public:
|
||||
void set_pin(GPIOPin *pin) { pin_ = pin; }
|
||||
void set_output(output::BinaryOutput *output) { output_ = output; }
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::status_led {
|
||||
|
||||
class StatusLED : public Component {
|
||||
class StatusLED final : public Component {
|
||||
public:
|
||||
explicit StatusLED(GPIOPin *pin);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class Stepper {
|
||||
uint32_t last_step_{0};
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetTargetAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SetTargetAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit SetTargetAction(Stepper *parent) : parent_(parent) {}
|
||||
|
||||
@@ -49,7 +49,7 @@ template<typename... Ts> class SetTargetAction : public Action<Ts...> {
|
||||
Stepper *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class ReportPositionAction : public Action<Ts...> {
|
||||
template<typename... Ts> class ReportPositionAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit ReportPositionAction(Stepper *parent) : parent_(parent) {}
|
||||
|
||||
@@ -61,7 +61,7 @@ template<typename... Ts> class ReportPositionAction : public Action<Ts...> {
|
||||
Stepper *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetSpeedAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SetSpeedAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit SetSpeedAction(Stepper *parent) : parent_(parent) {}
|
||||
|
||||
@@ -77,7 +77,7 @@ template<typename... Ts> class SetSpeedAction : public Action<Ts...> {
|
||||
Stepper *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetAccelerationAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SetAccelerationAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit SetAccelerationAction(Stepper *parent) : parent_(parent) {}
|
||||
|
||||
@@ -92,7 +92,7 @@ template<typename... Ts> class SetAccelerationAction : public Action<Ts...> {
|
||||
Stepper *parent_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetDecelerationAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SetDecelerationAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit SetDecelerationAction(Stepper *parent) : parent_(parent) {}
|
||||
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
namespace esphome::sts3x {
|
||||
|
||||
/// This class implements support for the ST3x-DIS family of temperature i2c sensors.
|
||||
class STS3XComponent : public sensor::Sensor, public PollingComponent, public sensirion_common::SensirionI2CDevice {
|
||||
class STS3XComponent final : public sensor::Sensor,
|
||||
public PollingComponent,
|
||||
public sensirion_common::SensirionI2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::stts22h {
|
||||
|
||||
class STTS22HComponent : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
class STTS22HComponent final : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void update() override;
|
||||
|
||||
@@ -11,7 +11,7 @@ enum SensorType {
|
||||
SUN_SENSOR_AZIMUTH,
|
||||
};
|
||||
|
||||
class SunSensor : public sensor::Sensor, public PollingComponent {
|
||||
class SunSensor final : public sensor::Sensor, public PollingComponent {
|
||||
public:
|
||||
void set_parent(Sun *parent) { parent_ = parent; }
|
||||
void set_type(SensorType type) { type_ = type; }
|
||||
|
||||
@@ -51,7 +51,7 @@ struct HorizontalCoordinate {
|
||||
|
||||
} // namespace internal
|
||||
|
||||
class Sun {
|
||||
class Sun final {
|
||||
public:
|
||||
void set_time(time::RealTimeClock *time) { time_ = time; }
|
||||
time::RealTimeClock *get_time() const { return time_; }
|
||||
@@ -78,7 +78,7 @@ class Sun {
|
||||
internal::GeoLocation location_;
|
||||
};
|
||||
|
||||
class SunTrigger : public Trigger<>, public PollingComponent, public Parented<Sun> {
|
||||
class SunTrigger final : public Trigger<>, public PollingComponent, public Parented<Sun> {
|
||||
public:
|
||||
SunTrigger() : PollingComponent(60000) {}
|
||||
|
||||
@@ -109,7 +109,7 @@ class SunTrigger : public Trigger<>, public PollingComponent, public Parented<Su
|
||||
double elevation_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SunCondition : public Condition<Ts...>, public Parented<Sun> {
|
||||
template<typename... Ts> class SunCondition final : public Condition<Ts...>, public Parented<Sun> {
|
||||
public:
|
||||
TEMPLATABLE_VALUE(double, elevation);
|
||||
void set_above(bool above) { above_ = above; }
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace esphome::sun {
|
||||
|
||||
class SunTextSensor : public text_sensor::TextSensor, public PollingComponent {
|
||||
class SunTextSensor final : public text_sensor::TextSensor, public PollingComponent {
|
||||
public:
|
||||
void set_parent(Sun *parent) { parent_ = parent; }
|
||||
void set_elevation(double elevation) { elevation_ = elevation; }
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace esphome::sun_gtil2 {
|
||||
|
||||
class SunGTIL2 : public Component, public uart::UARTDevice {
|
||||
class SunGTIL2 final : public Component, public uart::UARTDevice {
|
||||
public:
|
||||
float get_setup_priority() const override { return setup_priority::LATE; }
|
||||
void setup() override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::switch_ {
|
||||
|
||||
template<typename... Ts> class TurnOnAction : public Action<Ts...> {
|
||||
template<typename... Ts> class TurnOnAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit TurnOnAction(Switch *a_switch) : switch_(a_switch) {}
|
||||
|
||||
@@ -16,7 +16,7 @@ template<typename... Ts> class TurnOnAction : public Action<Ts...> {
|
||||
Switch *switch_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class TurnOffAction : public Action<Ts...> {
|
||||
template<typename... Ts> class TurnOffAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit TurnOffAction(Switch *a_switch) : switch_(a_switch) {}
|
||||
|
||||
@@ -26,7 +26,7 @@ template<typename... Ts> class TurnOffAction : public Action<Ts...> {
|
||||
Switch *switch_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class ToggleAction : public Action<Ts...> {
|
||||
template<typename... Ts> class ToggleAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit ToggleAction(Switch *a_switch) : switch_(a_switch) {}
|
||||
|
||||
@@ -36,7 +36,7 @@ template<typename... Ts> class ToggleAction : public Action<Ts...> {
|
||||
Switch *switch_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class ControlAction : public Action<Ts...> {
|
||||
template<typename... Ts> class ControlAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit ControlAction(Switch *a_switch) : switch_(a_switch) {}
|
||||
|
||||
@@ -53,7 +53,7 @@ template<typename... Ts> class ControlAction : public Action<Ts...> {
|
||||
Switch *switch_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SwitchCondition : public Condition<Ts...> {
|
||||
template<typename... Ts> class SwitchCondition final : public Condition<Ts...> {
|
||||
public:
|
||||
SwitchCondition(Switch *parent, bool state) : parent_(parent), state_(state) {}
|
||||
bool check(const Ts &...x) override { return this->parent_->state == this->state_; }
|
||||
@@ -63,14 +63,14 @@ template<typename... Ts> class SwitchCondition : public Condition<Ts...> {
|
||||
bool state_;
|
||||
};
|
||||
|
||||
class SwitchStateTrigger : public Trigger<bool> {
|
||||
class SwitchStateTrigger final : public Trigger<bool> {
|
||||
public:
|
||||
SwitchStateTrigger(Switch *a_switch) {
|
||||
a_switch->add_on_state_callback([this](bool state) { this->trigger(state); });
|
||||
}
|
||||
};
|
||||
|
||||
class SwitchTurnOnTrigger : public Trigger<> {
|
||||
class SwitchTurnOnTrigger final : public Trigger<> {
|
||||
public:
|
||||
SwitchTurnOnTrigger(Switch *a_switch) {
|
||||
a_switch->add_on_state_callback([this](bool state) {
|
||||
@@ -81,7 +81,7 @@ class SwitchTurnOnTrigger : public Trigger<> {
|
||||
}
|
||||
};
|
||||
|
||||
class SwitchTurnOffTrigger : public Trigger<> {
|
||||
class SwitchTurnOffTrigger final : public Trigger<> {
|
||||
public:
|
||||
SwitchTurnOffTrigger(Switch *a_switch) {
|
||||
a_switch->add_on_state_callback([this](bool state) {
|
||||
@@ -92,7 +92,7 @@ class SwitchTurnOffTrigger : public Trigger<> {
|
||||
}
|
||||
};
|
||||
|
||||
template<typename... Ts> class SwitchPublishAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SwitchPublishAction final : public Action<Ts...> {
|
||||
public:
|
||||
SwitchPublishAction(Switch *a_switch) : switch_(a_switch) {}
|
||||
TEMPLATABLE_VALUE(bool, state)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::switch_ {
|
||||
|
||||
class SwitchBinarySensor : public binary_sensor::BinarySensor, public Component {
|
||||
class SwitchBinarySensor final : public binary_sensor::BinarySensor, public Component {
|
||||
public:
|
||||
void set_source(Switch *source) { source_ = source; }
|
||||
void setup() override;
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
|
||||
namespace esphome::sx126x {
|
||||
|
||||
template<typename... Ts> class RunImageCalAction : public Action<Ts...>, public Parented<SX126x> {
|
||||
template<typename... Ts> class RunImageCalAction final : public Action<Ts...>, public Parented<SX126x> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->run_image_cal(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class SendPacketAction : public Action<Ts...>, public Parented<SX126x> {
|
||||
template<typename... Ts> class SendPacketAction final : public Action<Ts...>, public Parented<SX126x> {
|
||||
public:
|
||||
void set_data_template(std::vector<uint8_t> (*func)(Ts...)) {
|
||||
this->data_.func = func;
|
||||
@@ -43,23 +43,23 @@ template<typename... Ts> class SendPacketAction : public Action<Ts...>, public P
|
||||
} data_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetModeTxAction : public Action<Ts...>, public Parented<SX126x> {
|
||||
template<typename... Ts> class SetModeTxAction final : public Action<Ts...>, public Parented<SX126x> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->set_mode_tx(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetModeRxAction : public Action<Ts...>, public Parented<SX126x> {
|
||||
template<typename... Ts> class SetModeRxAction final : public Action<Ts...>, public Parented<SX126x> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->set_mode_rx(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetModeSleepAction : public Action<Ts...>, public Parented<SX126x> {
|
||||
template<typename... Ts> class SetModeSleepAction final : public Action<Ts...>, public Parented<SX126x> {
|
||||
public:
|
||||
TEMPLATABLE_VALUE(bool, cold)
|
||||
void play(const Ts &...x) override { this->parent_->set_mode_sleep(this->cold_.value(x...)); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetModeStandbyAction : public Action<Ts...>, public Parented<SX126x> {
|
||||
template<typename... Ts> class SetModeStandbyAction final : public Action<Ts...>, public Parented<SX126x> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->set_mode_standby(STDBY_XOSC); }
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::sx126x {
|
||||
|
||||
class SX126xTransport : public packet_transport::PacketTransport, public Parented<SX126x>, public SX126xListener {
|
||||
class SX126xTransport final : public packet_transport::PacketTransport, public Parented<SX126x>, public SX126xListener {
|
||||
public:
|
||||
void setup() override;
|
||||
void on_packet(const std::vector<uint8_t> &packet, float rssi, float snr) override;
|
||||
|
||||
@@ -53,7 +53,7 @@ class SX126xListener {
|
||||
virtual void on_packet(const std::vector<uint8_t> &packet, float rssi, float snr) = 0;
|
||||
};
|
||||
|
||||
class SX126x : public Component,
|
||||
class SX126x final : public Component,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
|
||||
spi::DATA_RATE_8MHZ> {
|
||||
public:
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
|
||||
namespace esphome::sx127x {
|
||||
|
||||
template<typename... Ts> class RunImageCalAction : public Action<Ts...>, public Parented<SX127x> {
|
||||
template<typename... Ts> class RunImageCalAction final : public Action<Ts...>, public Parented<SX127x> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->run_image_cal(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class SendPacketAction : public Action<Ts...>, public Parented<SX127x> {
|
||||
template<typename... Ts> class SendPacketAction final : public Action<Ts...>, public Parented<SX127x> {
|
||||
public:
|
||||
void set_data_template(std::vector<uint8_t> (*func)(Ts...)) {
|
||||
this->data_.func = func;
|
||||
@@ -43,22 +43,22 @@ template<typename... Ts> class SendPacketAction : public Action<Ts...>, public P
|
||||
} data_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetModeTxAction : public Action<Ts...>, public Parented<SX127x> {
|
||||
template<typename... Ts> class SetModeTxAction final : public Action<Ts...>, public Parented<SX127x> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->set_mode_tx(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetModeRxAction : public Action<Ts...>, public Parented<SX127x> {
|
||||
template<typename... Ts> class SetModeRxAction final : public Action<Ts...>, public Parented<SX127x> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->set_mode_rx(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetModeSleepAction : public Action<Ts...>, public Parented<SX127x> {
|
||||
template<typename... Ts> class SetModeSleepAction final : public Action<Ts...>, public Parented<SX127x> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->set_mode_sleep(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetModeStandbyAction : public Action<Ts...>, public Parented<SX127x> {
|
||||
template<typename... Ts> class SetModeStandbyAction final : public Action<Ts...>, public Parented<SX127x> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->set_mode_standby(); }
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::sx127x {
|
||||
|
||||
class SX127xTransport : public packet_transport::PacketTransport, public Parented<SX127x>, public SX127xListener {
|
||||
class SX127xTransport final : public packet_transport::PacketTransport, public Parented<SX127x>, public SX127xListener {
|
||||
public:
|
||||
void setup() override;
|
||||
void on_packet(const std::vector<uint8_t> &packet, float rssi, float snr) override;
|
||||
|
||||
@@ -41,7 +41,7 @@ class SX127xListener {
|
||||
virtual void on_packet(const std::vector<uint8_t> &packet, float rssi, float snr) = 0;
|
||||
};
|
||||
|
||||
class SX127x : public Component,
|
||||
class SX127x final : public Component,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
|
||||
spi::DATA_RATE_8MHZ> {
|
||||
public:
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::sx1509 {
|
||||
|
||||
class SX1509BinarySensor : public sx1509::SX1509Processor, public binary_sensor::BinarySensor {
|
||||
class SX1509BinarySensor final : public sx1509::SX1509Processor, public binary_sensor::BinarySensor {
|
||||
public:
|
||||
void set_row_col(uint8_t row, uint8_t col) { this->key_ = (1 << (col + 8)) | (1 << row); }
|
||||
void process(uint16_t data) override { this->publish_state(static_cast<bool>(data == key_)); }
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace esphome::sx1509 {
|
||||
|
||||
class SX1509Component;
|
||||
|
||||
class SX1509FloatOutputChannel : public output::FloatOutput, public Component {
|
||||
class SX1509FloatOutputChannel final : public output::FloatOutput, public Component {
|
||||
public:
|
||||
void set_parent(SX1509Component *parent) { this->parent_ = parent; }
|
||||
void set_pin(uint8_t pin) { pin_ = pin; }
|
||||
|
||||
@@ -28,9 +28,9 @@ class SX1509Processor {
|
||||
virtual void process(uint16_t data){};
|
||||
};
|
||||
|
||||
class SX1509KeyTrigger : public Trigger<uint8_t> {};
|
||||
class SX1509KeyTrigger final : public Trigger<uint8_t> {};
|
||||
|
||||
class SX1509Component : public Component,
|
||||
class SX1509Component final : public Component,
|
||||
public i2c::I2CDevice,
|
||||
public gpio_expander::CachedGpioExpander<uint16_t, 16>,
|
||||
public key_provider::KeyProvider {
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace esphome::sx1509 {
|
||||
|
||||
class SX1509Component;
|
||||
|
||||
class SX1509GPIOPin : public GPIOPin {
|
||||
class SX1509GPIOPin final : public GPIOPin {
|
||||
public:
|
||||
void setup() override;
|
||||
void pin_mode(gpio::Flags flags) override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
namespace esphome::sy6970 {
|
||||
|
||||
template<uint8_t REG, uint8_t SHIFT, uint8_t MASK, uint8_t TRUE_VALUE>
|
||||
class StatusBinarySensor : public SY6970Listener, public binary_sensor::BinarySensor {
|
||||
class StatusBinarySensor final : public SY6970Listener, public binary_sensor::BinarySensor {
|
||||
public:
|
||||
void on_data(const SY6970Data &data) override {
|
||||
uint8_t value = (data.registers[REG] >> SHIFT) & MASK;
|
||||
@@ -24,7 +24,7 @@ class InverseStatusBinarySensor : public SY6970Listener, public binary_sensor::B
|
||||
};
|
||||
|
||||
// Custom binary sensor for charging (true when pre-charge or fast charge)
|
||||
class SY6970ChargingBinarySensor : public SY6970Listener, public binary_sensor::BinarySensor {
|
||||
class SY6970ChargingBinarySensor final : public SY6970Listener, public binary_sensor::BinarySensor {
|
||||
public:
|
||||
void on_data(const SY6970Data &data) override {
|
||||
uint8_t chrg_stat = (data.registers[SY6970_REG_STATUS] >> 3) & 0x03;
|
||||
|
||||
@@ -34,7 +34,7 @@ using SY6970SystemVoltageSensor = VoltageSensor<SY6970_REG_VINDPM_STATUS, 0x7F,
|
||||
using SY6970ChargeCurrentSensor = CurrentSensor<SY6970_REG_CHARGE_CURRENT_MONITOR, 0x7F, 0, CHG_CURRENT_STEP_MA>;
|
||||
|
||||
// Precharge current sensor needs special handling (bit shift)
|
||||
class SY6970PrechargeCurrentSensor : public SY6970Listener, public sensor::Sensor {
|
||||
class SY6970PrechargeCurrentSensor final : public SY6970Listener, public sensor::Sensor {
|
||||
public:
|
||||
void on_data(const SY6970Data &data) override {
|
||||
uint8_t iprechg = (data.registers[SY6970_REG_PRECHARGE_CURRENT] >> 4) & 0x0F;
|
||||
|
||||
@@ -73,7 +73,7 @@ class SY6970Listener {
|
||||
virtual void on_data(const SY6970Data &data) = 0;
|
||||
};
|
||||
|
||||
class SY6970Component : public PollingComponent, public i2c::I2CDevice {
|
||||
class SY6970Component final : public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
SY6970Component(bool led_enabled, uint16_t input_current_limit, uint16_t charge_voltage, uint16_t charge_current,
|
||||
uint16_t precharge_current, bool charge_enabled, bool enable_adc)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
namespace esphome::sy6970 {
|
||||
|
||||
// Bus status text sensor
|
||||
class SY6970BusStatusTextSensor : public SY6970Listener, public text_sensor::TextSensor {
|
||||
class SY6970BusStatusTextSensor final : public SY6970Listener, public text_sensor::TextSensor {
|
||||
public:
|
||||
void on_data(const SY6970Data &data) override {
|
||||
uint8_t status = (data.registers[SY6970_REG_STATUS] >> 5) & 0x07;
|
||||
@@ -40,7 +40,7 @@ class SY6970BusStatusTextSensor : public SY6970Listener, public text_sensor::Tex
|
||||
};
|
||||
|
||||
// Charge status text sensor
|
||||
class SY6970ChargeStatusTextSensor : public SY6970Listener, public text_sensor::TextSensor {
|
||||
class SY6970ChargeStatusTextSensor final : public SY6970Listener, public text_sensor::TextSensor {
|
||||
public:
|
||||
void on_data(const SY6970Data &data) override {
|
||||
uint8_t status = (data.registers[SY6970_REG_STATUS] >> 3) & 0x03;
|
||||
@@ -66,7 +66,7 @@ class SY6970ChargeStatusTextSensor : public SY6970Listener, public text_sensor::
|
||||
};
|
||||
|
||||
// NTC status text sensor
|
||||
class SY6970NtcStatusTextSensor : public SY6970Listener, public text_sensor::TextSensor {
|
||||
class SY6970NtcStatusTextSensor final : public SY6970Listener, public text_sensor::TextSensor {
|
||||
public:
|
||||
void on_data(const SY6970Data &data) override {
|
||||
uint8_t status = data.registers[SY6970_REG_FAULT] & 0x07;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#ifdef USE_NETWORK
|
||||
namespace esphome::syslog {
|
||||
class Syslog : public Component, public Parented<udp::UDPComponent> {
|
||||
class Syslog final : public Component, public Parented<udp::UDPComponent> {
|
||||
public:
|
||||
Syslog(int level, time::RealTimeClock *time) : log_level_(level), time_(time) {}
|
||||
void setup() override;
|
||||
|
||||
@@ -19,7 +19,7 @@ enum class T6615Command : uint8_t {
|
||||
SET_ELEVATION,
|
||||
};
|
||||
|
||||
class T6615Component : public PollingComponent, public uart::UARTDevice {
|
||||
class T6615Component final : public PollingComponent, public uart::UARTDevice {
|
||||
public:
|
||||
void loop() override;
|
||||
void update() override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::tc74 {
|
||||
|
||||
class TC74Component : public PollingComponent, public i2c::I2CDevice, public sensor::Sensor {
|
||||
class TC74Component final : public PollingComponent, public i2c::I2CDevice, public sensor::Sensor {
|
||||
public:
|
||||
/// Setup the sensor and check connection.
|
||||
void setup() override;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace esphome::tca9548a {
|
||||
static const uint8_t TCA9548A_DISABLE_CHANNELS_COMMAND = 0x00;
|
||||
|
||||
class TCA9548AComponent;
|
||||
class TCA9548AChannel : public i2c::I2CBus {
|
||||
class TCA9548AChannel final : public i2c::I2CBus {
|
||||
public:
|
||||
void set_channel(uint8_t channel) { channel_ = channel; }
|
||||
void set_parent(TCA9548AComponent *parent) { parent_ = parent; }
|
||||
@@ -21,7 +21,7 @@ class TCA9548AChannel : public i2c::I2CBus {
|
||||
TCA9548AComponent *parent_;
|
||||
};
|
||||
|
||||
class TCA9548AComponent : public Component, public i2c::I2CDevice {
|
||||
class TCA9548AComponent final : public Component, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::tca9555 {
|
||||
|
||||
class TCA9555Component : public Component,
|
||||
class TCA9555Component final : public Component,
|
||||
public i2c::I2CDevice,
|
||||
public gpio_expander::CachedGpioExpander<uint8_t, 16> {
|
||||
public:
|
||||
@@ -47,7 +47,7 @@ class TCA9555Component : public Component,
|
||||
};
|
||||
|
||||
/// Helper class to expose a TCA9555 pin as an internal input GPIO pin.
|
||||
class TCA9555GPIOPin : public GPIOPin, public Parented<TCA9555Component> {
|
||||
class TCA9555GPIOPin final : public GPIOPin, public Parented<TCA9555Component> {
|
||||
public:
|
||||
void setup() override;
|
||||
void pin_mode(gpio::Flags flags) override;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace esphome::tcl112 {
|
||||
const float TCL112_TEMP_MAX = 31.0;
|
||||
const float TCL112_TEMP_MIN = 16.0;
|
||||
|
||||
class Tcl112Climate : public climate_ir::ClimateIR {
|
||||
class Tcl112Climate final : public climate_ir::ClimateIR {
|
||||
public:
|
||||
Tcl112Climate()
|
||||
: climate_ir::ClimateIR(TCL112_TEMP_MIN, TCL112_TEMP_MAX, .5f, true, true,
|
||||
|
||||
@@ -35,7 +35,7 @@ enum TCS34725Gain {
|
||||
TCS34725_GAIN_60X = 0x03,
|
||||
};
|
||||
|
||||
class TCS34725Component : public PollingComponent, public i2c::I2CDevice {
|
||||
class TCS34725Component final : public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void set_integration_time(TCS34725IntegrationTime integration_time);
|
||||
void set_gain(TCS34725Gain gain);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
namespace esphome::tee501 {
|
||||
|
||||
/// This class implements support for the tee501 of temperature i2c sensors.
|
||||
class TEE501Component : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
class TEE501Component final : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace esphome::teleinfo {
|
||||
|
||||
class TeleInfoSensor : public TeleInfoListener, public sensor::Sensor, public Component {
|
||||
class TeleInfoSensor final : public TeleInfoListener, public sensor::Sensor, public Component {
|
||||
public:
|
||||
TeleInfoSensor(const char *tag);
|
||||
void publish_val(const std::string &val) override;
|
||||
|
||||
@@ -20,7 +20,7 @@ class TeleInfoListener {
|
||||
std::string tag;
|
||||
virtual void publish_val(const std::string &val){};
|
||||
};
|
||||
class TeleInfo : public PollingComponent, public uart::UARTDevice {
|
||||
class TeleInfo final : public PollingComponent, public uart::UARTDevice {
|
||||
public:
|
||||
TeleInfo(bool historical_mode);
|
||||
void register_teleinfo_listener(TeleInfoListener *listener);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "esphome/components/text_sensor/text_sensor.h"
|
||||
|
||||
namespace esphome::teleinfo {
|
||||
class TeleInfoTextSensor : public TeleInfoListener, public text_sensor::TextSensor, public Component {
|
||||
class TeleInfoTextSensor final : public TeleInfoListener, public text_sensor::TextSensor, public Component {
|
||||
public:
|
||||
TeleInfoTextSensor(const char *tag);
|
||||
void publish_val(const std::string &val) override;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
namespace esphome::tem3200 {
|
||||
|
||||
/// This class implements support for the tem3200 pressure and temperature i2c sensors.
|
||||
class TEM3200Component : public PollingComponent, public i2c::I2CDevice {
|
||||
class TEM3200Component final : public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void set_temperature_sensor(sensor::Sensor *temperature_sensor) { this->temperature_sensor_ = temperature_sensor; }
|
||||
void set_raw_pressure_sensor(sensor::Sensor *raw_pressure_sensor) {
|
||||
|
||||
Reference in New Issue
Block a user