Metadata-Version: 2.1
Name: spilite
Version: 0.1.4
Summary: A lite wrapper for spidev with additional chip select options
Home-page: https://github.com/xdylanm/spilite
Author: xdylanm
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

# spilite
A lite wrapper for spidev. 

## Overview

Spilite is a wrapper for [spidev](https://pypi.org/project/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](https://pypi.org/project/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

```python
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)
```



