#spi #spi-driver #embedded-hal-driver #74hc595 #shift-register #const-generics

no-std shiftreg-spi

SPI-based driver for shift registers such as 74HC595 with embedded-hal API

1 unstable release

0.1.0 Dec 29, 2023

#1472 in Embedded development

Download history 3/week @ 2024-02-16 12/week @ 2024-02-23 3/week @ 2024-03-01 46/week @ 2024-03-08 6/week @ 2024-03-15 9/week @ 2024-03-29

61 downloads per month

MIT/Apache

8KB
100 lines

SPI-based driver for shift registers

GitHub Workflow Status (with event) docs.rs

This is an embedded Rust driver for shift registers (such as 74HC595).

Features

  • Fast communication using SPI peripheral.
  • Implements OutputPin trait.
    • Pins of shift registers can be accessed (and passed to other libraries) like microcontroller pins.
  • Supports unlimited daisy chain.
    • Size is specified using const generics

Usage

// Initialize a 8-bit shift register
let shift_reg: SipoShiftReg<_, 8, 1> = SipoShiftReg::new(spi);
// Get an array of individual pins
let mut pins = shift_reg.split();

// Set state of a pin
pins[0].set_high().unwrap();
pins[1].set_low().unwrap();

spi is an SPI driver object which implements SpiDevice.

Dependencies

~88KB