#devices

no-std spidriver

A library for communicating with a SPIDriver device

1 unstable release

0.1.0 Jun 29, 2019

#50 in #device


Used in 3 crates

MIT license

9KB
122 lines

SPIDriver client library

This library implements the SPIDriver protocol, allowing Rust programs to interact with an SPIDriver device and in turn to interact with SPI devices.

The entry point is SPIDriver::new, which takes (and consumes) a serial writer and a serial reader as defined by embedded_hal::serial. If you are running on a general computing platform then you can use serial_embedded_hal to connect with a serial port provided by your operating system:

let port = Serial::new(
    "/dev/ttyUSB0",
    &PortSettings {
        baud_rate: serial_embedded_hal::BaudRate::BaudOther(460800),
        char_size: serial_embedded_hal::CharSize::Bits8,
        parity: serial_embedded_hal::Parity::ParityNone,
        stop_bits: serial_embedded_hal::StopBits::Stop1,
        flow_control: serial_embedded_hal::FlowControl::FlowNone,
    },
)?;
let (tx, rx) = port.split();
let sd = SPIDriver::new(tx, rx);

Dependencies

~71KB