ina219 v0.1.0 INA219.Device

An individual INA219 device.

Each device needs it's configuration specified in your application's configuration.

Example configuration:

config :ina219,
  devices: [
    %{
        bus: "i2c-1",
        address: 0x41,
        name: :sensor0,
        commands: [:calibrate_32V_1A!],
        current_divisor: 10,
        power_divisor: 2
    }
  ]

Note that bus and address are required. All other parameters are optional. If no name is provided then a tuple of the bus name and address will be used, for example the device above would be named {"i2c-1", 0x41}.

Link to this section Summary

Functions

Returns the bus voltage in mV.

Returns a specification to start this module under a supervisor.

Are new samples ready since the last time you read them? Calling this function will clear the value until next time new samples are ready.

Returns the current in mA.

Retrieve the current divisor from the process configuration.

Set the current divisor in the process configuration.

Executes the passed function with the pid of the I2C connection as it's argument. Use this if you want to manually run functions from Commands or Registers.

Returns true when power or current calculations are out of range. This indicates that current and power data may be meaningless.

Returns the power in mW

Retrieve the power divisor from the process configuration.

Set the power divisor in the process configuration.

Returns the shunt voltage in mV.

Link to this section Functions

Link to this function

bus_voltage(device_name)

Returns the bus voltage in mV.

Link to this function

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

conversion_ready?(device_name)

Are new samples ready since the last time you read them? Calling this function will clear the value until next time new samples are ready.

Link to this function

current(device_name)

Returns the current in mA.

Link to this function

current_divisor(device_name)

Retrieve the current divisor from the process configuration.

Link to this function

current_divisor(device_name, divisor)

Set the current divisor in the process configuration.

Link to this function

execute(device_name, fun)

Executes the passed function with the pid of the I2C connection as it's argument. Use this if you want to manually run functions from Commands or Registers.

Link to this function

math_overflow?(device_name)

Returns true when power or current calculations are out of range. This indicates that current and power data may be meaningless.

Link to this function

power(device_name)

Returns the power in mW

Link to this function

power_divisor(device_name)

Retrieve the power divisor from the process configuration.

Link to this function

power_divisor(device_name, divisor)

Set the power divisor in the process configuration.

Link to this function

shunt_voltage(device_name)

Returns the shunt voltage in mV.