Skip to content

Foreign Functions for interfacing Raspberry Pi GPIO from Steel Bank Common Lisp

Notifications You must be signed in to change notification settings

LaloHao/rpi-sbcl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RPI SBCL

Dynamic library based on PJ_RPI low level C codes.

Compiling

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")

Install

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")

Basics

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)

About

Foreign Functions for interfacing Raspberry Pi GPIO from Steel Bank Common Lisp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published