Skip to content

TeMPOraL/cl-wiringpi2

Repository files navigation

CL-WIRINGPI2 - CFFI bindings to WiringPi 2.

A set of lispified bindings to Wiring Pi 2 - a popular library for controlling GPIOs on Raspberry Pi.

The project intention is to provide a Lisp-friendly version of Wiring Pi 2. That means the library’s primary API does not correspond 1 to 1 with Wiring Pi 2. Changes have been made to make it follow the Lisp style of things.

Note that the CFFI bindings themselves have been separated to another package (cl-wiringpi2-ffi); you can use them instead if you prefer the original flavour of the library.

Installation

The simplest way is via QuickLisp. Clone the repo somewhere, and then symlink that folder in ~/quicklisp/local-projects/. Inside your Lisp run (ql:register-local-projects). cl-wiringpi2 should now show on the list outputed by (ql:list-local-projects).

Then, just execute (ql:quickload :cl-wiringpi2) and you’re good to go.

Note that for most functions, Wiring Pi 2 requires to run with superuser privileges. It means your Lisp image will have to be started as such. For example, I run my CCL with:

sudo -E /path/to/ccl/armcl

-E ensures that the environmental variables of your user are retained, so you don’t have to set up separate init file and QuickLisp for the root user.

Status

See the package.lisp file in the main folder for the list of exported symbols. Those are the functions that currently should work.

At the moment the bindings are only to the main Wiring Pi 2 functions, i.e. those contained in the wiringPi.h header.

Documentation

Currently the documentation is available in docstrings of functions in the source files. Consult the Wiring Pi 2 official documentation; most available functions match the originals by name (albeit a bit lispified).

There is an API reference autogenerated by CLOD in docs/ folder.

Examples

Examples are contained in cl-wiringpi2-examples system / package. A simple blink example is available. More to come.

To run blink, connect an LED and a 330Ω resistor to the GPIO 0 (physical pin: 11), like on this image, and execute:

(wpi2-examples:blink)

Testing

The library hasn’t been tested very much. The bindings are pretty straightforward though, so there shouldn’t be surprises. Present API seems to work, but please report any issues.

Support

Bug reports and pull requests always welcome :).

Credits

I did take a quick peek at the bindings to Wiring Pi by Jeremiah LaRocco.

About

CFFI bindings to WiringPi 2 for Common Lisp.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published