|
DUDS
|
Distributed Update of Data from Something
|
Preliminary support for TI's INA219 voltage and current sensor. More...
#include <INA219.hpp>
Public Member Functions | |
| INA219 (std::unique_ptr< duds::hardware::interface::Smbus > &c, double sr) | |
| ~INA219 () | |
| duds::data::Quantity | busCurrent () const |
| Returns the computed bus current using the sampled shunt voltage and the shunt resistance. More... | |
| duds::data::Quantity | busPower () const |
| Returns the computed bus power using the sampled bus voltage and the computed bus current. More... | |
| duds::data::Quantity | busVoltage () const |
| Returns the sampled bus voltage. More... | |
| duds::data::Quantity | maxCurrent () const |
| Returns the maximum current that can be measured by the device. More... | |
| void | sample () |
| Reads sample data from the device. More... | |
| duds::data::Quantity | shuntResistance () const |
| Returns the shunt resistance. More... | |
| duds::data::Quantity | shuntVoltage () const |
| Returns the sampled shunt voltage. More... | |
| void | vals (std::int16_t &sV, std::int16_t &bV) |
Private Attributes | |
| std::int16_t | busV |
| The raw data for the sampled bus voltage. More... | |
| std::unique_ptr< duds::hardware::interface::Smbus > | com |
| Communication bus. More... | |
| double | shunt |
| Shunt resistance; used to compute current. More... | |
| std::int16_t | shuntV |
| The raw data for the sampled shunt voltage. More... | |
Preliminary support for TI's INA219 voltage and current sensor.
This device measures two voltages in a way that allows computation of current and power. The current must pass through a shunt resistor. The voltage across that resistor, and the voltage between there and ground, is measured. This class can compute the power and current based on these measurements, but it needs to know the shunt resistance for these computations.
Normally uses address 0x40. Does not use PEC; not really a SMBus device.
Definition at line 31 of file INA219.hpp.
| duds::hardware::devices::instruments::INA219::INA219 | ( | std::unique_ptr< duds::hardware::interface::Smbus > & | c, |
| double | sr | ||
| ) |
Maybe find way to produce SMBus config.
| c | The SMBus interface to use for communication. PEC must be disabled. |
| sr | The shunt resistance in ohms. |
Definition at line 14 of file INA219.cpp.
| duds::hardware::devices::instruments::INA219::~INA219 | ( | ) |
Definition at line 25 of file INA219.cpp.
| duds::data::Quantity duds::hardware::devices::instruments::INA219::busCurrent | ( | ) | const |
Returns the computed bus current using the sampled shunt voltage and the shunt resistance.
Definition at line 48 of file INA219.cpp.
Referenced by busPower().
| duds::data::Quantity duds::hardware::devices::instruments::INA219::busPower | ( | ) | const |
Returns the computed bus power using the sampled bus voltage and the computed bus current.
Definition at line 52 of file INA219.cpp.
| duds::data::Quantity duds::hardware::devices::instruments::INA219::busVoltage | ( | ) | const |
Returns the sampled bus voltage.
Definition at line 44 of file INA219.cpp.
Referenced by busPower().
| duds::data::Quantity duds::hardware::devices::instruments::INA219::maxCurrent | ( | ) | const |
Returns the maximum current that can be measured by the device.
This value changes with the shunt resistance.
Definition at line 32 of file INA219.cpp.
| void duds::hardware::devices::instruments::INA219::sample | ( | ) |
Reads sample data from the device.
Definition at line 56 of file INA219.cpp.
| duds::data::Quantity duds::hardware::devices::instruments::INA219::shuntResistance | ( | ) | const |
| duds::data::Quantity duds::hardware::devices::instruments::INA219::shuntVoltage | ( | ) | const |
Returns the sampled shunt voltage.
Definition at line 40 of file INA219.cpp.
Referenced by busCurrent().
|
inline |
Definition at line 93 of file INA219.hpp.
|
private |
The raw data for the sampled bus voltage.
Definition at line 47 of file INA219.hpp.
Referenced by busVoltage(), sample(), and vals().
|
private |
Communication bus.
Definition at line 35 of file INA219.hpp.
|
private |
Shunt resistance; used to compute current.
Definition at line 39 of file INA219.hpp.
Referenced by maxCurrent(), and shuntResistance().
|
private |
The raw data for the sampled shunt voltage.
Definition at line 43 of file INA219.hpp.
Referenced by sample(), shuntVoltage(), and vals().