Giter Club home page Giter Club logo

python-spi's Introduction

python-spi

Note: python-spi is still under active development

Overview

A pure Python SPI interface using the Linux spidev device

Features

  • Pure Python implementation. No C module to compile.
  • Supports half-duplex reads and writes as well as full-duplex transfers.
  • Exposes all available spidev interface options as properties.

Requirements

  • spidev enabled in the kernel and (if necessary) the device tree.
  • Write permissions to the /dev/spidevN.N device.
    • Some distributions have an 'spi' group for this purpose. If available, add this group to the user account and ensure the spidev device is group-writeable.
    • If no 'spi' group exists, a udev rule can be created to set the permissions of the spidev device.
    • As a last resort, running the python script as root should allow access to the spidev. Note This is not recommended. Use the 'spi' group or udev rules whenever possible.

Example

import spi
spi = SPI("/dev/spidev1.0")
spi.mode = SPI.MODE_0
spi.bits_per_word = 8
spi.speed = 500000
received = spi.transfer([0x11, 0x22, 0xFF])
spi.write([0x12, 0x34, 0xAB, 0xCD])
received = spi.read(10)

python-spi's People

Contributors

tomstokes avatar f16falcona46 avatar

Stargazers

Conrad Menchine avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.