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!



Try Adafruit's new iPhone & iPad app for makers! Circuit Playground! "Incredibly handy for anyone working in electronics. Perfect for engineers and non-engineers alike."
Looking for engineers, makers and the builders of dreams? Try our Adafruit job boards.
Join our weekly Adafruit SHOW-AND-TELL at 9:30pm ET every Saturday night! Then at 10pm, ASK-AN-ENGINEER with Ladyada and the Adafruit team!

3 Comments

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

    Comment by Adam Haile — January 11, 2013 @ 9:27 am

  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.

    Comment by Alex Eames — January 11, 2013 @ 5:30 pm

  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

    Comment by Louis Thiery — January 11, 2013 @ 8:11 pm

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

www.flickr.com
adafruit's items Go to adafruit's photostream
www.flickr.com
items in Adafruits More in Adafruits pool