-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
106 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,81 @@ | ||
exodev_gpio | ||
gpio | ||
=========== | ||
|
||
sysfs GPIO port driver and erlang module. | ||
gpio is a device driver application for GPIO (General Purpose IO) written in erlang and C. | ||
|
||
Please ensure that the exodev_gpio repo is cloned to a local directory called "gpio": | ||
git clone git@github.com:Feuerlabs/exodev_gpio gpio | ||
IO-pins are accessed either in a generic, Linux-based, way using control files or by direct memory acces. <br> | ||
Direct memory acces is currently implemented for the following processors: | ||
<ul> | ||
<li>bcm 2835 (Raspberry Pi)</li> | ||
</ul> | ||
|
||
If this is not done, the code:priv_dir() will bomb out and gpio:open_pin() will fail. | ||
### Dependencies | ||
|
||
application:start(gpio), gpio:open_pin(1, output, low), gpio:sequence(1, [ 2000, 2000, 2000 ]). | ||
To build gpio you will need a working installation of Erlang R15B (or | ||
later).<br/> | ||
Information on building and installing [Erlang/OTP](http://www.erlang.org) | ||
can be found [here](https://github.com/erlang/otp/wiki/Installation) | ||
([more info](https://github.com/erlang/otp/blob/master/INSTALL.md)). | ||
|
||
gpio:sequence(1, [2000, 2000, 2000]). | ||
gpio is built using rebar that can be found [here](https://github.com/basho/rebar), with building instructions [here](https://github.com/basho/rebar/wiki/Building-rebar). | ||
|
||
### Downloading | ||
|
||
Clone the repository in a suitable location: | ||
|
||
``` | ||
$ git clone git://github.com/tonyrog/gpio.git | ||
``` | ||
### Run | ||
|
||
gpio is started in a standard erlang fashion: | ||
|
||
``` | ||
$ erl | ||
``` | ||
|
||
``` | ||
(node@host) 1> application:start(gpio). | ||
``` | ||
|
||
### API | ||
|
||
The interface has the following functions for accessing a single pin: | ||
<ul> | ||
<li>init</li> | ||
<li>init_direct</li> | ||
<li>release</li> | ||
<li>set</li> | ||
<li>get</li> | ||
<li>clr</li> | ||
<li>input</li> | ||
<li>output</li> | ||
<li>set_direction</li> | ||
<li>get_direction</li> | ||
<li>set_interrupt</li> | ||
<li>get_interrupt</li> | ||
</ul> | ||
|
||
The interface has the following functions for accessing several pins using a mask: | ||
<ul> | ||
<li>set_mask</li> | ||
<li>get_mask</li> | ||
<li>clr_mask</li> | ||
</ul> | ||
|
||
For details see the generated documentation. | ||
|
||
### Documentation | ||
|
||
gpio is documented using edoc. | ||
To generate the documentation do: | ||
|
||
``` | ||
$ cd gpio | ||
``` | ||
|
||
``` | ||
$ rebar doc | ||
``` | ||
|
||
The result is a collection of html-documents under ```gpio/doc```. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters