ESPHome  2022.8.0
am2320.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace am2320 {
9 
11  public:
12  void setup() override;
13  void dump_config() override;
14  float get_setup_priority() const override;
15  void update() override;
16 
17  void set_temperature_sensor(sensor::Sensor *temperature_sensor) { temperature_sensor_ = temperature_sensor; }
18  void set_humidity_sensor(sensor::Sensor *humidity_sensor) { humidity_sensor_ = humidity_sensor; }
19 
20  protected:
21  bool read_data_(uint8_t *data);
22  bool read_bytes_(uint8_t a_register, uint8_t *data, uint8_t len, uint32_t conversion = 0);
23 
26 };
27 
28 } // namespace am2320
29 } // namespace esphome
bool read_bytes_(uint8_t a_register, uint8_t *data, uint8_t len, uint32_t conversion=0)
Definition: am2320.cpp:75
sensor::Sensor * temperature_sensor_
Definition: am2320.h:24
sensor::Sensor * humidity_sensor_
Definition: am2320.h:25
void set_humidity_sensor(sensor::Sensor *humidity_sensor)
Definition: am2320.h:18
This class simplifies creating components that periodically check a state.
Definition: component.h:266
void dump_config() override
Definition: am2320.cpp:64
float get_setup_priority() const override
Definition: am2320.cpp:73
std::string size_t len
Definition: helpers.h:278
Definition: a4988.cpp:4
void set_temperature_sensor(sensor::Sensor *temperature_sensor)
Definition: am2320.h:17
bool read_data_(uint8_t *data)
Definition: am2320.cpp:86
Base-class for all sensors.
Definition: sensor.h:48