Skip to main content

Class Ina2xx

Represents a INA2xx Series Precision Digital Current and Power Monitor

Assembly: Ina2xx.dll
View Source
Declaration
public abstract class Ina2xx : ByteCommsSensorBase<(Current? Current, Voltage? Voltage, Power? Power)>, IObservable<IChangeResult<(Current? Current, Voltage? Voltage, Power? Power)>>, ISamplingSensor<(Current? Current, Voltage? Voltage, Power? Power)>, ISensor<(Current? Current, Voltage? Voltage, Power? Power)>, IDisposable, ICurrentSensor, ISamplingSensor<Current>, ISensor<Current>, IVoltageSensor, ISamplingSensor<Voltage>, ISensor<Voltage>, IPowerSensor, ISamplingSensor<Power>, ISensor<Power>, ISensor, ISamplingSensor, II2cPeripheral

Inheritance: System.Object -> Meadow.Foundation.ObservableBase<UNIT>

Derived:
Meadow.Foundation.Sensors.Power.Ina219

Implements:

Expand

System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Current>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Power>>>>, Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Current>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Power>>>, Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Current>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Power>>>, System.IDisposable, Meadow.Peripherals.Sensors.ICurrentSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Current>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Current>, Meadow.Peripherals.Sensors.IVoltageSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Voltage>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Voltage>, Meadow.Peripherals.Sensors.IPowerSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Power>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Power>, Meadow.Peripherals.Sensors.ISensor, Meadow.Peripherals.Sensors.ISamplingSensor, Meadow.Hardware.II2cPeripheral

Properties

DefaultI2cAddress

The default I2C address for the peripheral

View Source
Declaration
public byte DefaultI2cAddress { get; }

DefaultBusSpeed

Default I2C Bus Speed to use for communication.

View Source
Declaration
public static I2cBusSpeed DefaultBusSpeed { get; }

IsConfigured

Returns <b>true</b> if the sensor has been configured, otherwise <b>false</b>

View Source
Declaration
public bool IsConfigured { get; protected set; }

Current

The value of the current (in Amps) flowing through the shunt resistor from the last reading.

View Source
Declaration
public Current? Current { get; }

Voltage

The voltage from the last reading.

View Source
Declaration
public Voltage? Voltage { get; }

Power

The power from the last reading.

View Source
Declaration
public Power? Power { get; }

ManufacturerID

The manufacturer identification, if supported. Otherwise returns an empty string.

View Source
Declaration
public string ManufacturerID { get; }

DeviceID

The device identification number, if supported. Otherwise returns 0.

View Source
Declaration
public ushort DeviceID { get; }

DeviceRevision

The Device Revision code, if supported. Otherwise returns 0.

View Source
Declaration
public byte DeviceRevision { get; }

Fields

ConfigRegister

Common Configuration Register (16 bits)

View Source
Declaration
protected const byte ConfigRegister = 0

Methods

GetAddress(AddressConnection, AddressConnection)

Lookup the correct address to use for the INA2xx based on the address pin connections.

View Source
Declaration
public static byte GetAddress(Ina2xx.AddressConnection a0, Ina2xx.AddressConnection a1)
Returns

System.Byte: correct Meadow.Foundation.Sensors.Power.Ina2xx.Addresses value to use, as a byte

Parameters
TypeNameDescription
Meadow.Foundation.Sensors.Power.Ina2xx.AddressConnection specifying what A0 is connected to.
Meadow.Foundation.Sensors.Power.Ina2xx.AddressConnection specifying what A1 is connected to.

Configure()

Sets the sensor Configuration to default values. Each implementation should provide overloads for specific available options.

View Source
Declaration
public abstract void Configure()

Reset()

Resets Ina2xx to default settings.

View Source
Declaration
public void Reset()

RaiseEventsAndNotify(IChangeResult<(Current? Current, Voltage? Voltage, Power? Power)>)

Raise events for subscribers and notify of value changes.

View Source
Declaration
protected override void RaiseEventsAndNotify(IChangeResult<(Current? Current, Voltage? Voltage, Power? Power)> changeResult)
Parameters
TypeNameDescription
Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Current>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Power>>>changeResultThe updated sensor data

ReadSensor()

Read value from sensor

View Source
Declaration
protected override Task<(Current? Current, Voltage? Voltage, Power? Power)> ReadSensor()
Returns

System.Threading.Tasks.Task<System.ValueTuple<System.Nullable<Meadow.Units.Current>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Power>>>: unitized value### ReadCurrent() Read the Current measurement from the power monitor IC.

View Source
Declaration
public abstract Current ReadCurrent()
Returns

Meadow.Units.Current

ReadBusVoltage()

Read the Voltage measurement from the power monitor IC.

View Source
Declaration
public abstract Voltage ReadBusVoltage()
Returns

Meadow.Units.Voltage

ReadShuntVoltage()

Read the Voltage across the Shunt (sense) resistor from the power monitor IC.

View Source
Declaration
public abstract Voltage ReadShuntVoltage()
Returns

Meadow.Units.Voltage

ReadPower()

Read the Power measurement from the power monitor IC.

View Source
Declaration
public abstract Power ReadPower()
Returns

Meadow.Units.Power

Implements

  • System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Current>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Power>>>>
  • Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Current>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Power>>>
  • Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Current>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Power>>>
  • System.IDisposable
  • Meadow.Peripherals.Sensors.ICurrentSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Current>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Current>
  • Meadow.Peripherals.Sensors.IVoltageSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Voltage>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Voltage>
  • Meadow.Peripherals.Sensors.IPowerSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Power>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Power>
  • Meadow.Peripherals.Sensors.ISensor
  • Meadow.Peripherals.Sensors.ISamplingSensor
  • Meadow.Hardware.II2cPeripheral