#spi-driver

no-std spidriver-hal

Implementations of embedded-hal crates via a SPIDriver device

1 unstable release

0.1.0 Jun 29, 2019

#57 in #spi-driver

MIT license

20KB
320 lines

SPIDriver implementations of some embedded-hal traits.

This library provides implementations of several embedded-hal crates in terms of the SPIDriver protocol. This allows driver crates that are written in terms of those traits to control their corresponding devices via an SPIDriver module.

Specifically, this library provides:

  • Implementations of the blocking SPI Write and Transfer traits that transmit data via the SPIDriver.
  • An implementation of the v2 Digital IO OutputPin trait for the chip select output of the SPIDriver.
  • Implementations of the v2 Digital IO OutputPin trait for the auxillary output pins A and B on the SPIDriver.

To use it, first instantiate and configure an SPIDriver object from the spidriver crate, and then pass it to SPIDriverHAL::new before calling split to obtain the individual interface objects:

let sd = SPIDriver::new(rx, tx); // rx and tx obtained from some underlying platform crate
let parts = SPIDriverHAL::new(sd).split();

Dependencies

~71KB