Skip to main content

A lite wrapper for spidev with additional chip select options

Project description

spilite

A lite wrapper for spidev.

Overview

Spilite is a wrapper for spidev. It adds

  • Entry and exit behaviour so that a SPI device can be treated as a file handle
  • Additional types to support different software controlled chip select schemes
    • single pin (active high or low)
    • hardware address decoder (e.g. 74HC138)

For pin behaviour, gpiozero types are used. This approach assumes that the hardware control of the chip select is not used (i.e. not using the hardware flow control with the micro's own SPI controller).

Example

import spilite.spi as spi
from spilite.cs.pins import ChipSelectPin

# setup chip select pin
cs_pin = ChipSelectPin(21)
cs_pin.unselect()
# setup the SPI bus device (speed and cpol)
dev = spi.Port(cs=cs_pin, max_speed_hz=1000000, mode=0b11)
# ...
# send/receive two bytes
buffer = [0xff, 0xab]
with dev as bus:
  bus.xfer2(buffer)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spilite-0.1.4.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spilite-0.1.4-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file spilite-0.1.4.tar.gz.

File metadata

  • Download URL: spilite-0.1.4.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for spilite-0.1.4.tar.gz
Algorithm Hash digest
SHA256 163cc006297c854a3645af384867352523e89e3c9aab776d7879ef57cab2b57a
MD5 cf4beffa58a54fb27498069c37a32fdc
BLAKE2b-256 049e48cddea6ab63f6fb77ee458cc5d2414235d1ac0009cd4d5965c2f570d0a2

See more details on using hashes here.

File details

Details for the file spilite-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: spilite-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for spilite-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 742805ad29a53b17e3a5078f880686c5d6e54a230843ae3cba13ba34901c31a7
MD5 782e757c6b858495c0a9bea30b714ba1
BLAKE2b-256 8c86779f377172a0267674d480a5855c6b5b30d187c586e84860eba3c2292a3e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page