ads1115 v0.2.1 ADS1015
Functions to interact with an ADS1015 analog-to-digital chip
Link to this section Summary
Functions
Read the current configuration from the device
Ask for a reading of an analog signal with customizable comparison parameters.
Ask for a reading for one of the analog signals with default settings
Set the configuration on the device
Link to this section Functions
config(bus, addr)
config(reference(), byte()) :: {:ok, ADS1015.Config.t()} | {:error, term()}
config(reference(), byte()) :: {:ok, ADS1015.Config.t()} | {:error, term()}
Read the current configuration from the device
custom_read(bus, addr, config)
custom_read(reference(), Circuits.I2C.address(), ADS1015.Config.t()) ::
{:ok, integer()} | {:error, term()}
custom_read(reference(), Circuits.I2C.address(), ADS1015.Config.t()) :: {:ok, integer()} | {:error, term()}
Ask for a reading of an analog signal with customizable comparison parameters.
This will write the configuration register, then wait for the reading to be ready and read it back.
Make sure to set performing_conversion: false
and mode: :single_shot
so that the chip will know
we are waiting for a reading.
ADS1015 uses 16bit register but it has a 12bit value.
read(bus, addr, comparison, gain \\ 2048)
read(reference(), byte(), ADS1015.Config.comparison(), ADS1015.Config.gain()) ::
{:ok, integer()} | {:error, term()}
read(reference(), byte(), ADS1015.Config.comparison(), ADS1015.Config.gain()) :: {:ok, integer()} | {:error, term()}
Ask for a reading for one of the analog signals with default settings
set_config(bus, addr, config)
set_config(reference(), Circuits.I2C.address(), ADS1015.Config.t()) ::
:ok | {:error, term()}
set_config(reference(), Circuits.I2C.address(), ADS1015.Config.t()) :: :ok | {:error, term()}
Set the configuration on the device