January 11, 2013 AT 9:12 am

SPI-Python: Hardware SPI for RasPi from Python #piday #raspberrypi @Raspberry_Pi

SPI-Python

Here’s a tutorial how to AVOID bit-banging and use the hardware via C (while still in Python), shared by Louis Thiery in the Adafruit Forums. And here is the code in Github.

This implementation of SPI in Python is hardware based. Linux-level C code is compiled as a Python module. I first learned how to get SPI working on the Raspberry Pi with help from a tutorial by Brian Hensley. However, I love Python and I wanted to use this hardware implementation of SPI from within Python. I little searching told me that what I wanted to do was to “extend” Python with C and so this reference was very helpful.

Read more.


998Each Friday is PiDay here at Adafruit, be sure to check out our posts, tutorials and new Raspberry Pi related products. Have you tried the new “Adafruit Raspberry Pi Educational Linux Distro” ? It’s our tweaked distribution for teaching electronics using the Raspberry Pi. But wait, there’s more! Try our new Raspberry Pi WebIDE! The easiest way to learn programming on a Raspberry Pi.

Want a FREE RASPBERRY PI? All orders over $350 get a FREE Raspberry Pi Model B with 512MB RAM!

Related

3 Comments

  1. A little confused, how is this different from the SPI support that is already in occidentalis?

  2. There is a Python module for SPI called py-spidev. https://github.com/doceme/py-spidev

    I found it a few weeks ago when I was writing the Gertboard test suite in Python. IIRC it was Jeremy Blythe’s blog where I first heard about it. :)

    Not much documentation though, but I managed to get it working.

  3. Oh – this tutorial is supposed to explain how to NOT bit-bang SPI in Python…

    I didn’t know about the py-spidev before I wrote my library. It pretty much lines up exactly with what I did :P

Sorry, the comment form is closed at this time.