[Vm-dev] Re: Interfacing with the i/o pins on the Raspberry Pi et al

tim Rowledge tim at rowledge.org
Tue Aug 4 20:54:44 UTC 2015


On 04-08-2015, at 11:14 AM, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>     I'm curious about interfacing Squeak with the i/o pins on the Raspberry Pi et al.  Should we write a plugin?  Does the FFI work just fine?  What's a good guide?  Who's done this already?  What was good/bad about the approach you (if it is you) took?

I’ve been using Gordon Henderson’s wiringPi library via FFI so far. No especial technical reason for that choice; Gordon is a ‘friend of Pi’, it was suggested to me as worth a look, it made getting the first few Pi add-ons working reasonably simple. It does have a few issues, not least the way that he chose to make errors totally-fatal after getting fed up with people complaining about problems and admitting they weren’t bothering to check error flags.

The is also pigpio, which may be a better target since it appears to be a deamon that can avoid needing to sudo to get pin access. Haven’t done any investigation yet.

Doug was using bcm2835.so with some considerable success. I’ve been building wiringPi handler classes modelled on his work. 

Generally performance does not seem to be an issue; I can make assorted add-ons dance arbitrarily fast in test code and within Scratch the gpio bandwidth is not the limiting issue. I’ve also extended the paradigm to talk serial (for PiLite, file (for the framebuffer interface to the AstroPi LED array) and just plain text for invoking time, ip address etc.

The only related area notably affecting me is that a lot of Pi stuff has python libraries. Right now we can’t call them so I have to dig into the code (oh, yurgh) and replicate relevant functionality. Tedious. I have noticed that a lot of python libraries are merely shims around C++ code but we can’t call that either without a C shim - and anyway the python code often does extra bits around the edges.

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Never do at  compile-time what you can put off till run-time




More information about the Vm-dev mailing list