https://github.com/warchant/spi-repl
https://github.com/warchant/spi-repl
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/warchant/spi-repl
- Owner: Warchant
- License: mit
- Created: 2024-07-27T18:53:08.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-07-28T15:57:52.000Z (10 months ago)
- Last Synced: 2025-01-15T08:03:59.774Z (5 months ago)
- Language: Python
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# spi-repl
Pure python SPI REPL (Read-Evaluate-Print-Loop) which allows you to interact with SPI devices from the command line.
- 0 dependencies, only python.
- Python 3.7+.
- Windows is not supported.## Installation
```
pip install spi-repl
```## Example:
```bash
$ spi-repl --help
usage: spi-repl [-h] [--device DEVICE] [--speed SPEED] [--bits-per-word BITS_PER_WORD] [--phase] [--polarity] [--cs-high] [--lsb-first] [--three-wire] [--loop] [--no-cs] [--ready]SPI REPL
options:
-h, --help show this help message and exit
--device DEVICE SPI device. Default: /dev/spidev0.0
--speed SPEED SPI speed. Default: 1000000
--bits-per-word BITS_PER_WORD
SPI bits per word. Default: 8
--phase SPI phase. Default: False
--polarity SPI polarity. Default: False
--cs-high SPI chip select active level. Default: False
--lsb-first SPI bit order. Default: False
--three-wire SPI 3-wire mode. Default: False
--loop SPI loopback mode. Default: False
--no-cs SPI no chip select. Default: False
--ready SPI slave pulls low to pause. Default: False$ spi-repl --speed 5000000
SPI device: /dev/spidev0.0 speed: 5000000 bits_per_word: 8
now enter hex strings to send to the device
/dev/spidev0.0 <<< 0100
/dev/spidev0.0 >>> 0008
/dev/spidev0.0 <<< 010000000000000000000000000
expected hex string ('00112233445566778899aabbccddeeff')
```