[Vm-dev] SPI Plugin for Raspberry PI

David T. Lewis lewis at mail.msen.com
Fri Mar 29 18:37:42 UTC 2013


On Fri, Mar 29, 2013 at 09:54:12AM -0700, tim Rowledge wrote:
> 
> 
> On 29-03-2013, at 9:33 AM, Jon Hylands <jon at huv.com> wrote:
> 
> > Hi everyone,
> > 
> > I'm going to be upgrading one of my robots with a Raspberry PI, and I need it to talk to an Arduino over SPI (using level converters to switch from 3.3 to 5 volts). So, I need to write an SPI plugin, which I assume should be very similar (at least under linux) to the SerialPlugin.
> > 
> > I found this page: http://wiki.squeak.org/squeak/6102
> > 
> > Does it more or less describe the state of the art in terms of writing plugins?
> 
> Not quite. It completely ignores the SmartSyntaxInterpreterPlugin class and the plugins that are subclasses from it. It provides some much simpler syntax for handling the fetching of stack parameters and returning answers; take a look at FileCopyPlugin as a really trivial example. 
>

There are lots of plugins to look at for examples. Given that you expect
your plugin to be similar to SerialPlugin, you might want to just start
with a copy of that, delete all the stuff you don't want, and carry on
from there.

I'm assuming you are using a fairly recent Squeak image, and that you
are working on Linux, and that your main objective is to write a new
plugin that will work on Cog or interpreter VM. If that is the case,
I would suggest loading VMMaker from SqueakMap, which gives you the
development environment for an interpreter VM along with lots of plugins
that you can steal code from. The build procedure for Linux is simple
for an individual user, and the environment is convenient for writing
plugins because you can browse the generated C code as you work. The
resulting plugin will work identically when you compile it for Cog.

I'm pretty sure there has been discussion of Arduino interfaces before,
possibly on the Pharo list, so you may want to do some googling around
to see what's out there already.

Dave
 


More information about the Vm-dev mailing list