Library for talking to MCP342x converters using I2C.
Those devices are configured using a single byte and the input voltage is read directly.
Parameters used throughout this library are :
:mcp342x/channel Up to 4 channels, from 1 to 4, are available depending on the model.
:mcp342x/converting? When writing the configuration byte, this parameter must be set to true for initiating a new measure in :one-shot mode. It does not matter in :continuous mode. When reading the input voltage, the converter sets this parameter to false when a new conversion is ready.
:mcp342x/mode In :continuous mode, the converter measures the input voltage constantly whereas in :one-shot mode, the measure only happens when the master writes a configuration byte with :mcp342x/converting? set to true.
:mcp342x/pga Programamble Gain Amplifier. #{:x1 :x2 :x4 :x8}
:mcp342x/resolution Number of bits the input voltage is represented by, depending on the model. #{:12-bit :14-bit :16-bit :18-bit}
IO operations will throw in case of failure and are performed using this library :
Library for talking to MCP342x converters using I2C. Those devices are configured using a single byte and the input voltage is read directly. Parameters used throughout this library are : :mcp342x/channel Up to 4 channels, from 1 to 4, are available depending on the model. :mcp342x/converting? When writing the configuration byte, this parameter must be set to true for initiating a new measure in :one-shot mode. It does not matter in :continuous mode. When reading the input voltage, the converter sets this parameter to false when a new conversion is ready. :mcp342x/mode In :continuous mode, the converter measures the input voltage constantly whereas in :one-shot mode, the measure only happens when the master writes a configuration byte with :mcp342x/converting? set to true. :mcp342x/pga Programamble Gain Amplifier. #{:x1 :x2 :x4 :x8} :mcp342x/resolution Number of bits the input voltage is represented by, depending on the model. #{:12-bit :14-bit :16-bit :18-bit} IO operations will throw in case of failure and are performed using this library : https://github.com/helins/linux.i2c.clj
(address)
(address a0 a1 a2)
Returns the address of a slave device.
Pins a0
, a1
and a2
are used to modify the default address by specifying a boolean value for each.
Returns the address of a slave device. Pins `a0`, `a1` and `a2` are used to modify the default address by specifying a boolean value for each.
(configure bus param+)
Configures the slave device by providing parameters.
Do not forget to select the slave device first.
In absence of a parameter, a default value will be used.
See default+
.
Configures the slave device by providing parameters. Do not forget to select the slave device first. In absence of a parameter, a default value will be used. See [[default+]].
Default values for this namespace.
Default values for this namespace.
(read-channel bus)
(read-channel bus resolution)
Reads a channel and returns a map containing the parameters under which the measure has been done as well as the current input voltage under :mcp342x/micro-volt.
Reads a channel and returns a map containing the parameters under which the measure has been done as well as the current input voltage under :mcp342x/micro-volt.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close