12 namespace duds {
namespace hardware {
namespace devices {
namespace instruments {
15 std::unique_ptr<duds::hardware::interface::Smbus> &c,
28 com->transmitWordBe(0, 0x3998);
58 busV = (std::int16_t)(
com->receiveWordBe(2)) >> 3;
A container for a value and a unit to better describe the value.
duds::data::Quantity shuntVoltage() const
Returns the sampled shunt voltage.
duds::data::Quantity busPower() const
Returns the computed bus power using the sampled bus voltage and the computed bus current...
constexpr Unit Volt(DUDS_UNIT_VALUE(-1, 0, 0, 1, 2, 0, -3, 0, 0))
void transmitWordBe(std::uint8_t cmd, std::uint16_t word)
Sends a command byte and a big-endian data word to the device.
constexpr Unit Ohm(DUDS_UNIT_VALUE(-2, 0, 0, 1, 2, 0, -3, 0, 0))
std::unique_ptr< duds::hardware::interface::Smbus > com
Communication bus.
duds::data::Quantity maxCurrent() const
Returns the maximum current that can be measured by the device.
move_impl move(unsigned int c, unsigned int r)
Display stream manipulator that moves the display cursor to the given location.
duds::data::Quantity shuntResistance() const
Returns the shunt resistance.
std::int16_t busV
The raw data for the sampled bus voltage.
std::int16_t shuntV
The raw data for the sampled shunt voltage.
duds::data::Quantity busVoltage() const
Returns the sampled bus voltage.
constexpr Unit Ampere(DUDS_UNIT_VALUE(1, 0, 0, 0, 0, 0, 0, 0, 0))
INA219(std::unique_ptr< duds::hardware::interface::Smbus > &c, double sr)
double shunt
Shunt resistance; used to compute current.
void sample()
Reads sample data from the device.
duds::data::Quantity busCurrent() const
Returns the computed bus current using the sampled shunt voltage and the shunt resistance.