ESPHome  2024.11.1
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:57
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:283
void dump_config() override
Definition: am2320.cpp:46
float get_setup_priority() const override
Definition: am2320.cpp:55
std::string size_t len
Definition: helpers.h:293
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_temperature_sensor(sensor::Sensor *temperature_sensor)
Definition: am2320.h:17
bool read_data_(uint8_t *data)
Definition: am2320.cpp:68
Base-class for all sensors.
Definition: sensor.h:57
This Class provides the methods to read/write bytes from/to an i2c device.
Definition: i2c.h:133