I like writing code in Scheme for a wide variety of reasons. I was wondering about using it control the GPIO pins on my RaspberryPi model B, but I couldn't find any way to do it. Therefore, I decided to write a set of bindings for the WiringPi library using Cyclone Scheme's FFI.
Right now, I've written bindings for all the functions documented here, except for those dealing with interrupts and threading. I don't think it will be hard to write the wrappers necessary for those functions, and I should add them sometime in the next few days.
I've currently got the functions separated out into different library modules that contain related functions. Currently, this is one for the three setup functions, one for all the PWM functions, one for all the non-PWM pin-related functions, and one for the timing functions.
Here's the code, if anyone is interested. You can see an example of usage in test.scm at the root of the repo. Right now, compilation is a bit funky because Cyclone Scheme does not currently provide a clean way to link additional C libraries. Therefore, you need to run a series of commands, as you can see in the Makefile in the root of the git repo. Basically, you need to run the commands suggested by cyclone -d, adding in a link to the wiringPi library for the final stage of compilation.
Unfortunately, code using this library does not currently work using the cyclone interpreter and must be compiled. I believe this is also due to the difficulty with linking in an extra C library. To really fix both these issues, I'd probably have to patch Cyclone, which I'm not particularly interested in doing at the moment.
I hope this comes in handy if anyone wants to use it!