ESPHome  2024.12.2
ina219.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 #include <cinttypes>
8 
9 namespace esphome {
10 namespace ina219 {
11 
13  public:
14  void setup() override;
15  void dump_config() override;
16  float get_setup_priority() const override;
17  void update() override;
18 
19  void set_shunt_resistance_ohm(float shunt_resistance_ohm) { shunt_resistance_ohm_ = shunt_resistance_ohm; }
20  void set_max_current_a(float max_current_a) { max_current_a_ = max_current_a; }
21  void set_max_voltage_v(float max_voltage_v) { max_voltage_v_ = max_voltage_v; }
22  void set_bus_voltage_sensor(sensor::Sensor *bus_voltage_sensor) { bus_voltage_sensor_ = bus_voltage_sensor; }
23  void set_shunt_voltage_sensor(sensor::Sensor *shunt_voltage_sensor) { shunt_voltage_sensor_ = shunt_voltage_sensor; }
24  void set_current_sensor(sensor::Sensor *current_sensor) { current_sensor_ = current_sensor; }
25  void set_power_sensor(sensor::Sensor *power_sensor) { power_sensor_ = power_sensor; }
26 
27  protected:
31  uint32_t calibration_lsb_;
36 };
37 
38 } // namespace ina219
39 } // namespace esphome
void set_max_current_a(float max_current_a)
Definition: ina219.h:20
This class simplifies creating components that periodically check a state.
Definition: component.h:283
void set_shunt_resistance_ohm(float shunt_resistance_ohm)
Definition: ina219.h:19
void set_max_voltage_v(float max_voltage_v)
Definition: ina219.h:21
sensor::Sensor * current_sensor_
Definition: ina219.h:34
float get_setup_priority() const override
Definition: ina219.cpp:148
void set_current_sensor(sensor::Sensor *current_sensor)
Definition: ina219.h:24
sensor::Sensor * bus_voltage_sensor_
Definition: ina219.h:32
sensor::Sensor * power_sensor_
Definition: ina219.h:35
void set_bus_voltage_sensor(sensor::Sensor *bus_voltage_sensor)
Definition: ina219.h:22
void set_power_sensor(sensor::Sensor *power_sensor)
Definition: ina219.h:25
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_shunt_voltage_sensor(sensor::Sensor *shunt_voltage_sensor)
Definition: ina219.h:23
Base-class for all sensors.
Definition: sensor.h:57
sensor::Sensor * shunt_voltage_sensor_
Definition: ina219.h:33
This Class provides the methods to read/write bytes from/to an i2c device.
Definition: i2c.h:133