vlfd-rs 1.0.0

Modern Rust driver for the VLFD board
Documentation
  • Coverage
  • 8.7%
    4 out of 46 items documented1 out of 1 items with examples
  • Size
  • Source code size: 35.61 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.28 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 16s Average build duration of successful builds.
  • all releases: 17s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • 0xtaruhi

vlfd-rs

vlfd-rs is a modern Rust driver for a VeriComm-compatible USB interface board. It exposes ergonomic APIs for bringing the hardware online, exchanging FIFO data, and programming the onboard FPGA fabric.

Features

  • Automatic USB session and endpoint management with sensible timeouts
  • Transparent encryption/decryption for VeriComm FIFO transfers
  • High-level configuration getters and setters with caching
  • Bitstream upload support for the integrated FPGA programmer
  • Hotplug callbacks powered by libusb's hotplug subsystem

Quick Start

use vlfd_rs::{Device, IoSettings, Result};

fn main() -> Result<()> {
    let mut device = Device::connect()?;

    let mut settings = IoSettings::default();
    device.enter_io_mode(&settings)?;

    let mut tx = [0x1234u16; 4];
    let mut rx = [0u16; 4];
    device.transfer_io(&mut tx, &mut rx)?;

    device.exit_io_mode()?;
    Ok(())
}

Installation

Add the crate to your Cargo.toml:

[dependencies]
vlfd-rs = "1.0"

Hotplug Example

use vlfd_rs::{Device, HotplugEventKind, HotplugOptions};

fn main() -> vlfd_rs::Result<()> {
    let device = Device::new()?;
    let _registration = device.usb().register_hotplug_callback(
        HotplugOptions::default(),
        |event| match event.kind {
            HotplugEventKind::Arrived => println!("Device arrived: {:?}", event.device),
            HotplugEventKind::Left => println!("Device left: {:?}", event.device),
        },
    )?;

    loop {
        std::thread::sleep(std::time::Duration::from_secs(1));
    }
}

License

Apache-2.0