spi
Version, currently master branch1 version
- master branchlatestJan 30, 2024
github.com/SleepingInsomniac/Spi
SPI Interface for raspberry pi
0 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
spi:
github: SleepingInsomniac/Spi
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.11.2- License
- MIT
- Author
- Alex Clink
Dependencies
This version declares no dependencies.
README
Spi
Crystal interface to the SPI driver on the Raspberry PI. This uses the userland IOCTL SPI interface to send and receive data on the raspberry pi.
Installation
-
Add the dependency to your
shard.yml:dependencies: spi: github: sleepinginsomniac/spi -
Run
shards install
Usage
require "spi"
device = Spi::Device.new("/dev/spidev0.0")
device.mode = Spi::Mode::MODE_1
device.bits_per_word = 8_u8
device.baud = 800_000_u32 # 800KHz or whatever is supported
# Send 1 byte
data = Slice[0xAAu8] # etc.
device.send(data)
# Receive 10 bytes
data = Slice(UInt8).new(10)
device.receive(data)
# Duplex data:
dout = Slice[0xAAu8]
din = Slice(UInt8).new(1)
device.transfer(send: dout, recv: din)
Development
TODO: Write development instructions here
Contributing
- Fork it (https://github.com/sleepinginsomniac/spi/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Alex Clink - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Jan 30, 2024
- Crystal
>= 1.11.2- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/SleepingInsomniac/Spi
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 1