Dynamic library based on PJ_RPI low level C codes.
It comes precompiled for RPi, only recompile if you are going to use a RPi 2.
Clone PJ_RPI repo.
git clone https://github.com/Pieter-Jan/PJ_RPI.git
Find line 21-22 on file PJ_RPI.h from PJ_RPI
repo and
uncomment your RPI:
//#define RPI
#define RPI2
Modify rpi.c line 1 from this repo to match your PJ_RPI
location
#include "../PJ_RPI/PJ_RPI.c"
Compile the dynamic library:
cc -c rpi.c && ld -shared -o rpi.so rpi.o
Then compile Lisp library with:
(compile-file "rpi.lisp")
Load libraries on your Lisp code, changing to your own path ofc:
(load-shared-object "/path/to/repo/rpi-sbcl/rpi.so")
(load "/path/to/repo/rpi-sbcl/rpi.fasl")
It uses BCM processor pin numbering.
For now, functions available are:
(rpi::set-output port)
(rpi::set-input port)
(rpi::set-gpio-low port)
(rpi::set-gpio-high port)
(rpi::set-gpio port value)
(rpi::read-gpio port)
Note: At the very low level(C code) the function (rpi::set-gpio
port value)
uses the other two functions (rpi::set-gpio-low port)