i2c is an erlang application for controlling the i2c (Inter-Integrated Circuit) linux interface.
To build rfZone you will need a working installation of Erlang R15B (or
later).
Information on building and installing Erlang/OTP
can be found here
(more info).
rfZone is built using rebar that can be found here, with building instructions here.
Clone the repository in a suitable location:
$ git clone git://github.com/tonyrog/i2c.git
Comment out (enable) the i2c blacklist entry in /etc/modprove.d/raspo-blacklist.conf
, it should read:
# blacklist i2c-bcm2708
Install the i2c tools:
sudo apt-get install i2c-tools
Load the driver:
sudo modprobe i2c-dev
Test the driver - example, list the i2c supported functions:
sudo i2cdetect -F 0
i2c is started in a standard erlang fashion:
$ erl
(node@host) 1> application:start(i2c).
modprobe i2c-stub
The following interface functions exist:
- opent
- close
- set_retries
- set_timeout
- set_slave
- set_slave_force
- set_tenbit
- set_pec
- get_funcs
- rdwr
- smbus
For details see the source code documentation or the source code.
i2c is (partly) documented using edoc. To generate the documentation do:
$ cd i2c
$ rebar doc
The result is a collection of html-documents under i2c/doc
.