1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-27 13:13:50 +00:00

Add TMP117 component (#992)

* Create TMP117 sensor component
This commit is contained in:
Nicholas Peters
2020-03-12 17:25:00 -04:00
committed by GitHub
parent c60989a7be
commit 714d28a61a
5 changed files with 173 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
#pragma once
#include "esphome/core/component.h"
#include "esphome/components/sensor/sensor.h"
#include "esphome/components/i2c/i2c.h"
namespace esphome {
namespace tmp117 {
class TMP117Component : public PollingComponent, public i2c::I2CDevice, public sensor::Sensor {
public:
void setup() override;
void dump_config() override;
float get_setup_priority() const override;
void update() override;
void set_config(uint16_t config) { config_ = config; };
protected:
bool read_data_(int16_t *data);
bool read_config_(uint16_t *config);
bool write_config_(uint16_t config);
uint16_t config_;
};
} // namespace tmp117
} // namespace esphome