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 :
::channel Up to 4 channels, from 1 to 4, are available depending on the model.
::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.
::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 ::converting? set to true.
::pga Programamble Gain Amplifier. #{:x1 :x2 :x4 :x8}
::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 : ::channel Up to 4 channels, from 1 to 4, are available depending on the model. ::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. ::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 ::converting? set to true. ::pga Programamble Gain Amplifier. #{:x1 :x2 :x4 :x8} ::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/dvlopt/linux.i2c.clj
(address)
(address a0 a1 a2)
Gets the address of a slave device.
The user can use pins a0
, a1
and a2
to modify the default address by specifying a boolean value for each.
Gets the address of a slave device. The user can use pins `a0`, `a1` and `a2` to modify the default address by specifying a boolean value for each.
(configure bus parameters)
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.
Cf. defaults
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. Cf. `defaults`
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 ::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 ::micro-volt.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close