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
bus_voltage(device_name)
Returns the bus voltage in mV.
child_spec(init_arg)
Returns a specification to start this module under a supervisor.
See Supervisor
.
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.
current(device_name)
Returns the current in mA.
current_divisor(device_name)
Retrieve the current divisor from the process configuration.
current_divisor(device_name, divisor)
Set the current divisor in the process configuration.
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
.
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.
power(device_name)
Returns the power in mW
power_divisor(device_name)
Retrieve the power divisor from the process configuration.
power_divisor(device_name, divisor)
Set the power divisor in the process configuration.
shunt_voltage(device_name)
Returns the shunt voltage in mV.