INA3221 3-Channel DC Current Sensor

See Application::make_ina3221().

API Reference

class INA3221Component : public PollingComponent, public I2CDevice

Public Functions

INA3221Component(I2CComponent *parent, uint8_t address = 0x40, uint32_t update_interval = 15000)
void setup()

Where the component’s initialization should happen.

Analogous to Arduino’s setup(). This method is guaranteed to only be called once. Defaults to doing nothing.

void dump_config()
void update()
float get_setup_priority() const

priority of setup().

higher -> executed earlier

Defaults to 0.

Return
The setup priority of this component

INA3221VoltageSensor *make_bus_voltage_sensor(int channel, const std::string &name)
INA3221VoltageSensor *make_shunt_voltage_sensor(int channel, const std::string &name)
INA3221CurrentSensor *make_current_sensor(int channel, const std::string &name)
INA3221PowerSensor *make_power_sensor(int channel, const std::string &name)
void set_shunt_resistance(int channel, float resistance_ohm)

Protected Attributes

struct sensor::INA3221Component::INA3221Channel channels[3]
struct INA3221Channel

Public Functions

bool exists()
bool should_measure_shunt_voltage()
bool should_measure_bus_voltage()

Public Members

float shunt_resistance_ = {0.1f}
INA3221VoltageSensor *bus_voltage_sensor_ = {nullptr}
INA3221VoltageSensor *shunt_voltage_sensor_ = {nullptr}
INA3221CurrentSensor *current_sensor_ = {nullptr}
INA3221PowerSensor *power_sensor_ = {nullptr}
using sensor::INA3221VoltageSensor = typedef EmptyPollingParentSensor<2, ICON_FLASH, UNIT_V>
using sensor::INA3221CurrentSensor = typedef EmptyPollingParentSensor<2, ICON_FLASH, UNIT_A>
using sensor::INA3221PowerSensor = typedef EmptyPollingParentSensor<2, ICON_FLASH, UNIT_W>