mcp300x v0.1.0 MCP300X
Library for working with MCP300X Analog-to-Digitial Converters.
Link to this section Summary
Functions
Helper conversion function that will take the raw output and
pass it along. Useful for default :convert_func
option
Quickly read the channel_number
from the ADC
Helper conversion function that will take the raw output and turn it into a percent
Helper conversion function that will take the raw output and turn it into a voltage reading
Link to this section Types
channel_number()
channel_number() :: non_neg_integer()
channel_number() :: non_neg_integer()
convert_func()
convert_func() :: (non_neg_integer() -> non_neg_integer())
convert_func() :: (non_neg_integer() -> non_neg_integer())
read_opt()
read_opt() :: {:convert_func, convert_func()}
read_opt() :: {:convert_func, convert_func()}
Options to use when reading a value form the ADC
:convert_func
- A conversion function for the raw output to be passed through (default&MCP300X.id/1
)
Link to this section Functions
id(n)
id(non_neg_integer()) :: non_neg_integer()
id(non_neg_integer()) :: non_neg_integer()
Helper conversion function that will take the raw output and
pass it along. Useful for default :convert_func
option.
read_channel(bus_name, driver, channel_number, opts \\ [])
read_channel(binary() | String.t(), MCP300X.ADC.Driver.t(), channel_number(), [
read_opt()
]) :: {:ok, non_neg_integer()}
read_channel(binary() | String.t(), MCP300X.ADC.Driver.t(), channel_number(), [ read_opt() ]) :: {:ok, non_neg_integer()}
Quickly read the channel_number
from the ADC.
This is useful when checking the value does not take place vary often or in debugging situations.
If you are doing any serious work reading the ADC value you should
use MCP300X.Server
instead, as this function will always open
and close the SPI device.
Options
:convert_func
- defaultMCP300X.id/1
to_percent(n)
to_percent(non_neg_integer()) :: float()
to_percent(non_neg_integer()) :: float()
Helper conversion function that will take the raw output and turn it into a percent
to_volts(n)
to_volts(non_neg_integer()) :: float()
to_volts(non_neg_integer()) :: float()
Helper conversion function that will take the raw output and turn it into a voltage reading