Class Ina2xx
Represents a INA2xx Series Precision Digital Current and Power Monitor
Assembly: Ina2xx.dll
View Source
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
public byte DefaultI2cAddress { get; }
DefaultBusSpeed
Default I2C Bus Speed to use for communication.
View Source
public static I2cBusSpeed DefaultBusSpeed { get; }
IsConfigured
Returns <b>true</b> if the sensor has been configured, otherwise <b>false</b>
View Source
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
public Current? Current { get; }
Voltage
The voltage from the last reading.
View Source
public Voltage? Voltage { get; }
Power
The power from the last reading.
View Source
public Power? Power { get; }
ManufacturerID
The manufacturer identification, if supported. Otherwise returns an empty string.
View Source
public string ManufacturerID { get; }
DeviceID
The device identification number, if supported. Otherwise returns 0.
View Source
public ushort DeviceID { get; }
DeviceRevision
The Device Revision code, if supported. Otherwise returns 0.
View Source
public byte DeviceRevision { get; }
Fields
ConfigRegister
Common Configuration Register (16 bits)
View Source
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
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
Type | Name | Description |
---|---|---|
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
public abstract void Configure()
Reset()
Resets Ina2xx to default settings.
View Source
public void Reset()
RaiseEventsAndNotify(IChangeResult<(Current? Current, Voltage? Voltage, Power? Power)>)
Raise events for subscribers and notify of value changes.
View Source
protected override void RaiseEventsAndNotify(IChangeResult<(Current? Current, Voltage? Voltage, Power? Power)> changeResult)
Parameters
Type | Name | Description |
---|---|---|
Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Current>,System.Nullable<Meadow.Units.Voltage>,System.Nullable<Meadow.Units.Power>>> | changeResult | The updated sensor data |
ReadSensor()
Read value from sensor
View Source
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
public abstract Current ReadCurrent()
Returns
Meadow.Units.Current
ReadBusVoltage()
Read the Voltage measurement from the power monitor IC.
View Source
public abstract Voltage ReadBusVoltage()
Returns
Meadow.Units.Voltage
ReadShuntVoltage()
Read the Voltage across the Shunt (sense) resistor from the power monitor IC.
View Source
public abstract Voltage ReadShuntVoltage()
Returns
Meadow.Units.Voltage
ReadPower()
Read the Power measurement from the power monitor IC.
View Source
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