mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 11:07:33 +00:00
Mark user-configurable classes as final (part 10/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 10 of 21, split alphabetically by component (matrix_keypad .. micronova).
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::matrix_keypad {
|
||||
|
||||
class MatrixKeypadBinarySensor : public MatrixKeypadListener, public binary_sensor::BinarySensorInitiallyOff {
|
||||
class MatrixKeypadBinarySensor final : public MatrixKeypadListener, public binary_sensor::BinarySensorInitiallyOff {
|
||||
public:
|
||||
MatrixKeypadBinarySensor(uint8_t key) : has_key_(true), key_(key){};
|
||||
MatrixKeypadBinarySensor(const char *key) : has_key_(true), key_((uint8_t) key[0]){};
|
||||
|
||||
@@ -18,9 +18,9 @@ class MatrixKeypadListener {
|
||||
virtual void key_released(uint8_t key){};
|
||||
};
|
||||
|
||||
class MatrixKeyTrigger : public Trigger<uint8_t> {};
|
||||
class MatrixKeyTrigger final : public Trigger<uint8_t> {};
|
||||
|
||||
class MatrixKeypad : public key_provider::KeyProvider, public Component {
|
||||
class MatrixKeypad final : public key_provider::KeyProvider, public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void loop() override;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::max17043 {
|
||||
|
||||
template<typename... Ts> class SleepAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SleepAction final : public Action<Ts...> {
|
||||
public:
|
||||
explicit SleepAction(MAX17043Component *max17043) : max17043_(max17043) {}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::max17043 {
|
||||
|
||||
class MAX17043Component : public PollingComponent, public i2c::I2CDevice {
|
||||
class MAX17043Component final : public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
namespace esphome::max31855 {
|
||||
|
||||
class MAX31855Sensor : public sensor::Sensor,
|
||||
public PollingComponent,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_4MHZ> {
|
||||
class MAX31855Sensor final : public sensor::Sensor,
|
||||
public PollingComponent,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_4MHZ> {
|
||||
public:
|
||||
void set_reference_sensor(sensor::Sensor *temperature_sensor) { temperature_reference_ = temperature_sensor; }
|
||||
|
||||
|
||||
@@ -68,10 +68,10 @@ enum MAX31856ConfigFilter {
|
||||
FILTER_50HZ = 1,
|
||||
};
|
||||
|
||||
class MAX31856Sensor : public sensor::Sensor,
|
||||
public PollingComponent,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_4MHZ> {
|
||||
class MAX31856Sensor final : public sensor::Sensor,
|
||||
public PollingComponent,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_4MHZ> {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -22,10 +22,10 @@ enum MAX31865ConfigFilter {
|
||||
FILTER_50HZ = 1,
|
||||
};
|
||||
|
||||
class MAX31865Sensor : public sensor::Sensor,
|
||||
public PollingComponent,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_4MHZ> {
|
||||
class MAX31865Sensor final : public sensor::Sensor,
|
||||
public PollingComponent,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_TRAILING, spi::DATA_RATE_4MHZ> {
|
||||
public:
|
||||
void set_reference_resistance(float reference_resistance) { reference_resistance_ = reference_resistance; }
|
||||
void set_nominal_resistance(float nominal_resistance) { rtd_nominal_resistance_ = nominal_resistance; }
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace esphome::max44009 {
|
||||
enum MAX44009Mode { MAX44009_MODE_AUTO, MAX44009_MODE_LOW_POWER, MAX44009_MODE_CONTINUOUS };
|
||||
|
||||
/// This class implements support for the MAX44009 Illuminance i2c sensor.
|
||||
class MAX44009Sensor : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
class MAX44009Sensor final : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
MAX44009Sensor() {}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
namespace esphome::max6675 {
|
||||
|
||||
class MAX6675Sensor : public sensor::Sensor,
|
||||
public PollingComponent,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
|
||||
spi::DATA_RATE_1MHZ> {
|
||||
class MAX6675Sensor final : public sensor::Sensor,
|
||||
public PollingComponent,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_1MHZ> {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::max6956 {
|
||||
|
||||
template<typename... Ts> class SetCurrentGlobalAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SetCurrentGlobalAction final : public Action<Ts...> {
|
||||
public:
|
||||
SetCurrentGlobalAction(MAX6956 *max6956) : max6956_(max6956) {}
|
||||
|
||||
@@ -21,7 +21,7 @@ template<typename... Ts> class SetCurrentGlobalAction : public Action<Ts...> {
|
||||
MAX6956 *max6956_;
|
||||
};
|
||||
|
||||
template<typename... Ts> class SetCurrentModeAction : public Action<Ts...> {
|
||||
template<typename... Ts> class SetCurrentModeAction final : public Action<Ts...> {
|
||||
public:
|
||||
SetCurrentModeAction(MAX6956 *max6956) : max6956_(max6956) {}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ enum MAX6956GPIOFlag { FLAG_LED = 0x20 };
|
||||
|
||||
enum MAX6956CURRENTMODE { GLOBAL = 0x00, SEGMENT = 0x01 };
|
||||
|
||||
class MAX6956 : public Component, public i2c::I2CDevice {
|
||||
class MAX6956 final : public Component, public i2c::I2CDevice {
|
||||
public:
|
||||
MAX6956() = default;
|
||||
|
||||
@@ -69,7 +69,7 @@ class MAX6956 : public Component, public i2c::I2CDevice {
|
||||
int8_t prev_bright_[28] = {0};
|
||||
};
|
||||
|
||||
class MAX6956GPIOPin : public GPIOPin {
|
||||
class MAX6956GPIOPin final : public GPIOPin {
|
||||
public:
|
||||
void setup() override;
|
||||
void pin_mode(gpio::Flags flags) override;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace esphome::max6956 {
|
||||
|
||||
class MAX6956;
|
||||
|
||||
class MAX6956LedChannel : public output::FloatOutput, public Component {
|
||||
class MAX6956LedChannel final : public output::FloatOutput, public Component {
|
||||
public:
|
||||
void set_parent(MAX6956 *parent) { this->parent_ = parent; }
|
||||
void set_pin(uint8_t pin) { pin_ = pin; }
|
||||
|
||||
@@ -12,9 +12,9 @@ class MAX7219Component;
|
||||
|
||||
using max7219_writer_t = display::DisplayWriter<MAX7219Component>;
|
||||
|
||||
class MAX7219Component : public PollingComponent,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_1MHZ> {
|
||||
class MAX7219Component final : public PollingComponent,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_1MHZ> {
|
||||
public:
|
||||
explicit MAX7219Component(uint8_t num_chips);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::max7219digit {
|
||||
|
||||
template<typename... Ts> class DisplayInvertAction : public Action<Ts...>, public Parented<MAX7219Component> {
|
||||
template<typename... Ts> class DisplayInvertAction final : public Action<Ts...>, public Parented<MAX7219Component> {
|
||||
public:
|
||||
TEMPLATABLE_VALUE(bool, state)
|
||||
|
||||
@@ -17,7 +17,7 @@ template<typename... Ts> class DisplayInvertAction : public Action<Ts...>, publi
|
||||
}
|
||||
};
|
||||
|
||||
template<typename... Ts> class DisplayVisibilityAction : public Action<Ts...>, public Parented<MAX7219Component> {
|
||||
template<typename... Ts> class DisplayVisibilityAction final : public Action<Ts...>, public Parented<MAX7219Component> {
|
||||
public:
|
||||
TEMPLATABLE_VALUE(bool, state)
|
||||
|
||||
@@ -27,7 +27,7 @@ template<typename... Ts> class DisplayVisibilityAction : public Action<Ts...>, p
|
||||
}
|
||||
};
|
||||
|
||||
template<typename... Ts> class DisplayReverseAction : public Action<Ts...>, public Parented<MAX7219Component> {
|
||||
template<typename... Ts> class DisplayReverseAction final : public Action<Ts...>, public Parented<MAX7219Component> {
|
||||
public:
|
||||
TEMPLATABLE_VALUE(bool, state)
|
||||
|
||||
@@ -37,7 +37,7 @@ template<typename... Ts> class DisplayReverseAction : public Action<Ts...>, publ
|
||||
}
|
||||
};
|
||||
|
||||
template<typename... Ts> class DisplayIntensityAction : public Action<Ts...>, public Parented<MAX7219Component> {
|
||||
template<typename... Ts> class DisplayIntensityAction final : public Action<Ts...>, public Parented<MAX7219Component> {
|
||||
public:
|
||||
TEMPLATABLE_VALUE(uint8_t, state)
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ class MAX7219Component;
|
||||
|
||||
using max7219_writer_t = display::DisplayWriter<MAX7219Component>;
|
||||
|
||||
class MAX7219Component : public display::DisplayBuffer,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_1MHZ> {
|
||||
class MAX7219Component final : public display::DisplayBuffer,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_1MHZ> {
|
||||
public:
|
||||
void set_writer(max7219_writer_t &&writer) { this->writer_local_ = writer; };
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ enum MAX9611RegisterMap {
|
||||
CONTROL_REGISTER_2_ADRR = 0x0B,
|
||||
};
|
||||
|
||||
class MAX9611Component : public PollingComponent, public i2c::I2CDevice {
|
||||
class MAX9611Component final : public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::mcp23008 {
|
||||
|
||||
class MCP23008 : public mcp23x08_base::MCP23X08Base, public i2c::I2CDevice {
|
||||
class MCP23008 final : public mcp23x08_base::MCP23X08Base, public i2c::I2CDevice {
|
||||
public:
|
||||
MCP23008() = default;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ enum MCP23016GPIORegisters {
|
||||
MCP23016_IOCON1 = 0x0B,
|
||||
};
|
||||
|
||||
class MCP23016 : public Component, public i2c::I2CDevice, public gpio_expander::CachedGpioExpander<uint16_t, 16> {
|
||||
class MCP23016 final : public Component, public i2c::I2CDevice, public gpio_expander::CachedGpioExpander<uint16_t, 16> {
|
||||
public:
|
||||
MCP23016() = default;
|
||||
|
||||
@@ -56,7 +56,7 @@ class MCP23016 : public Component, public i2c::I2CDevice, public gpio_expander::
|
||||
InternalGPIOPin *interrupt_pin_{nullptr};
|
||||
};
|
||||
|
||||
class MCP23016GPIOPin : public GPIOPin {
|
||||
class MCP23016GPIOPin final : public GPIOPin {
|
||||
public:
|
||||
void setup() override;
|
||||
void pin_mode(gpio::Flags flags) override;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::mcp23017 {
|
||||
|
||||
class MCP23017 : public mcp23x17_base::MCP23X17Base, public i2c::I2CDevice {
|
||||
class MCP23017 final : public mcp23x17_base::MCP23X17Base, public i2c::I2CDevice {
|
||||
public:
|
||||
MCP23017() = default;
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
namespace esphome::mcp23s08 {
|
||||
|
||||
class MCP23S08 : public mcp23x08_base::MCP23X08Base,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
|
||||
spi::DATA_RATE_10MHZ> {
|
||||
class MCP23S08 final : public mcp23x08_base::MCP23X08Base,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_10MHZ> {
|
||||
public:
|
||||
MCP23S08() = default;
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
namespace esphome::mcp23s17 {
|
||||
|
||||
class MCP23S17 : public mcp23x17_base::MCP23X17Base,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
|
||||
spi::DATA_RATE_8MHZ> {
|
||||
class MCP23S17 final : public mcp23x17_base::MCP23X17Base,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
||||
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_8MHZ> {
|
||||
public:
|
||||
MCP23S17() = default;
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ template<uint8_t N> class MCP23XXXBase : public Component, public gpio_expander:
|
||||
InternalGPIOPin *interrupt_pin_{nullptr};
|
||||
};
|
||||
|
||||
template<uint8_t N> class MCP23XXXGPIOPin : public GPIOPin {
|
||||
template<uint8_t N> class MCP23XXXGPIOPin final : public GPIOPin {
|
||||
public:
|
||||
void setup() override;
|
||||
void pin_mode(gpio::Flags flags) override;
|
||||
|
||||
@@ -51,9 +51,9 @@ enum STAT : uint8_t { STAT_RX0IF = (1 << 0), STAT_RX1IF = (1 << 1) };
|
||||
static const uint8_t STAT_RXIF_MASK = STAT_RX0IF | STAT_RX1IF;
|
||||
static const uint8_t EFLG_ERRORMASK = EFLG_RX1OVR | EFLG_RX0OVR | EFLG_TXBO | EFLG_TXEP | EFLG_RXEP;
|
||||
|
||||
class MCP2515 : public canbus::Canbus,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
|
||||
spi::DATA_RATE_8MHZ> {
|
||||
class MCP2515 final : public canbus::Canbus,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
|
||||
spi::DATA_RATE_8MHZ> {
|
||||
public:
|
||||
MCP2515(){};
|
||||
void set_mcp_clock(CanClock clock) { this->mcp_clock_ = clock; };
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
namespace esphome::mcp3008 {
|
||||
|
||||
class MCP3008 : public Component,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
|
||||
spi::DATA_RATE_75KHZ> { // Running at the slowest max speed supported by the
|
||||
// mcp3008. 2.7v = 75ksps
|
||||
class MCP3008 final : public Component,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
|
||||
spi::DATA_RATE_75KHZ> { // Running at the slowest max speed supported by
|
||||
// the mcp3008. 2.7v = 75ksps
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
namespace esphome::mcp3008 {
|
||||
|
||||
class MCP3008Sensor : public PollingComponent,
|
||||
public sensor::Sensor,
|
||||
public voltage_sampler::VoltageSampler,
|
||||
public Parented<MCP3008> {
|
||||
class MCP3008Sensor final : public PollingComponent,
|
||||
public sensor::Sensor,
|
||||
public voltage_sampler::VoltageSampler,
|
||||
public Parented<MCP3008> {
|
||||
public:
|
||||
void set_reference_voltage(float reference_voltage) { this->reference_voltage_ = reference_voltage; }
|
||||
void set_pin(uint8_t pin) { this->pin_ = pin; }
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
namespace esphome::mcp3204 {
|
||||
|
||||
class MCP3204 : public Component,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
|
||||
spi::DATA_RATE_1MHZ> {
|
||||
class MCP3204 final : public Component,
|
||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
|
||||
spi::DATA_RATE_1MHZ> {
|
||||
public:
|
||||
MCP3204() = default;
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
|
||||
namespace esphome::mcp3204 {
|
||||
|
||||
class MCP3204Sensor : public PollingComponent,
|
||||
public Parented<MCP3204>,
|
||||
public sensor::Sensor,
|
||||
public voltage_sampler::VoltageSampler {
|
||||
class MCP3204Sensor final : public PollingComponent,
|
||||
public Parented<MCP3204>,
|
||||
public sensor::Sensor,
|
||||
public voltage_sampler::VoltageSampler {
|
||||
public:
|
||||
MCP3204Sensor(uint8_t pin, bool differential_mode) : pin_(pin), differential_mode_(differential_mode) {}
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
namespace esphome::mcp3221 {
|
||||
|
||||
class MCP3221Sensor : public sensor::Sensor,
|
||||
public PollingComponent,
|
||||
public voltage_sampler::VoltageSampler,
|
||||
public i2c::I2CDevice {
|
||||
class MCP3221Sensor final : public sensor::Sensor,
|
||||
public PollingComponent,
|
||||
public voltage_sampler::VoltageSampler,
|
||||
public i2c::I2CDevice {
|
||||
public:
|
||||
void set_reference_voltage(float reference_voltage) { this->reference_voltage_ = reference_voltage; }
|
||||
void update() override;
|
||||
|
||||
@@ -57,7 +57,7 @@ enum class Mcp4461TerminalIdx : uint8_t { MCP4461_TERMINAL_0 = 0, MCP4461_TERMIN
|
||||
class Mcp4461Wiper;
|
||||
|
||||
// Mcp4461Component
|
||||
class Mcp4461Component : public Component, public i2c::I2CDevice {
|
||||
class Mcp4461Component final : public Component, public i2c::I2CDevice {
|
||||
public:
|
||||
Mcp4461Component(bool disable_wiper_0, bool disable_wiper_1, bool disable_wiper_2, bool disable_wiper_3)
|
||||
: wiper_0_disabled_(disable_wiper_0),
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::mcp4461 {
|
||||
|
||||
class Mcp4461Wiper : public output::FloatOutput, public Parented<Mcp4461Component> {
|
||||
class Mcp4461Wiper final : public output::FloatOutput, public Parented<Mcp4461Component> {
|
||||
public:
|
||||
Mcp4461Wiper(Mcp4461Component *parent, Mcp4461WiperIdx wiper) : parent_(parent), wiper_(wiper) {}
|
||||
/// @brief Set level of wiper
|
||||
|
||||
@@ -8,7 +8,7 @@ static const uint8_t MCP4725_ADDR = 0x60;
|
||||
static const uint8_t MCP4725_RES = 12;
|
||||
|
||||
namespace esphome::mcp4725 {
|
||||
class MCP4725 : public Component, public output::FloatOutput, public i2c::I2CDevice {
|
||||
class MCP4725 final : public Component, public output::FloatOutput, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -38,7 +38,7 @@ struct DACInputData {
|
||||
class MCP4728Channel;
|
||||
|
||||
/// MCP4728 float output component.
|
||||
class MCP4728Component : public Component, public i2c::I2CDevice {
|
||||
class MCP4728Component final : public Component, public i2c::I2CDevice {
|
||||
public:
|
||||
MCP4728Component(bool store_in_eeprom) : store_in_eeprom_(store_in_eeprom) {}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace esphome::mcp4728 {
|
||||
|
||||
class MCP4728Channel : public output::FloatOutput {
|
||||
class MCP4728Channel final : public output::FloatOutput {
|
||||
public:
|
||||
MCP4728Channel(MCP4728Component *parent, MCP4728ChannelIdx channel, MCP4728Vref vref, MCP4728Gain gain,
|
||||
MCP4728PwrDown pwrdown)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::mcp47a1 {
|
||||
|
||||
class MCP47A1 : public Component, public output::FloatOutput, public i2c::I2CDevice {
|
||||
class MCP47A1 final : public Component, public output::FloatOutput, public i2c::I2CDevice {
|
||||
public:
|
||||
void dump_config() override;
|
||||
void write_state(float state) override;
|
||||
|
||||
@@ -17,7 +17,7 @@ enum MCP9600ThermocoupleType : uint8_t {
|
||||
MCP9600_THERMOCOUPLE_TYPE_R = 0b111,
|
||||
};
|
||||
|
||||
class MCP9600Component : public PollingComponent, public i2c::I2CDevice {
|
||||
class MCP9600Component final : public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::mcp9808 {
|
||||
|
||||
class MCP9808Sensor : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
class MCP9808Sensor final : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
namespace esphome::media_player {
|
||||
|
||||
template<MediaPlayerCommand Command, typename... Ts>
|
||||
class MediaPlayerCommandAction : public Action<Ts...>, public Parented<MediaPlayer> {
|
||||
class MediaPlayerCommandAction final : public Action<Ts...>, public Parented<MediaPlayer> {
|
||||
public:
|
||||
TEMPLATABLE_VALUE(bool, announcement);
|
||||
void play(const Ts &...x) override {
|
||||
@@ -54,7 +54,7 @@ template<typename... Ts>
|
||||
using ClearPlaylistAction = MediaPlayerCommandAction<MediaPlayerCommand::MEDIA_PLAYER_COMMAND_CLEAR_PLAYLIST, Ts...>;
|
||||
|
||||
template<MediaPlayerCommand Command, typename... Ts>
|
||||
class MediaPlayerMediaAction : public Action<Ts...>, public Parented<MediaPlayer> {
|
||||
class MediaPlayerMediaAction final : public Action<Ts...>, public Parented<MediaPlayer> {
|
||||
TEMPLATABLE_VALUE(std::string, media_url)
|
||||
TEMPLATABLE_VALUE(bool, announcement)
|
||||
void play(const Ts &...x) override {
|
||||
@@ -70,7 +70,7 @@ using PlayMediaAction = MediaPlayerMediaAction<MediaPlayerCommand::MEDIA_PLAYER_
|
||||
template<typename... Ts>
|
||||
using EnqueueMediaAction = MediaPlayerMediaAction<MediaPlayerCommand::MEDIA_PLAYER_COMMAND_ENQUEUE, Ts...>;
|
||||
|
||||
template<typename... Ts> class VolumeSetAction : public Action<Ts...>, public Parented<MediaPlayer> {
|
||||
template<typename... Ts> class VolumeSetAction final : public Action<Ts...>, public Parented<MediaPlayer> {
|
||||
TEMPLATABLE_VALUE(float, volume)
|
||||
void play(const Ts &...x) override { this->parent_->make_call().set_volume(this->volume_.value(x...)).perform(); }
|
||||
};
|
||||
@@ -97,39 +97,39 @@ static_assert(std::is_trivially_copyable_v<StateAnyForwarder>);
|
||||
static_assert(sizeof(StateEnterForwarder<MediaPlayerState::MEDIA_PLAYER_STATE_IDLE>) <= sizeof(void *));
|
||||
static_assert(std::is_trivially_copyable_v<StateEnterForwarder<MediaPlayerState::MEDIA_PLAYER_STATE_IDLE>>);
|
||||
|
||||
template<typename... Ts> class IsIdleCondition : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
template<typename... Ts> class IsIdleCondition final : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_IDLE; }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsPlayingCondition : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
template<typename... Ts> class IsPlayingCondition final : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_PLAYING; }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsPausedCondition : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
template<typename... Ts> class IsPausedCondition final : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_PAUSED; }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsAnnouncingCondition : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
template<typename... Ts> class IsAnnouncingCondition final : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
public:
|
||||
bool check(const Ts &...x) override {
|
||||
return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_ANNOUNCING;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsOnCondition : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
template<typename... Ts> class IsOnCondition final : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_ON; }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsOffCondition : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
template<typename... Ts> class IsOffCondition final : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->state == MediaPlayerState::MEDIA_PLAYER_STATE_OFF; }
|
||||
};
|
||||
|
||||
template<typename... Ts> class IsMutedCondition : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
template<typename... Ts> class IsMutedCondition final : public Condition<Ts...>, public Parented<MediaPlayer> {
|
||||
public:
|
||||
bool check(const Ts &...x) override { return this->parent_->is_muted(); }
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ enum MHZ19DetectionRange {
|
||||
MHZ19_DETECTION_RANGE_0_10000PPM,
|
||||
};
|
||||
|
||||
class MHZ19Component : public PollingComponent, public uart::UARTDevice {
|
||||
class MHZ19Component final : public PollingComponent, public uart::UARTDevice {
|
||||
public:
|
||||
void setup() override;
|
||||
void update() override;
|
||||
@@ -49,22 +49,23 @@ class MHZ19Component : public PollingComponent, public uart::UARTDevice {
|
||||
MHZ19DetectionRange detection_range_{MHZ19_DETECTION_RANGE_DEFAULT};
|
||||
};
|
||||
|
||||
template<typename... Ts> class MHZ19CalibrateZeroAction : public Action<Ts...>, public Parented<MHZ19Component> {
|
||||
template<typename... Ts> class MHZ19CalibrateZeroAction final : public Action<Ts...>, public Parented<MHZ19Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->calibrate_zero(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class MHZ19ABCEnableAction : public Action<Ts...>, public Parented<MHZ19Component> {
|
||||
template<typename... Ts> class MHZ19ABCEnableAction final : public Action<Ts...>, public Parented<MHZ19Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->abc_enable(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class MHZ19ABCDisableAction : public Action<Ts...>, public Parented<MHZ19Component> {
|
||||
template<typename... Ts> class MHZ19ABCDisableAction final : public Action<Ts...>, public Parented<MHZ19Component> {
|
||||
public:
|
||||
void play(const Ts &...x) override { this->parent_->abc_disable(); }
|
||||
};
|
||||
|
||||
template<typename... Ts> class MHZ19DetectionRangeSetAction : public Action<Ts...>, public Parented<MHZ19Component> {
|
||||
template<typename... Ts>
|
||||
class MHZ19DetectionRangeSetAction final : public Action<Ts...>, public Parented<MHZ19Component> {
|
||||
public:
|
||||
TEMPLATABLE_VALUE(MHZ19DetectionRange, detection_range)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::micronova {
|
||||
|
||||
class MicroNovaButton : public Component, public button::Button, public MicroNovaBaseListener {
|
||||
class MicroNovaButton final : public Component, public button::Button, public MicroNovaBaseListener {
|
||||
public:
|
||||
MicroNovaButton(MicroNova *m) : MicroNovaBaseListener(m) {}
|
||||
void dump_config() override;
|
||||
|
||||
@@ -58,7 +58,7 @@ class MicroNovaListener : public MicroNovaBaseListener, public PollingComponent
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Main component class
|
||||
class MicroNova : public Component, public uart::UARTDevice {
|
||||
class MicroNova final : public Component, public uart::UARTDevice {
|
||||
public:
|
||||
MicroNova(GPIOPin *enable_rx_pin) : enable_rx_pin_(enable_rx_pin) {}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::micronova {
|
||||
|
||||
class MicroNovaNumber : public number::Number, public MicroNovaListener {
|
||||
class MicroNovaNumber final : public number::Number, public MicroNovaListener {
|
||||
public:
|
||||
MicroNovaNumber(MicroNova *m) : MicroNovaListener(m) {}
|
||||
void dump_config() override;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace esphome::micronova {
|
||||
|
||||
class MicroNovaSensor : public sensor::Sensor, public MicroNovaListener {
|
||||
class MicroNovaSensor final : public sensor::Sensor, public MicroNovaListener {
|
||||
public:
|
||||
MicroNovaSensor(MicroNova *m) : MicroNovaListener(m) {}
|
||||
void dump_config() override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace esphome::micronova {
|
||||
|
||||
class MicroNovaSwitch : public switch_::Switch, public MicroNovaListener {
|
||||
class MicroNovaSwitch final : public switch_::Switch, public MicroNovaListener {
|
||||
public:
|
||||
MicroNovaSwitch(MicroNova *m) : MicroNovaListener(m) {}
|
||||
void dump_config() override;
|
||||
|
||||
@@ -17,7 +17,7 @@ static const char *const STOVE_STATES[11] = {"Off",
|
||||
"No ignition alarm",
|
||||
"Undefined alarm"};
|
||||
|
||||
class MicroNovaTextSensor : public text_sensor::TextSensor, public MicroNovaListener {
|
||||
class MicroNovaTextSensor final : public text_sensor::TextSensor, public MicroNovaListener {
|
||||
public:
|
||||
MicroNovaTextSensor(MicroNova *m) : MicroNovaListener(m) {}
|
||||
void dump_config() override;
|
||||
|
||||
Reference in New Issue
Block a user