mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 11:25:35 +00:00
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).
28 lines
912 B
C++
28 lines
912 B
C++
#pragma once
|
|
|
|
#include "esphome/core/component.h"
|
|
#include "esphome/components/sensor/sensor.h"
|
|
#include "esphome/components/i2c/i2c.h"
|
|
|
|
namespace esphome::tem3200 {
|
|
|
|
/// This class implements support for the tem3200 pressure and temperature i2c sensors.
|
|
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) {
|
|
this->raw_pressure_sensor_ = raw_pressure_sensor;
|
|
}
|
|
|
|
void setup() override;
|
|
void dump_config() override;
|
|
void update() override;
|
|
|
|
protected:
|
|
i2c::ErrorCode read_(uint8_t &status, uint16_t &raw_temperature, uint16_t &raw_pressure);
|
|
sensor::Sensor *temperature_sensor_{nullptr};
|
|
sensor::Sensor *raw_pressure_sensor_{nullptr};
|
|
};
|
|
|
|
} // namespace esphome::tem3200
|